BIND Howto (3)
This howto is based on the following documentation:
- BIND [EN] @ Gentoo Wiki
Installation
Synchronize the repository and show dependencies:
emaint --auto sync
emerge --update --pretend 'net-dns/bind' 'net-dns/bind-tools'
Install the packages:
emerge --update 'net-dns/bind' 'net-dns/bind-tools'
Configuration
Edit the following files:
Validate the JSON files:
python -m 'json.tools' '/root/etc/localhost.json'
python -m 'json.tools' '/root/etc/raysoft.loc.json'
Run the script mk-named-dhcpd-conf.py to generate the files named-zones.conf, localhost.zone, 10.0.0.zone & raysoft.loc.zone:
/root/bin/mk-named-dhcpd-conf.py --overwrite '/root/etc/localhost.json'
/root/bin/mk-named-dhcpd-conf.py --append '/root/etc/raysoft.loc.json'
Move the files:
install --mode=0640 --owner='root' --group='named' --target-directory='/etc/bind' \
'named-zones.conf'
install --mode=0640 --owner='root' --group='named' --target-directory='/var/bind/pri' \
'raysoft.loc.zone' 'localhost.zone' '10.0.0.zone'
Download the root zone file:
cd '/var/bind'
dig @a.root-servers.net >'named.cache'
Validate the configuration:
named-checkconf -z '/etc/bind/named.conf'
Start the daemon:
/etc/init.d/named start
Include the daemon to the start procedure:
rc-update add 'named' 'default'
rc-update show | grep 'named'
Output:
named | default
Finally keep the GeoIP database up-to-date:
fcrontab -e
Insert:
0 2 * * 0 /usr/sbin/geoipupdate.sh --force >'/dev/null'
Test
Test the listener's availability:
netstat --numeric --program --listening --all --tcp --udp | grep ':9\?53 '
Output:
tcp 0 0 10.0.0.1:53 0.0.0.0:* LISTEN 2757/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2757/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2757/named
udp 0 0 10.0.0.1:53 0.0.0.0:* 2757/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 2757/named
Resolve the web server's hostname:
dig 'www.raysoft.loc'
Resolve the MX and NS record:
dig 'raysoft.loc' MX
dig 'raysoft.loc' NS