Lightweight DNS forwarder with automatic failover to bypass DNS hijacking and censorship
996
A lightweight, smart DNS forwarding server with automatic failover capabilities. Designed to bypass DNS-based filtering and hijacking.
š¦ Source Code: https://github.com/amirtq/tdfā
In regions with ISP DNS manipulation:
10.x.x.x)TDF solves this by querying primary DNS first, detecting poisoned responses, and automatically retrying through secondary DNS (routed via VPN).
mkdir -p ./data
sudo chown -R 999:999 ./data
sudo chmod -R 755 ./data
services:
tdf:
image: amirtq/tdf:latest
container_name: tdf
ports:
- "53:53/udp"
- "53:53/tcp"
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf:ro
- ./data:/data
environment:
- PRIMARY_DNS=8.8.8.8,8.8.4.4 # Comma-separated primary DNS servers (queried first)
- SECONDARY_DNS=1.1.1.1,1.0.0.1 # Comma-separated fallback DNS servers (used on poisoned response)
- FAILOVER_IP_RANGES=10.0.0.0/8 # CIDR ranges that trigger failover to secondary DNS
- CACHE_TYPE=redis # Cache backend: redis, memory, or none
- REDIS_HOST=127.0.0.1 # Redis server hostname
- REDIS_PORT=6379 # Redis server port
- REDIS_PASSWORD=your_redis_password # Redis authentication password
- LOG_LEVEL=INFO # Logging level: DEBUG, INFO, WARNING, ERROR
restart: unless-stopped
requirepass your_redis_password
save 60 1
dbfilename dump.rdb
dir /data
appendonly no
docker-compose up -d
Point your DNS to the host running TDF (port 53).
| Variable | Description | Default |
|---|---|---|
PRIMARY_DNS | Comma-separated primary DNS servers | Required |
SECONDARY_DNS | Comma-separated secondary DNS servers | Required |
FAILOVER_IP_RANGES | CIDR ranges triggering failover | 10.0.0.0/8 |
CACHE_TYPE | redis, memory, or none | memory |
REDIS_HOST | Redis hostname | 127.0.0.1 |
REDIS_PORT | Redis port | 6379 |
REDIS_PASSWORD | Redis password | - |
LOG_LEVEL | DEBUG, INFO, WARNING, ERROR | INFO |
Route secondary DNS through VPN tunnel:
ip route add 1.1.1.1/32 dev tun0
ip route add 1.0.0.1/32 dev tun0
Or use policy based routing via network router
Content type
Image
Digest
sha256:0f09df431ā¦
Size
42.6 MB
Last updated
9 months ago
docker pull amirtq/tdf