The DNS (Domain Name System) protocol allows you to get an IP address for a given host name from a name server. This process is called resolving. E.g. the IP address of wiki.linuxquestions.org is 220.127.116.11.
Most Internet services rely on DNS to work, and if DNS fails, web site cannot be located and email delivery stalls.
DNS Server software
- The most widely used server software for Linux is BIND, though others like dnsmasq (found at http://www.thekelleys.org.uk/dnsmasq/doc.html ) and djbdns (found at http://cr.yp.to/djbdns.html ) are gaining in popularity due to their ease of use and higher built-in security.
- For those with dynamically allocated IP addresses, try DynDNS, a service provider of dynamic DNS.
DNS query software
How it works
As an example, if your browser wants to translate http://wiki.linuxquestions.org into an IP address, it sends a query to port 53 of a name server that is listed in /etc/resolv.conf. The server sends back the IP address and the browser can fetch the data it needs. That means that a name server has port 53 open. Here is how you can find if a server provides a name service:
$ nmap 18.104.22.168 -p 53 Starting Nmap 4.60 ( http://nmap.org ) at 2008-09-05 11:40 CEST Interesting ports on f-lb-b01.isp.t-ipnet.de (22.214.171.124): PORT STATE SERVICE 53/tcp open domain Nmap done: 1 IP address (1 host up) scanned in 11.214 seconds
Here, port 53 is open and the IP belongs to a name server. However, the server is not configured to answer to ping requests.
Configuration of named can be quite complex, and needs several configuration files:
- general configuration
- general parameters, usually called named.conf tells where to find more DNS information.
- root hints
- root zone servers, usually called named.ca but names like db.cache, named.root or root.ca are also common.
- resolver for the loopback address, usually called named.local
- zone file
- map hostnames to IP addresses, most of the DNS info is stored here. Usually given a descriptive name such as linuxquestions.org.hosts
- reverse zone file
- map IP addresses to hostnames. Usually given a descriptive name such as 192.168.1.rev
named is usually started during startup. On Red Hat/Fedora use the script:
# /etc/rd.d/init.d/named start
A tool for managing the named process for BIND 8.x is ndc, the named control. BIND 9 has a similar tool rndc.
If you are setting up a linux box to act as a router, and you have a windows box going through it that can ping the outside world but DNS is mysteriously not working, and all you see are some strange NETBIOS messages when you ping a domain name, try manually setting the DNS server entry on your windows box to point to your linux box and it may start working.