-2

I have a typical home router/switch DSL modem that provides to my home network with all the common services (DHCP, DNS, web etc). The client machines have in /etc/resolv.conf as nameserver the IP of the router and everything just works.

But on the router I cannot see any DNS server running (either TCP/UDP, typically port 53) while I can see that it runs e.g. DHCP on 67 and a web administration interface on 80 and 443. I am using nmap for the port scanning.

How does my network get DNS?

1
  • 4
    Flagged to move to SuperUser.
    – Jim G.
    Jul 9, 2013 at 16:49

2 Answers 2

1

The router can provide nameservers to use through a DHCP option when you get your IP lease. Therefore, the router itself does not need to resolve DNS or forward it.

See RFC2132:

The domain name server option specifies a list of Domain Name System (STD 13, RFC 1035 [8]) name servers available to the client. Servers SHOULD be listed in order of preference.

If it is using that option to provide you with the router's IP as the nameserver, that means your router is handling DNS itself. It can do this either by using your ISP's DNS servers when it does its own DHCP on the WAN (or if you assign one statically) and forwarding the requests, or it can resolve the queries itself by querying the root servers recursively. In both latter cases, you will find a DNS server listening on port 53, both UDP and TCP.

6
  • Indeed but on the client machines /etc/resolv.conf has as nameserver the router IP and not IP of external DNS servers.
    – yannisf
    Jul 9, 2013 at 17:15
  • Then you're using nmap wrong. What happens if you try dig @<router ip> example.org ? Without the brackets, of course.
    – gparent
    Jul 9, 2013 at 17:16
  • ~$ dig at192.168.1.1 www.ntua.gr ; <<>> DiG 9.8.1-P1 <<>> at192.168.1.1 www.ntua.gr ; (1 server found) ;; global options: +cmd ;; connection timed out; no servers could be reached
    – yannisf
    Jul 9, 2013 at 17:20
  • That's not the command I gave you.
    – gparent
    Jul 9, 2013 at 17:26
  • I just typed "at" in the comment instead of "@" since @ has other semantics in stack exchange comments. The command issued on the terminal had indeed @.
    – yannisf
    Jul 9, 2013 at 17:28
0

Your router is acting as a DNS forwarder - any requests that hit the router are forwarded to the DNS servers configured in the router (could be your ISPs DNS servers or any other public DNS provider).

4
  • And potentially as a DNS cache. Jul 9, 2013 at 16:55
  • To act either as a DNS cache or a forwarder you need to run a DNS software (bind). The router does not listen to port 53.
    – yannisf
    Jul 9, 2013 at 17:03
  • Unlike real clients (servers, etc) routers don't have to listen on the port. When it gets a DNS packet, it routes it to its configured DNS servers.
    – Nathan C
    Jul 9, 2013 at 17:32
  • @NathanC Aware of any kind of router that would transparently intercept DNS but not answer it on their local IP/Port? I had him dig the router and it doesn't reply.
    – gparent
    Jul 9, 2013 at 17:36

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