Installation
gentoo ~ # emerge net-dns/bind
Configuration
My network has two DNS servers: the primary on jakob and a secondary on zaphod. The configuration of BIND is stored in /etc/bind/named.conf, so let’s edit it. This is a verbatim copy of my configuration on jakob, edit according to your network:
gentoo ~ # nano -w /etc/bind/named.conf
options { directory "/var/bind"; auth-nxdomain yes; # forward first; # forwarders { # 196.7.147.235; # 196.7.150.34; # 196.2.53.140; # 196.2.49.227; # 196.25.1.11; # 196.43.1.11; # }; listen-on-v6 { none; }; listen-on { 127.0.0.1; 192.168.0.7; }; pid-file "/var/run/named/named.pid"; }; // VeriSign fix-up zone "COM" { type delegation-only; }; zone "NET" { type delegation-only; }; zone "." IN { type hint; file "named.cache"; }; zone "localhost" IN { type master; file "pri/localhost.zone"; allow-update { none; }; notify no; }; zone "127.in-addr.arpa" IN { type master; file "pri/127.zone"; allow-update { none; }; notify no; }; zone "0.168.192.in-addr.arpa" IN { type master; file "pri/192.168.0.zone"; allow-update { 127.0.0.1; }; also-notify { 192.168.0.1; }; notify yes; }; zone "groenheide.org.za" { type master; file "pri/groenheide.org.za.zone"; allow-update { 127.0.0.1; }; also-notify { 192.168.0.1; }; notify yes; };
For my infrastructure I need to create two files. First the IP address to name lookup file:
gentoo ~ # nano -w /etc/bind/pri/192.168.0.zone
$ORIGIN 0.168.192.in-addr.arpa. $TTL 1D @ IN SOA sella.groenheide.org.za. admin.groenheide.org.za. ( 2009071200 3H 15M 1W 1D ) @ IN NS sella.groenheide.org.za. @ IN NS zaphod.groenheide.org.za. 1 IN PTR zaphod.groenheide.org.za. 2 IN PTR shiraz.groenheide.org.za. 4 IN PTR ford.groenheide.org.za. 5 IN PTR sella.groenheide.org.za. 6 IN PTR buks.groenheide.org.za. 7 IN PTR jakob.groenheide.org.za. 8 IN PTR spons.groenheide.org.za. 11 IN PTR toffie.groenheide.org.za. 12 IN PTR imke.groenheide.org.za.
And secondly the name to IP address lookup file:
gentoo ~ # nano -w /etc/bind/pri/groenheide.org.za.zone
$ORIGIN groenheide.org.za. $TTL 1D groenheide.org.za. IN SOA sella.groenheide.org.za. admin.groenheide.org.za. ( 2009071200 3H 15M 1W 1D ) @ IN NS sella.groenheide.org.za. @ IN NS zaphod.groenheide.org.za. @ IN MX 10 sella.groenheide.org.za. buks IN A 192.168.0.6 ford IN A 192.168.0.4 imke IN A 192.168.0.12 jakob IN A 192.168.0.7 localhost IN A 127.0.0.1 sella IN A 192.168.0.5 shiraz IN A 192.168.0.2 spons IN A 192.168.0.8 toffie IN A 192.168.0.11 zaphod IN A 192.168.0.1 coppermine IN CNAME sella ipaws IN CNAME sella joomla IN CNAME sella soutca IN CNAME sella
The configuration for the slave DNS server on zaphod:
gentoo ~ # nano -w /etc/bind/named.conf
options { directory "/var/bind"; auth-nxdomain no; forward first; forwarders { 192.168.0.7; }; listen-on-v6 { none; }; listen-on { 127.0.0.1; 192.168.0.1; }; pid-file "/var/run/named/named.pid"; }; // VeriSign fix-up zone "COM" { type delegation-only; }; zone "NET" { type delegation-only; }; zone "." IN { type hint; file "named.cache"; }; zone "localhost" IN { type master; file "pri/localhost.zone"; allow-update { none; }; notify no; }; zone "127.in-addr.arpa" IN { type master; file "pri/127.zone"; allow-update { none; }; notify no; }; zone "0.168.192.in-addr.arpa" IN { type slave; masters { 192.168.0.7; }; file "pri/192.168.0.zone"; }; zone "groenheide.org.za" { type slave; masters { 192.168.0.7; }; file "pri/groenheide.org.za.zone"; };
Start BIND and check /var/log/messages for any errors. If everything seems OK, add BIND to the default runlevel.
gentoo ~ # /etc/init.d/named start
gentoo ~ # rc-update add named default
