2

These are the steps for converting a router to dhcp:enter image description here
Why used the router IP as the DNS server IP address in the last case?
Should not use the IP address of servers like Google (8.8.8.8)?

3 Answers 3

5

Your router uses DHCP to get its WAN IP address from the ISP. Along with the IP, it also receives IPs of DNS servers recommended by the ISP.

The router also is running its own DNS server that's forwarding all requests to the DNS server provided by the ISP. This way you can simply specify router's IP as your DNS server and have your requests forwarded to whatever the ISP recommends.

The router will also use its IP when suggesting DNS over DHCP to devices in the LAN. Why advertise itself as the DNS server rather than send ISP's DNS address directly? Because the DNS IP can change when the WAN DHCP lease is renewed or manually by an administrator. This way the change is effective immediately when the router learns about it.

3
  • Thank you very much for your answer and for your time
    – Truth
    Apr 20, 2021 at 14:50
  • How can I know that my router has DNS functionality since it's nowhere in settings?
    – Qwerty
    Nov 19, 2023 at 0:19
  • @Qwerty It does. But if you want to verify it, check the address of DNS server that devices connected to that router use. Unless you've manually configured a device to use a different DNS server, it will use the IP of your router which is where the DNS server is running. Devices learn that address when acquiring their own IP address from the router using DHCP.
    – gronostaj
    Nov 19, 2023 at 11:04
5

Many routers used for home usage do a number of other things except purely routing packets. Besides running a DHCP server (which you have already discovered now) they often also run a DNS server.

This DNS server will cache answers from its DNS server according to the lifetime specified.

To do that, they will need an upstream DNS server to which they relay requests, which is normally the DNS server operated by your ISP. Alternatively you could manually configure to use a public recursive DNS server, like the Google DNS server you mentioned. In both cases, the actual upstream DNS used is transparent from all clients that get their configuration from the DHCP server.

1
  • 1
    Thank you very much for your answer and for your time
    – Truth
    Apr 20, 2021 at 14:50
1

Your PC needs to resolve the website name into an IP address. Some of these addresses are defined directly on your local machine, on windows this is done in the "hosts" file. You can do some research for that if you want, it is quite interesting.

When the hostname cannot be resolved by looking into this file, the computer needs to ask someone else about it. The next one to ask is usually your home router. If the router knows the correct IP for some reason (more on that in a moment), it directly delivers it to your computer.

But if it doesn't, it has to ask someone else itself. Normally this is the DNS server of your provider, but you can of cause change that. And I want to say that you probably should change that as many ISPs sell the data they collect about which websites you browse.

Now if for some reason your ISP doesn't know the address either, it will ask the DNS server on the next level and so on.

Now back to why it is useful to have your home router be the primary DNS server:

First, it caches the IP addresses it had resolved by higher level DNS servers. The next occasion (within a specified time) a device on the network asks the router to resolve a hostname, it just returns the IP address it cached earlier which saves time.

Second, there may be hostnames in your local network, e.g. your NAS or your TV which you could want to address, and your ISP or any other DNS resolver won't know these, but your router does. So it is only possible to use the hostname within your local network, when you set your router to resolve them.

I hope this made it clear, feel free to ask if there are any questions left.

6
  • "So it is only possible to use the hostname within your local network, when you set your router to resolve them." That's not necessarily always true, a popular way to achieve resolution of local hostnames is by using multicast DNS (mDNS). By using multicast you can do service discovery and name resolution without a central entity.
    – jvda
    Apr 20, 2021 at 13:04
  • Thank you very much for your answer and for your time
    – Truth
    Apr 20, 2021 at 14:49
  • @jvda ok, yes, there is another way, I didn't think about this. But in my experience, this is rarely used as it generates higher amount of traffic over the network than using a "real" DNS server Apr 20, 2021 at 16:56
  • @Truth you're welcome. I recently needed to do some research on this topic as some German ISPs start filtering DNS requests on their own without legal background, and so I thought why not share my results. There is a very well done video about this on a German YouTube channel, SemperVideo, if you understand a little German, then you definitely understand the video, and the illustration is very helpful. youtube.com/watch?v=qemoXVd7Ihw Apr 20, 2021 at 17:01
  • @DarkDiamond Yes, you're correct, that's definitely a point to keep in mind. What you gain in terms of ease of use and zero-configuration you will have to make up with additional network traffic.
    – jvda
    Apr 21, 2021 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .