Jump to content

Router's DNS settings question

Go to solution Solved by Eigenvektor,

My router has the same. The first one tells the router which DNS servers it should be using, when making requests to the internet (e.g. when its looking for updates).

 

The second one tells the router which DNS servers it should configure on DHCP clients. Normally, you use the router's IP address for the second one, so that it can act as a local caching DNS server. Naturally, this means the router itself needs some DNS server configured, so it can forward requests it hasn't cached yet.

I couldn't find an answer for this, my router has two locations where it's possible to input DNS servers:

1. Under "Network" - "Internet", where you can also change your IP or set Dynamic IP, etc. Here, there's an option to set "get DNS servers from ISP" and then also your custom DNS servers.

2. Under DHCP server, -  DNS servers.

 

I know DHCP will affect the devices on my network, so I assume the first location is for the router itself. What is the actual difference and what happens if they're set differently?

Ryzen 5 2600X / ASRock Fatal1ty B450 Gaming K4 / G.Skill RIPJAWS V 16GB (2X8) 3000Mhz CL15 / Gigabyte RTX 2060 Super Gaming 8GB OC / Corsair RM650X 2018 / Crucial BX500 240GB / Seagate Barracauda 2TB 7200RPM Cooler Master MasterBox E500L /  ASUS TUF Gaming VG27WQ // Rog Orion / Corsair Harpoon RGB Pro / Cooler Master MasterKeys Lite L / Xbox One Red Sport  Special Edition Controller for Windows
Link to comment
https://linustechtips.com/topic/1095923-routers-dns-settings-question/
Share on other sites

Link to post
Share on other sites

I'd imagine the first is the router setting up forward lookup zones, where it's acting as a DNS server and you can choose to use the ISP's servers or specify ones for forwarding requests the router doesn't know. 

 

The second is handing out DNS servers directly via DHCP. So client wouldn't be sending DNS requests to the router, it would go straight to the specified DNS servers. 

 

I know some routers actually have the same setting in different locations, so you may find they're actually the same thing. 

Link to post
Share on other sites

My router has the same. The first one tells the router which DNS servers it should be using, when making requests to the internet (e.g. when its looking for updates).

 

The second one tells the router which DNS servers it should configure on DHCP clients. Normally, you use the router's IP address for the second one, so that it can act as a local caching DNS server. Naturally, this means the router itself needs some DNS server configured, so it can forward requests it hasn't cached yet.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

1 hour ago, Eigenvektor said:

My router has the same. The first one tells the router which DNS servers it should be using, when making requests to the internet (e.g. when its looking for updates).

 

The second one tells the router which DNS servers it should configure on DHCP clients. Normally, you use the router's IP address for the second one, so that it can act as a local caching DNS server. Naturally, this means the router itself needs some DNS server configured, so it can forward requests it hasn't cached yet.

So if you want to use lets say, open dns, you have to put the open dns server on the first one, then the router's ip adress on the DHCP one?

1 hour ago, Oshino Shinobu said:

 

The second is handing out DNS servers directly via DHCP. So client wouldn't be sending DNS requests to the router, it would go straight to the specified DNS servers

 

Which is better?

Ryzen 5 2600X / ASRock Fatal1ty B450 Gaming K4 / G.Skill RIPJAWS V 16GB (2X8) 3000Mhz CL15 / Gigabyte RTX 2060 Super Gaming 8GB OC / Corsair RM650X 2018 / Crucial BX500 240GB / Seagate Barracauda 2TB 7200RPM Cooler Master MasterBox E500L /  ASUS TUF Gaming VG27WQ // Rog Orion / Corsair Harpoon RGB Pro / Cooler Master MasterKeys Lite L / Xbox One Red Sport  Special Edition Controller for Windows
Link to post
Share on other sites

1 hour ago, DSD27 said:

So if you want to use lets say, open dns, you have to put the open dns server on the first one, then the router's ip adress on the DHCP one?

If you set your router's IP address as the DNS server in DHCP, then all of the computers on your local network (that get their IP through DHCP) should use your router as their DNS server.

 

Advantage:
Since your router is on your local network, this should be the fastest possible option (<1ms response time for DNS queries). Unless your router is old and clunky, in which case an external DNS server might actually be faster.

 

Disadvantage:
The more caching DNS servers there are, the longer it can take to get the correct answer when a server's IP address changes.

 

----
If your router does not know the answer to a DNS query, it will forward that question to whichever DNS server you have configured in its own DNS settings. In your example your router would then forward the question to OpenDNS (and cache the answer).

This is a bit slower, because now it has to wait until it gets a response from OpenDNS before it can answer its own client's question. Future requests for the same host name should be a lot faster though, because the answer is now cached locally again.

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

7 hours ago, Eigenvektor said:

If you set your router's IP address as the DNS server in DHCP, then all of the computers on your local network (that get their IP through DHCP) should use your router as their DNS server.

 

Advantage:
Since your router is on your local network, this should be the fastest possible option (<1ms response time for DNS queries). Unless your router is old and clunky, in which case an external DNS server might actually be faster.

 

Disadvantage:
The more caching DNS servers there are, the longer it can take to get the correct answer when a server's IP address changes.

 

----
If your router does not know the answer to a DNS query, it will forward that question to whichever DNS server you have configured in its own DNS settings. In your example your router would then forward the question to OpenDNS (and cache the answer).

This is a bit slower, because now it has to wait until it gets a response from OpenDNS before it can answer its own client's question. Future requests for the same host name should be a lot faster though, because the answer is now cached locally again.

So I assume that  if you use your router as DNS server, you will still take advantage of all the Open DNS or other DNS features, like phishing sites blocking, because the router will use that DNS every time it's a new IP...

 

Is this done right? Always the router's IP adress... If I didn't input anything in here, wouldn't it be eactly the same thing?

 

cIFjfxD.png

Ryzen 5 2600X / ASRock Fatal1ty B450 Gaming K4 / G.Skill RIPJAWS V 16GB (2X8) 3000Mhz CL15 / Gigabyte RTX 2060 Super Gaming 8GB OC / Corsair RM650X 2018 / Crucial BX500 240GB / Seagate Barracauda 2TB 7200RPM Cooler Master MasterBox E500L /  ASUS TUF Gaming VG27WQ // Rog Orion / Corsair Harpoon RGB Pro / Cooler Master MasterKeys Lite L / Xbox One Red Sport  Special Edition Controller for Windows
Link to post
Share on other sites

12 minutes ago, DSD27 said:

So I assume that  if you use your router as DNS server, you will still take advantage of all the Open DNS or other DNS features, like phishing sites blocking, because the router will use that DNS every time it's a new IP...

It's not quite the same, because your router caches DNS requests. Which means if the site isn't blocked by OpenDNS when you first request it, your router will cache the IP address. It will keep that IP address until the cache expires, so its possible your router will still resolve the host name for some time after it's been blocked on OpenDNS.

 

Your configuration looks fine. The values are optional, so it's possible the router will default to its own address when you leave them empty. You can simply try, it's won't break anything (your clients won't be able to connect to the Internet without a gateway/DNS, simply change the config and they should work again ("ipconfig /renew"))

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

How long does it often take for the cache to expire?

Ryzen 5 2600X / ASRock Fatal1ty B450 Gaming K4 / G.Skill RIPJAWS V 16GB (2X8) 3000Mhz CL15 / Gigabyte RTX 2060 Super Gaming 8GB OC / Corsair RM650X 2018 / Crucial BX500 240GB / Seagate Barracauda 2TB 7200RPM Cooler Master MasterBox E500L /  ASUS TUF Gaming VG27WQ // Rog Orion / Corsair Harpoon RGB Pro / Cooler Master MasterKeys Lite L / Xbox One Red Sport  Special Edition Controller for Windows
Link to post
Share on other sites

That depends on the TTL (time to live) that the domain owner configured for their host. Might be 5 minutes, could be 48 hours, could be anything really :) Of course your router might ignore that and do its own thing.

 

On Linux/macOS you can use "dig" to get that information. For example for LTT I get this information:

dig +nocmd +multiline +noall +answer any linustechtips.com
linustechtips.com.    300 IN A 104.27.164.153
linustechtips.com.    300 IN A 104.27.165.153

The TTL is 300 seconds or 5 minutes. For google.com I see 7200 (2h).

Remember to either quote or @mention others, so they are notified of your reply

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×