Installation of a DNS server (bind) to allow to perform: recursive hostname resolution for a subset of clients, DNS zone management (ie: master) and zone replication for other server (ie: slave).
- Reference: Bind manual
- RFC: 974, 1912
- Follow-up: SSHFP
Build information
Ensure the following options:
If a firewall is used, port 53 for UDP
and TCP
must be
opened to avoid issues.
Configuration
ACL
ACLs (Access Control List) are defined with the acl
directive to limit or deny access to some resources. For this example,
two distinct ACLs are used, one named can_xfr
to list clients
authorized to perform zone transfert, the other can_recurse
to list
clients allowed to ask for recursive name resolution.
Control
The named
process can be controled with the
rndc
command:
-
restrictions are put in place to allow access only from local host:
-
authorization is done by knowing a shared secret:
Creating the shared secret can be done for the
rndc.key
file with therndc-confgen
command:Creating shared secret (overwrite `rndc.key` file) 1
rndc-confgen -a
Logs
Log files are a way to keep a trace and monitor DNS server activity, and particularly to detect potential problems. The following configuration allows to record events either directly or through the syslog daemon.
Events corresponding to the configuration, the databases, or the
notifications are transferred to syslog. If diagnostic or monitoring
is needed, you can uncommment //1//
to record all name resolution
requests.
Options
In this section are configured:
- the path of files needed to run the DNS server or to setup some of the options;
- the interfaces on which the server is listening: all interfaces (keyword any) in both IPv4 and IPv6 will be used.
- the authorization for recursive name resolution: the localhost for both IPv4 and IPv6 and the list of hosts specified in the ACL can_recurse.
By uncommenting //3//
, it is possible to benefit from the existence of
another name server, the one provided by the ISP for example, to
resolve the requests in a first attempt (for which we do not have the
zone), if this resolution fails, a fallback solution is applied and
the resolution is directly performed by our server. By uncommenting
//4//
, the fallback solution is disabled.
Zones
In different records, if the names are not fully qualified, that is to
say, do not refer to the root (ie: name not terminated by a “.”), then
the origin $ORIGIN
(by default the DNS current zone) will be
automatically added.
Hint
So to start the delegation process and resolve name, it is necessary
to know the server able to give information about the first zones:
com
, net
, org
, fr
, eu
, … The named.root
file
holds the list of the initial servers and is part of the bind
distribution.
Master
It defines a DNS zone. The zone description is detailled in the
master/example.com
file. The list of hosts authorised to perform a
zone transfer (to allow the setting of a slave or secondary zone) is
indicated by ACLs and the allow-transfer directive.
Slave
The slave type zone allows replication of a master zone. You can then
use several servers (through the NS
records) to publish the zone, make
this zone more reliable in case of a server loss or unavailability.
Information to give is: the filename where the zone will be saved, the address of the server holding the master zone and at last, optionally, the address of the server authorised to notify us of possible modifications.