github twitter
Preventing Ubiquiti ERLITE-3 router from using ISP DNS servers
Mar 5, 2015
2 minutes read

Unfortunately, as of EdgeOS v1.6.0, even if you specify custom DNS servers in the system settings, the default behavior is for DNS servers from your ISP to be added to /etc/resolv.conf where they’ll override your custom DNS settings.

EdgeOS screenshot

New Post (updated with permanent solution)

This post used to describe a manual way to remove DNS servers from your ISP, but it wasn’t permanent and would occasionally need to be redone. After coming across this thread on the Ubiquiti forums, I think I might have finally found permanent solution to this “DNS hijacking” problem. The default behavior (as of EdgeOS v1.7.0) is still to override your DNS settings.

In the EdgeOS CLI, use the following commands to stop the DNS servers from populating in `/etc/resolv.conf (replacing eth0 with whichever interface is connected to the WAN).

configure
set interfaces ethernet eth0 dhcp-options name-server no-update
commit
save
exit

That’s it! You can confirm which DNS servers you’re using with a dns leak test linked to in the references below.

Old Post

Before

user@ubnt:~$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 216.165.129.158 #nameserver written by /opt/vyatta/sbin/vyatta_update_resolv.pl
nameserver 216.170.153.146 #nameserver written by /opt/vyatta/sbin/vyatta_update_resolv.pl
search tds.net #line generated by /opt/vyatta/sbin/vyatta_update_resolv.pl

By commenting out the lines added by /opt/vyatta/sbin/vyatta_update_resolv.pl, devices connected to the router will start using the custom DNS servers specified in the GUI.

After

user@ubnt:~$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
#nameserver 216.165.129.158 #nameserver written by /opt/vyatta/sbin/vyatta_update_resolv.pl
#nameserver 216.170.153.146 #nameserver written by /opt/vyatta/sbin/vyatta_update_resolv.pl
search tds.net #line generated by /opt/vyatta/sbin/vyatta_update_resolv.pl

One-liner

To easily remove all of the nameservers added by vyatta_update_resolv.pl, the one liner is

sed '/nameserver written by/d' /etc/resolv.conf > /etc/temp && mv /etc/temp /etc/resolv.conf

Resources


Back to posts


comments powered by Disqus