5

I know Windows 10 caches DNS queries and you can see it with the ipconfig /displaydns command.

My doubt is if some routers and SOHO (small office/home office) routers have a DNS server inside as well.

If this is so, then I guess that DNS server would just be another cache similar to the one in Windows, or is it a more advanced DNS server? I guess all it does is to cache name resolutions and forward all others to the upstream DNS server (typically your ISP's DNS server). So this is different to your ISP's DNS server, as this basic DNS server wouldn't include root hints to the 13 root servers etc.

I'd appreciate some clearing up.

2
  • 1
    Windows caches dns locally in-memory, specifically in the dnscache (DNS Client) service.
    – Jonathan
    Apr 10, 2022 at 7:57
  • 2
    One router I had used an internal DNS that was only 256 deep, never flushed, and stopped working when it was full. The solution was to run it from a time switch so it did a cold start every 24 hours to prevent it filling. This doesn't answer your question, but it's an amusing product facepalm.
    – Neil_UK
    Apr 10, 2022 at 19:55

6 Answers 6

17

My doubt is if some routers and SOHO routes have a DNS server inside as well.

Yes, most SOHO routers have a built-in DNS server to act as a cache. It's not a mandatory "router" feature though – enterprise networks would run their DNS on a separate system instead.

If this is so, then I guess that DNS server would just be another cache similar to the one in Windows...or is it a more advanced DNS server?

It varies between products. Talking about SOHO routers, the router's own DNS server is pretty much always just a caching proxy and actual name resolution relies on forwarding requests to an upstream resolver; no root hints involved.

But in addition to that, it is also quite common for the router to be authoritative for some "local" domain (like .lan or .home or .dlink) which contains hostnames for your LAN hosts. This integrates with the router's DHCP service, collecting hostnames that devices provide in their lease requests. It may even support static entries, though in SOHO routers it's rarely anything more than a single 'A' record per name.

It won't be running "full" DNS server software though – even though most SOHO routers are Linux-based, don't expect to find BIND or Unbound in there. At most it will run dnsmasq if you're lucky, or the vendor's custom-written DNS cache if you're not.

5
  • Strictly speaking, the officially "correct" domain for made-up local hostnames is *.home.arpa. according to RFC 8375, but a lot of people don't follow the standard.
    – Kevin
    Apr 10, 2022 at 20:12
  • @Kevin Never heard of that used personally. The only names I've seen are *.lan, *.hole (for PiHole) and *.station (for Vodafone routers aka "Vodafone Station"). I believe the PiHole allows you to define your custom TLD for your local LAN, so I guess nobody cares of that RFC...
    – GACy20
    Apr 11, 2022 at 7:21
  • @Kevin: Well, yes, but given that it only goes back to 2018 and some existing uses of "unofficial" domains predate it by nearly two decades, a lot of people aren't going to switch in an instant.
    – user1686
    Apr 11, 2022 at 8:23
  • 1
    I would like to append the fact that dnsmasq is a DNS forwarder/cache. Other than that, great answer.
    – Munchkin
    Apr 11, 2022 at 13:03
  • @GACy20: If IANA decides to make any of those into new gTLDs, then your router will silently shadow them and break the web. That's why they set aside the funny-looking .arpa thing.
    – Kevin
    Apr 11, 2022 at 16:40
6

Some do,some don't.

Routing and DNS lookup are two completely separate operations, so they could be done as two services on the same box, or two services on two different boxes.

(The same applies to most networking functions - firewall for example, or user authentication/access services that track what a user is allowed to reach.)

An integrated local DNS service is useful for things like local device networking and lookup although some types of device don't need that function it doesn't hurt to include it. At worst it can act as a cache.

On smaller and domestic routers, its usual for a router to include some basic other services, because home users don't usually wants to buy 3 boxes where one will do.

But if you plan to buy separates as an enterprise, then that's probably not what you want. You separate them for security, reliability and responsiveness (you may have multiple of each service with failover/round robin, including remotely), network design, and ease of maintenance/operation.

3

The answer is: it depends!

the reason for this is, as some routers just forward the request to another server. some have a dnsmasq or bind installed and resolved and cache on its own. It can also be any other standard software installed on the devices that respond and cache or just only respond to the requests.

it cant be answered generally because the vendor and device are not told. It can also happen that the Same vendor uses different services for its own products

2

Most home routers also are real DNS servers. (Although very fundamental ones: they typically best guide forwarding the queries "upstream" to the ISP's servers, and generally provide a few amount of nearby caching. But that still counts as a "DNS server".)

As many domestic routers are Linux-based, a number of them absolutely run not unusual DNS relay software such as Unbound or Dnsmasq, despite the fact that others have custom-made implementations of varying fine.

So whilst the laptop sends the DNS question in your router, the router's inner DNS server first assessments if it can be responded from local cache, and if not, forwards it to your ISP's greater-succesful DNS servers.

(Your pc doesn't actually need to be speaking to the ISP's DNS servers at once, or in any respect. The DNS responses do now not normally contain any ISP-specific records.)

1

In a typical home setup your computer does not even know your ISP’s DNS server. The router gets the ISP’s DNS server address probably by some protocol after establishing a connection or perhaps by some configuration together with other ISP details (or you can configure it to use an entirely different DNS server). The router has its own DNS that forwards requests to the ISP’s server (or whatever you configured). When your computer connects to the router, the router will tell the computer via DHCP which DNS server to use, and that will be the router’s internal DNS server. Again, you can configure your computer to ignore this and use a different DNS server of your choice.

What the router will not do is to intercept a DNS request directed at another DNS server and give you a cached response.

2
  • 1
    "What the router will not do is to intercept a DNS request directed at another DNS server and give you a cached response." Unless it's configured to do so. Sadly that sort of thing is not even as unusual as it should be. See for example en.wikipedia.org/wiki/Captive_portal#Redirect_by_DNS
    – Ben Voigt
    Apr 11, 2022 at 18:26
  • @BenVoigt, of course, if it’s a hostile router :) Good point, I just wanted to explain the most common setup (and could have done a better job of it). The last sentence was because I felt that the OP’s “and forward any other it doesn't know to the dns server set up for your OS” showed some possible confusion regarding this. I will readily admit that I am not particularly knowledgable regarding networking.
    – Carsten S
    Apr 11, 2022 at 18:57
1

The thing to understand here is that DNS resolution involves a distributed network of caches.

As others have said, routers targeted at the home or small office typically have a DNS server built in. Most such routers run the Linux operating system, and most of those use dnsmasq to provide DNS service.

These typically operate in forwarding mode, though there may be an option to operate in recursive mode.

In either case, the servers maintain a local cache. If a query is cached, and the entry is valid, they return the cached value.

They differ in how they act when they don't have a valid cached entry. In that case, both forwarding and recursive mode servers consult another DNS server looking for the answer, but each uses a different strategy.

A forwarding DNS server will query one of the DNS servers it's been configured to use. The result of that query will be returned to the client and cached.

A recursive DNS server will instead do a series of queries. It will first consult one of the root servers. These servers can't resolve the fully qualified domain name, but they can direct the recursive server to servers that is in a better position to. So, the recursive server ask the root servers for a list of servers that can answer responses for the relevant top-level domain (ie .com, .org, .uk...). Once it has an answer, it queries one of them to find the nameservers that can answer questions about the domain (ie superuser). It then makes a request of google's nameservers to get the IP address of the hostname (ie www, or the root of the domain).

This chain of queries isn't necessarily triggered by each DNS reqeuest because the results of each query, at every level, are cached. Queries for the .com nameservers, for example, are cached for a day.

The point being, DNS is caches all the way down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.