Domain Name Server Configuration

Mail config is present in the following files:
  1. /etc/named.conf "Root" configuration file
  2. /var/named/named.zone Zone description
Further documentation is available in the directory /usr/share/doc/packages/bind9/ on ltnb10.

/etc/named.conf

The named.conf file says which files describe which domains. The file starts with a pre-amble describing some generic characteristics of the name server (options), which normally does not need to be changed.

Then follow the zone descriptions. There are several kinds of zones:

/var/named/named.zone

Explanations. The header is a so-called SOA ("start of authority") record.

Example:
ltnb.lu.        1D IN   SOA     ns.ltnb.lu. hostmaster.ltnb.lu. (
                        2001022401      ; serial: date + 2 digits
                        8H              ; refresh
                        2H              ; retry
                        1W              ; expire
                        1D )            ; minimum
        1D IN   NS      ns.ltnb.lu.
        1D IN   NS      ns.restena.lu.  ; nameserver
        1D IN   A       158.64.28.254
 
        1D IN   MX      10 mailhost     ; primary mail host
        1D IN   MX      20 mailbackup.ltnb.org.lu. ; backup mail host
It defines the following items:
ltnb.lu. the name of the zone. You may also put @ here, which means "the domain name, as specified in /etc/named.conf". Using an @ rather than the explicit domain name allows to write domain independant zone files, which can be used for several different domains.
1D Time-to-live (1 Day). That's basically the duration of validity of the SOA record: if a cached copy is older than one day, it must be refreshed from the origin server (here NS).
hostmaster.ltnb.lu. This is the e-mail of the DNS admninistrator for this zone. The @ is changed to a dot (.) to conform to DNS syntax. This also means that the e-mail address itself should not contain a dot in its username part, or else it would be ambiguous. The trailing dot means that named should not implicitly append the domain (ltnb.lu)
2001021402 Serial number, used by secondary name servers and caches to detect whether the domain has changed. Conventionnally, this is the date followed by two increasing digits. Update this number whenever you update the DNS. This example refers to the second update (02) on February 14th 2001.
  2001021402 ; serial: date + 2 digits
  8H	     ; refresh
  2H	     ; retry
  1W	     ; expire
  1D )	     ; minimum
The various expire times for this zone. Items after semicolon (;) are comments
1D IN NS ns.ltnb.lu.
1D IN NS ns.restena.lu.
Nameservers responsible for this zone (should included this server)
1D IN A 158.64.28.254 IP Address for ltnb.lu
1D IN MX 10 mailhost
1D IN MX 20 backup-mailhost
Hosts which handle mail sent to this domain. 10 and 20 are the priority. Lowest priority is tried first. Which means that if mailhost is down, backup-mailhost will be tried.
After this header (describing the attributes of the domain itself) follow the descriptions of the (other) hosts in this domain: Example:
pollux  1D IN   A       158.64.28.254
        1D IN   MX      10 mailhost     ; primary mail host
        1D IN   MX      20 mailbackup-ltnb.org.lu. ; backup mail host
This defines an A record (IP address) for pollux (namely 158.64.28.254), and two MX records (mail distributors): mailhost and mailbackup-ltnb.org.lu

It is also possible to define a name as an alias (CNAME) for another one; in that case, it inherits all records of its synonym: Example:
ltnb10  1D IN   CNAME   ns
Here ltnb10 is defined to be a synonym of ns. Because a CNAME inherits all attributes of its master, it does not make sense to combine it with other attributes. For example, the following definition would be erroneous:
ltnb10  1D IN   CNAME   ns
	1D IN   MX 10 mailhost.ltnb.lu
A CNAME can also point to the domain itself, in that case, you can use @ to denote the empty string (equivalent to domain):
www  1D IN   CNAME   @
In a reverse zone, we find PTR records. Those are used to map back from ip addresses to hosts:
254     1D IN   PTR             pollux.ltnb.lu.
In a reverse zone, some IP addresses may actually be CNAME's pointing to another "fictive" IP address. This is done when a same IP address block is shared by two institutions:
0      1D IN   NS              ns.lll.lu
4      1D IN   CNAME           4.0
This says that: