Add DNS hint

Virtual DNS intercepts the DNS queries generated by the machine. This
requires that the queries are actually sent through the tunnel
interface. In some scenarios, this is not automatically the case, for
example when `/etc/resolv.conf` contains a `nameserver` entry with some
local IP address for which there is a route through the ethernet
interface. A special-purpose IP address like 198.18.0.1 is unlikely to
be inside another route than the default route and can be used to force
DNS resolution through the tunnel.
This commit is contained in:
B. Blechschmidt 2023-03-25 15:20:31 +01:00
parent 20dc6f78f1
commit d4127af422

View file

@ -34,6 +34,9 @@ sudo ip route add 0.0.0.0/1 dev tun0
sudo ip route add ::/1 dev tun0
sudo ip route add 8000::/1 dev tun0
# Make sure that DNS queries are routed through the tunnel.
sudo sh -c "echo nameserver 198.18.0.1 > /etc/resolv.conf"
./target/release/tun2proxy --tun tun0 --proxy "$PROXY_TYPE://$PROXY_IP:$PROXY_PORT"
```