You're actually supposed to add one or two DNS servers to /etc/resolv.conf
(unless you're running your own DNS with bind
). Your ISP should provide you two DNS addresses, those would be the entries in /etc/resolv.conf
; you can also use public DNS addresses, e.g., Google provides free DNS at 22.214.171.124 and 126.96.36.199. Those are US addresses, you need to find reliable external DNS server addresses that are electrically close to you, check with ping
and pick servers with the shortest times. For example
ping -c 5 188.8.131.52
PING 184.108.40.206 (220.127.116.11) 56(84) bytes of data.
64 bytes from 18.104.22.168: icmp_seq=1 ttl=55 time=612 ms
64 bytes from 22.214.171.124: icmp_seq=2 ttl=55 time=899 ms
64 bytes from 126.96.36.199: icmp_seq=3 ttl=55 time=1245 ms
64 bytes from 188.8.131.52: icmp_seq=4 ttl=55 time=1023 ms
64 bytes from 184.108.40.206: icmp_seq=5 ttl=55 time=563 ms
--- 220.127.116.11 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 563.975/869.042/1245.838/255.288 ms, pipe 2
would look like this
That's all you need; note that you do not want more than two DNS server addresses -- if the first one is not available it will fall over to the next and that is delayed buy multiple tries at the first listed address. You want reliable external addresses.
If, however, you're only using a LAN, with no outside access, you can enter those addresses in /etc/hosts
and never bother with DNS at all. The implication is that /etc/hosts
is for fixed IP addresses of the form
# for loopbacking
# local servers
192.168.1.10 foo.lan foo
192.168.1.20 bar.lan bar
That allows direct connections (with, say, SSH) as well as web access to a system configured with HTTP.
On my systems, configured with fixed IP addresses, /etc/hosts
is used for both computers and devices (Ethernet printer and plotter) and external servers such as maps.google.com
and a few others -- TCP/IP looks at /etc/hosts
first, then at /etc/resolv.conf
and having the addresses in /etc/hosts
completely avoids a DNS look up. You may want to look into that for a small number of external servers; keep in mind that you have to edit these things and DNS can turn out to be the better bet.
You can choose to use DHCP rather than fixed IP, but you will need to identify your DHCP servers so that they are "findable" on your LAN (you give them a name and address in the configuration file). Personally, I think that on a small (up to about 20 devices) that fixed IP is easier and works just fine but more than 20 or so would be better with DHCP. It's a balancing act.
You can mix fixed IP and DHCP. DHCP usually starts leasing addresses at 100 (like 192.168.1.100), fixed IP between 2 and 99 works just fine too (don't use 192.168.1.1, that's the loopbback address and things won't work if you do that).
You can, as hinted, run BIND. However, be aware that will be a lot of traffic (you're running your own DNS server). Could be useful if you have questionable network service, might not be worth much if you do have unreliable network service -- if you can't get out, nobody can get in either irrespective of DNS addresses.
Hope this helps some.