Skip to content

Instantly share code, notes, and snippets.

@mpslanker
Created May 29, 2018 22:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mpslanker/425ff49c928435c270666e912a4289d0 to your computer and use it in GitHub Desktop.
Save mpslanker/425ff49c928435c270666e912a4289d0 to your computer and use it in GitHub Desktop.
configure
delete system name-server
set system name-server 127.0.0.1
Since you are getting an IP on your WAN address via DHCP, you'll need to tell the dhcp-client not to add the ISP DNS servers to /etc/resolv.conf.
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 favour 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
Then you can add your nameservers to dnsmasq. Change the 0's and 1's to the DNS address you want to use. Add more if you like. If using the strict-order option, add them in the order you want them to be queried.
set service dns forwarding name-server 0.0.0.0
set service dns forwarding name-server 1.1.1.1
Once you are happy with your settings, type the following to commit your changes and save the new config.
commit
save
Then, release and renew your WAN IP to remove the ISP servers from /etc/resolv.conf
exit
release dhcp interface eth0
renew dhcp interface eth0
Now, when you type 'show dns forwarding nameservers', it should look like this:
show dns forwarding nameservers
-----------------------------------------------
Nameservers configured for DNS forwarding
-----------------------------------------------
0.0.0.0 available via 'statically configured'
1.1.1.1 available via 'statically configured'
-----------------------------------------------
Nameservers NOT configured for DNS forwarding
-----------------------------------------------
127.0.0.1 available via 'system'
@mpslanker
Copy link
Author

mpslanker commented May 29, 2018

@0x-2a
Copy link

0x-2a commented Jan 9, 2024

Note the set service dns forwarding name-server ... entries should be in reverse order

Check with show dns forwarding statistics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment