Published on: Friday 15th January 1999 By: Tarique Sani
Romeo never knew anything about Internet, otherwise he would have never said "What's in a Name!". On the net a name can literally be worth a million dollars (remember Alta Vista!) Domain Name Server, DNS in short, is the thing responsible for allowing us to use names rather than IP addresses in decimal dot notation.
The Gurus recommend (and what most consultants do) that the best way to set up a DNS is to get someone else's running DNS files and change the IP addresses and names to fit yours. If the Gurus say so, who am I to dispute? However I will try to explain in some detail the which, what and where of the DNS configuration files.
Domain Name Servers map IP addresses to host names and vice-versa. You set a particular server to be your DNS which has some mappings already done for you. When you request a particular host name, say, via your Web browser, your DNS first checks whether it has an entry for the host name you asked. If it has, it passes on the IP address; otherwise, it sends the request to its DNS. The same procedure happens for that DNS and so on, till the name is found, or it reaches the root domain name servers maintained by the InterNIC. If the name is not found, an error is cascaded down all the way to your client. If found, all the DNSs on the way update their database of mappings. Most of this is done automatically, so you don't have to worry too much.
There are two types of mappings possible: Forward and Reverse. Forward stores the host name to IP mappings and Reverse stores the opposite, that is IP to host name mappings. Linux stores all the mappings and other information in simple ASCII format in four different files. Before you set these files up, you need to create or modify a file called named.boot in the /etc directory. This file contains information required to start the DNS. The structure of the /etc/named.boot file is like this:
directory dir_name cache filename dns_type domain filename dns_type domain filename dns_type domain filename
Here the directory specifies the full path to the files that store the mappings (for example, /var/named), the cache specifies the name of the cache file that stores the list of the root DNS server on the Net. The dns_type is usually set to primary and the domain to your domain name. You need three entries, one each for the local database, a forward mapping and a reverse mapping file. A sample named.boot file would look like this:
directory /var/named cache named.ca primary 0.0.127.in-addr.arpa panamed.local primary sanisoft.com named.sanisoft.com.forward primary 1.168.192.in-addr.arpa named.sanisoft.com.reverse
Note that the IP addresses are given in reverse order, with the last octet removed. This is to mimic the way that domain naming works, which is the reverse of the way that IP works. The in-addr.arpa domain contains all the reverse mappings possible.
Now you are all set to create the files named above. Remember don't use sanisoft.com, replace it with your domain name.
The named.ca stores the names of all the root servers on the Internet. This file can be just downloaded from ftp://rs.internic.net/domain/named.root and saved here. You can even add the names of your ISP to this, right at the top. Just follow the structure already existing in the file.
The named.sanisoft.com.forward file stores the host name to IP address mappings for your domain. That is if your domain is abc.com, each line specifies hosts in this domain. Each line takes the form: name IN A IP_address. By default, all the hosts in the file are numbered from ws1 to ws254 and corresponding IP addresses in your network. For example, ws13 would map to, say, 192.168.1.13. You can then access it by ws13.abc.com. If you need to map different host names, just change the name for that particular address. You can also add other address which may not be part of your network.
The named.sanisoft.com.reverse stores just the opposite of the above. It stores the last octet of your network with the complete host name for the IP address. For the same machine in the example above, there will be an entry like 13 IN PTR ws13.abc.com. All you need to do in this file is to change the host names (that too only if you need to) for machines that have a different entry in the forward file. You do not need to add mappings for addresses outside your domain.
You must remember to restart the name server daemon after all the changes are done by using the command:
If you don't know anyone who will lend you his or her working DNS files feel free to write to me at email@example.com