Domain Name Server Configuration
Mail config is present in the following files:
- /etc/named.conf "Root" configuration file
- /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:
- The root ("hint") zone. This is used to resolve names outside of the LTNB:
zone "." {
type hint; // used to be specified w/ "cache"
file "cache.db";
};
|
- A primary zone:
zone "ltnb.lu" IN {
type master; // what used to be called "primary"
file "ltnb.lu.zone";
};
|
The name after zone (here, ltnb.lu says which domain is
described by this zone). The parameters within braces have the
following meaning:
type master
| Says this is a primary domain, rather than a secondary
|
file "ltnb.lu.zone";
| Says that the zone is described in file
ltnb.lu.zone. Zone files are stored in directory
/var/named.ltnb.lu.zone. This zone description file
contains the name to IP mappings for all entities in the domain.
|
If two zones are very similar, they can be described by a same zone
file. In that case, care must be taken that the domain name is never
mentioned in that file. This is how most of our org.lu Web domains are
set up.
- A secondary zone:
zone "ill.lu" IN {
type slave;
file "slave/ill.lu.zone";
masters {
212.56.224.1;
};
};
|
This means that the nameserver acts as a backup nameserver for another
zone. It fetches zone data from the other server, and caches it in a
local file. If the primary server goes down, it can answer to request
on its behalf.
type slave
| Says this is a secondary domain, rather than a primary
|
file "slave/ill.lu.zone";
| Says that the zone data is cached in file
/var/named/slave/ill.lu.zone.
|
masters {
212.56.224.1;
};
| IP address of primary domain server for zone
|
- A primary reverse zone:
zone "28.64.158.in-addr.arpa" {
type master;
file "158.64.28.zone";
};
|
This zone is used for reverse lookups, i.e. for mapping IP addresses
back to host names. The zone name specified is the IP address prefix
read backwars followed by .in-addr.arpa. In this example, the
described prefix is 58.64.28. Parameters between braces are
the same as for any other primary zone.
/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:
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):
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:
- There is a subzone, named 0.28.64.158.in-addr.arpa handled by a
different nameserver (here, ns.lll.lu)
- The IP address 158.64.28.4 (represented by
4.28.64.158.in-addr.arpa, in short, 4) is a CNAME for 4.0 (in full:
4.0.28.64.158.in-addr.arpa), which is handled by the nameserver
responsible for zone 0.28.64.158.in-addr.arpa (in this case,
ns.lll.lu)