1

For a local host connected to a router, when the local host tries to access an external website, is there an internal DNS in the router that parses the url or it will redirect to an external DNS?

4 Answers 4

1

"It depends."

More precisely, it depends on whether there's a DNS server of some type running in the router. Some big routers have a full DNS server; others have a simple caching server; still others have no DNS server at all. Check your router's manual to see which kind it has, if any.

If the router has no server, then all DNS requests will be forwarded to an outside DNS server for resolution (usually configured by your ISP).

If your router does have a DNS server, it will try to resolve the hostname. If it doesn't know the answer, it will recursively forward the request upstream to more authoritative DNS servers until it gets a definitive answer.

0

As you know, when a computer needs to resolve a host to an IP address, it needs to contact a DNS server to query the hostname (unless it somehow already knows its IP address, ie: an entry in its hosts file). This process happens very quickly, although there can be many steps depending on how your network or network is configured.

By default, when you power on your router, it will ask your ISP for an IP address likely using the DHCP Protocol. When your ISP's DHCP server responds, it not only sends the IP address it has assigned to your router, but a list of DNS servers that are hosted on their network. Now, your router can resolve hostnames to IP addresses by querying those DNS servers, but what about computers on your LAN that sit behind the router?

When you fire up your computer, likely using the DHCP Protocol again, it will ask for an IP address. Your router will respond with an IP address, but instead of sending your ISP's DNS servers, it will send itself (the IP address on its LAN interface) as the DNS server it would like your computer to use.

Now, when you enter http://google.com into your browser, your computer needs to resolve the hostname google.com into an IP address so that it can make a request to the remote server(s). To do this, first it checks to see if it has resolved google.com recently and if it is still cached on the local machine somewhere, as recalling the IP from RAM or local storage will more than likely be faster than asking a DNS server. If it isn't cached locally anymore, it asks your router's DNS server.

The same procedure is carried out by your router: If it has resolved google.com recently, it responds to your computer with what it has cached. If hasn't resolved google.com recently, it queryies your ISP's DNS servers, which are external servers.

To directly answer your question: Yes, when attempting to browse to a website by its hostname, unless your computer already knows its IP address by some other means, some (or many) external DNS servers will be queried in order to resolve that hostname to an IP address.


Note: The above is a very simplified outline, and should be treated as such. The process can be different depending on how the network and the computer attempting to resolve the hostname are setup. For further information on DNS and how the protocol works, you can start with checking out the Wikipedia entry on DNS and/or doing further research.

0

The DNS system is designed to be distributed. Every level can have a "Start of Authority" which says "I define what happens at this level". DNS tricks can include load balancing, failover, geobalancing, and a bunch of other fun things. As such, your router is definitely NOT qualified to know everything on the Internet.

As such, it forwards your queries to other servers, as defined in the DNS protocol. Your router may get the DNS servers to forward to from a config protocol such as DHCP, or you can set it/them manually.

Your router may have a DNS cache, so, say, you don't do a search for facebook.com on every webpage, but this is just a cache. It still needs to hit the real dns servers for facebook to populate these cache entries.

0

DNS is a massive list of servers and their corresponding IP addresses, that is constantly updated. To my knowledge, no router contains such a service as it would require a lot of processing and some memory. Your router simply uses the DNS server's it is set to ask.

3
  • 1
    edit: DNS is not just for webservers.... Oct 22, 2013 at 1:22
  • @RichHomolka What else could DNS be used for?
    – ethanjyx
    Nov 2, 2013 at 4:30
  • @ethanjyx DNS is just to match up hostnames to IP addresses. Any IP addressed machine that you want to get by hostname, by whatever protocol, including (but not limited to) http, ftp, telnet, ssh, sftp, sip, ping, traceroute, etc) you would use DNS to get to. Nov 4, 2013 at 17:40

You must log in to answer this question.

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