My default DNS on my router is set to DynDNS. If I set the router as default DNS on my pc, it would use DynDNS as the DNS. Then what if I set Google Public DNS as DNS on my pc, and DynDNS on my router, which DNS will it use?
2 Answers
Your all-in-one-router (effectively also DNS+DHCP+Switch, etc.) is just a 'relay' device in this. It needs another DNS server to relay your DNS queries to and this is called a recursive lookup. PCs can 'ask' these DNS queries either to your router, or they can talk to another one on the internet directly if you want to, e.g. 8.8.8.8
(one of Google's Public DNS service). It will then just bypass the router in DNS queries.
The router might see the queries passing, but unless it intercepts it, it will just happily pass that as all other traffic you send into the world via it.
Network Manager settingsfor your network would actually determine how would a computer resolves domains. Open the Network Connections editor (you can do that either through Network Manager indicator -> Edit Connections
or typing in terminal nm-connection-editor
). Select your network name, click Edit button, and go to IPv4 Settings tab.
Now, take a look at the Method drop-down menu. There's two options of particular interest Automatic (DHCP) and Automatic (DHCP) addresses only. Automatic (DHCP) would use router's DNS. If you had specified another DNS server, like in the image above, your computer would use router's DNS as well as the one you specified. Which one would be used then ? The closest, your routers. If that one couldn't resolve - the second DNS server is asked to resolve. Try using these settings, and you will see the output of nm-tool | tail
tell you two DNS addresses, just like here
What would happen if you used Automatic (DHCP) address only ? As the name suggests, suggests , your machine would only receive an IP address from the router, but use DNS that you specified. And again, we can verify that with nm-tool
How do you know it works ? You could always test with websites that your internet service provider blocks ( if you know of such, of course ). Or you could also use dig
command , which is a domain information look-up
As you can see in the image above, on line 13 it confirms that with Automatic (DHCP) address only setting, my machine sends requests to the DNS server I specified, which in this case, 208.67.220.220, is OpenDNS
Note: when you make changes to your desired network, remember disconnect and reconnect or restart network manager for changes to take effect