CNAME, A Name, and NS Records

CNAME, Canonical Name Records

CNAME records simply allow a machine to be known by more than one hostname. There must always be an A record for the machine before aliases can be added. The host name of a machine that is stated in an A record is called the canonical, or official name of the machine. Other records should point to the canonical name. Here is an example of a CNAME:

[code]www.nicinabox.com. IN CNAME nic.nicinabox.com.[/code]

You can see the similarities to the previous record. Records always read from left to right, with the subject to be queried about on the left and the answer to the query on the right. A machine can have an unlimited number of CNAME aliases. A new record must be entered for each alias.

A, Address Records

Address, or “A” records, map the name of a machine to its numeric IP address. In clearer terms, this record states the hostname and IP address of a certain machine. To “resolve” a hostname means to find its matching IP address. This is the record that A nameserver would send another name server to answer a resolution query. The record below is an example of how an A record should look:

[code]nic.nicinabox.com. IN A 161.45.143.92[/code]

The first column contains the machine’s hostname. The second column lists what class the record is. For most basic DNS work, all you will need is the IN designation, which stands for Internet. The next column denotes the type of record the entry actually is, and the last column is the IP address itself. It is possible to map more than one IP address to a given hostname. This often happens for people who run a firewall and have two ethernet cards in one machine. All you must do is add a second A record, with every column the same save for the IP address. It is also possible to map more than one host name to one IP address. This is not recommended, however, since DNS has a special record for allowing machines to have aliases, called a canonical name, or CNAME record.

NS, Nameserver Records

NS records are imperative to functioning DNS entries. They are very simple; they merely state the authoritative name servers for the given domain. There must be at least two NS records in every DNS entry. NS records look like this:

[code]nicinabox.com. IN NS ns1.nicinabox.com.[/code]

There also must be an A record in your DNS for each machine you enter as A NAME server in your domain.