DNS forwarding on the Ubiquiti EdgeRouter X
January 28, 2017Today I wanted to properly set up DNS forwarding on my Ubquiti EdgeRouter X. More specifically, I wanted to use the OpenDNS FamilyShield DNS servers:
208.67.222.123
208.67.220.123
This means that you if you want to use other nameservers, you should substitute those IP addresses for the ones you prefer.
Setting
- Ubiquiti EdgeRouter X (EdgeOS 1.9.0)
- eth0 is the WAN port
- WAN IP is obtained via DHCP
- LAN DHCP settings are already in place (DNS points to the LAN gateway IP and DNS listening on the interface is configured)
Steps
First, we enter configuration mode and delete existing nameservers:
configure
delete system name-server
Then, we set the system nameservers (note that these will be used by the system, not for forwarding):
set system name-server 208.67.222.123
set system name-server 208.67.220.123
If the WAN IP adres is obtained via DHCP, you need to tell the router not to update the nameserver configuration:
set interfaces ethernet eth0 dhcp-options name-server no-update
Finally, here”s the most important part:
set service dns forwarding name-server 208.67.222.123
set service dns forwarding name-server 208.67.220.123
The round-up is as follows:
commit
save
exit
release dhcp interface eth0
renew dhcp interface eth0
The last 2 statements make sure that the provider IP settings are being refreshed. On my device, it took some time for the settings to take effect.
Verification
There are multiple ways to verify the setup.
1. Check the configuration
You can check the setup on the router with this statement:
show dns forwarding nameservers
The output should be something like:
-----------------------------------------------
Nameservers configured for DNS forwarding
-----------------------------------------------
208.67.222.123 available via ''statically configured''
208.67.220.123 available via ''statically configured''
2. Surf for some inappropriate content
When surfing for some inappropriate content, the result should be:
Mission accomplished :)