Now, DNS data is represented as DNS records in a zone data file, and these files
are handled by the name server. There are a number of different kinds of
DNS records, each suited to a specific kind of data.
Let's take a look at the structure of the most important files. The records below are in
the standard format used by BIND, the most common name server software.
Djbdns, an alternative package, uses a somewhat different format.
SOA (Start Of Authority) records indicate the extent of the zone for
which the name server is authoritative. They also contain information
about how frequently they should be checked for updated information. An
SOA record might look like this:
mydomain.com. IN SOA ns1.mydomain.com. root.mail.mydomain.com. (
2002012901
24h
2h
4w
4d )
The first line indicates first the zone, then the type of record
Internet SOA then the primary name server for the zone, and then a
contact address for the zone. Note that the email address uses a period (dot) in
place of the @, and that all of these domain names must end with a dot.
On the next line is the serial number, which can be anything as long as
it increased each time the record is updated. If you don't update the
serial number when you make a change to the record, the change won't go
through. The serial number I use above consists of the year, the month,
the day, and the number of changes (01) made so far today. Next comes
the frequency with which the data should be checked by a secondary name
server, how often a failed attempt to connect should be retried, how
soon the data should expire if it hasn't been refreshed, and the default
time-to-live of the data. In the record above, these are set to 24
hours, 2 hours, 4 weeks, and 4 days respectively.
NS (name Server) records provide a list of name servers authoritative for
the zone:
mydomain.com. IN NS ns1.mydomain.com.
mydomain.com. IN NS ns2.mydomain.com.
The real data, the reason we have name servers in the first place, is
largely contained in A (Address) records. This is where the
name-to-number mappings are kept:
mydomain.com. IN A 192.168.40.31
mail.mydomain.com. IN A 192.168.40.32
ns1.mydomain.com. IN A 192.168.40.33
ns2.mydomain.com. IN A 192.168.40.34
cheesebox.mydomain.com. IN A 192.168.148.44
lester.mydomain.com. IN A 192.168.148.45
CNAME (Canonical name) records allow aliases. A machine has one true, or
canonical name, as well as an unlimited number of aliases:
www.mydomain.com. IN CNAME mydomain.com.
wwww.mydomain.com. IN CNAME mydomain.com.
ww.mydomain.com. IN CNAME mydomain.com.
cb.mydomain.com. IN CNAME cheesebox.mydomain.com.
Note that, thanks to the above aliases, whether a browser tries to go to
http://mydomain.com, http://www.mydomain.com, http://ww.mydomain.com, or
http://wwww.mydomain.com, it will wind up at the same place.
The cardinal rule of CNAMEs is to use only a machine's canonical name,
never its alias, in any other record. So in our hypothetical network,
"cb.mydomain.com" should never appear in, say, an A record, because it's
just an alias for the machine whose canonical name is cheesebox.
next page»