Edgerouter – DNS Forwarding

I wanted to configure my Edgerouter-X to use Quad9 DNS instead of my ISP’s DNS.
Below are the steps taken in order to achieve my desired result.

Model: Edgerouter-X
Firmware: 1.10.11
Desired DNS 1: 9.9.9.9
Desired DNS 2: 149.112.112.112

Always take a backup of your current configuration before applying any changes!

According to Ubiquiti:

If the system name server is set to loopback address, the router will use the DNS forwarding options for all DNS requests.

So let’s start by doing that

configure
delete system name-server
set system name-server 127.0.0.1

Since I’m getting an IP on my WAN address via PPPoE I’ll need to tell the dhcp-client not to add the ISP DNS servers.

set interfaces ethernet eth0 pppoe 0 name-server none

If you are getting an IP on your WAN address via DHCP, the command should be

set interfaces ethernet eth0 dhcp-options name-server no-update

By default, dnsmasq will send queries to any of the upstream servers it knows about and tries to favor servers that are known to be up. If you want to query the servers in order instead, then add the following:

set service dns forwarding options strict-order

Now let’s add our desired DNS servers:

set service dns forwarding name-server 9.9.9.9
set service dns forwarding name-server 149.112.112.112

Now we can save and commit our changes

commit
save
exit

Reboot Edgerouter-X to apply the changes.

Let’s verify

ubnt@ubnt:~$ show dns forwarding nameservers
-----------------------------------------------
   Nameservers configured for DNS forwarding
-----------------------------------------------
9.9.9.9 available via 'statically configured'
149.112.112.112 available via 'statically configured'
ubnt@ubnt:~$ show dns forwarding statistics
----------------
Cache statistics
----------------
Cache size: 1000
Queries forwarded: 31555
Queries answered locally: 7976
Total DNS entries inserted into cache: 111627
DNS entries removed from cache before expiry: 0

---------------------
Nameserver statistics
---------------------
Server: 149.112.112.112
Queries sent: 21861
Queries retried or failed: 1312

Server: 9.9.9.9
Queries sent: 20321
Queries retried or failed: 1528

If you’ve found my post helpful, I’d love it if you bought me a coffee! ☕😊

Buy Me A Coffee

Ubiquiti’s PDF guide:

Leave a Comment

Your email address will not be published. Required fields are marked *