How to prevent non existent domain redirect

My local Internet service provider is redirecting non existent domains to the crappy website used to serve advertisements and compromise user privacy. This behavior can be easily circumvented using third party DNS servers or an OpenWRT small Linux distribution for embedded devices.

Third party DNS service

OpenDNS

Ensure that your local resolver configuration file contains OpenDNS nameservers.

$ cat <<EOF | sudo tee /etc/resolv.conf
nameserver 208.67.222.222
nameserver 208.67.220.220
EOF

Google

Ensure that your local resolver configuration file contains Google Public DNS nameservers.

$ cat <<EOF | sudo tee /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF

Inspect both solutions and choose one that suits you best.

OpenWRT router

OpenWRT is using dnsmasq to provide local DNS service, so you can take advantage of the bogus-nxdomain directive to suppress bogus NX domain.

OpenWRT - advanced dnsmasq settings

Open NetworkDHCP and DNSAdvanced settings tab to enter Bogus NX Domain Override (you can do that multiple times) and then hit Save & apply button at he bottom of the page.

OpenWRT rules

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu