Is it necessary to set: default gateway = DNS?

14,722

Solution 1

None. It's important that the nominated default gateway should be a machine on the local network which will gateway your traffic to and from the wider internet, and it's important that the nominated DNS server should be a machine which will answer your DNS queries correctly and promptly. Often these functions are consolidated into a single device, but there's no reason why it must be so.

Here's an example where it's not so:

[me@host]$ netstat -rn|grep ^0.0.0.0
0.0.0.0         10.13.0.1       0.0.0.0         UG        0 0          0 eth0

[me@host]$ grep nameserver /etc/resolv.conf
nameserver 10.13.0.13
nameserver 10.13.3.16 
nameserver 10.13.1.16

Solution 2

I can't tell how much you understand from your question but obviously there is no requirement for your gateway to also run DNS. The DNS server you use on your computers could be anywhere on the Internet, as long as you can access that server via its IP address.

The only advantage I can see is if you have a gateway router that includes a caching resolver (I know a lot of SOHO routers include a resolver as they default to issuing themselves as DNS via DHCP but I don't know if they cache answers). In this case all the local computers will benefit from the cache so if computer A goes to google.com, the router will look this record up from the Internet and cache it. Then if computer B goes to google.com, the DNS response will come direct from the router which may offer quicker responses. (If the router's any good that is, given the hardware of most cheap LAN routers I wouldn't be surprised if servers like Google are still quicker)

Edit: just to clarify, the above (possible) response time benefit is not due to the gateway/router running DNS specifically, but just from having a caching DNS server close to your client machines.

Share:
14,722

Related videos on Youtube

msh
Author by

msh

Updated on September 18, 2022

Comments

  • msh
    msh almost 2 years

    I'm working on the configuration of my test network. what are the advantages of a network configuration, by which default gateway = DNS?