Setting up Dynamic DNS with bind9 and dhcp3-server
1. Modify /etc/bind/named.conf.local, adding forward / reverse zones for local domain
- include "/etc/bind/rndc.key";
- controls {
- inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
- };
- zone "wwwolf.kmip.net" {
- type master;
- file "db.wwwolf.kmip.net";
- allow-update { key "rndc-key"; };
- };
- zone "1.168.192.in-addr.arpa" {
- type master;
- file "db.1.168.192";
- allow-update { key "rndc-key"; };
- };
2. Look at /etc/bind/named.conf.options find
- options {
- directory "/var/cache/bind";
so the db.* files will be located under /var/cache/bind
3. db.wwwolf.kmip.net
- $TTL 604800
- @ IN SOA wwwolf.kmip.net. root.wwwolf.kmip.net. (
- 1 ; Serial
- 604800 ; Refresh
- 86400 ; Retry
- 2419200 ; Expire
- 604800 ) ; Negative Cache TTL
- ;
- @ IN NS dhcp3srv
- @ IN A 192.168.1.2
- dhcp3srv IN A 192.168.1.3
- trac IN A 192.168.1.4
4. db.1.168.192. ($ORIGIN is significant)
- $ORIGIN 1.168.192.in-addr.arpa.
- $TTL 604800
- @ IN SOA wwwolf.kmip.net. root.wwwolf.kmip.net. (
- 2 ; Serial
- 604800 ; Refresh
- 86400 ; Retry
- 2419200 ; Expire
- 604800 ) ; Negative Cache TTL
- IN NS dhcp3srv.wwwolf.kmip.net.
- 3 IN PTR dhcp3srv.wwwolf.kmip.net.
- 4 IN PTR trac.wwwolf.kmip.net.
5. dhcpd.conf (ddns-domainname / ddns-rev-dommainnam is significant)
Make sure following lines appears:
- ddns-update-style interim;
- ddns-domainname "wwwolf.kmip.net";
- ddns-rev-domainname "1.168.192.in-addr.arpa";
- ignore client-updates;
- include "/etc/bind/rndc.key";
rndc-key file is shared by dhcp3-server and bind9
FAQ
1. ddns update / anything failed:
stop all servers, start with debug flags:
dhcpd3 -d
named -g
2. named (bind9) log yields "db.xxx.xxx.jnl: create: permission denied"
Check directory permission
Check /etc/apparmor.d/usr.sbin.named, make sure specified directory has "rw" priv
i.e.
- /etc/bind/** r,
- /var/lib/bind/** rw,
so if db.* files are under /etc/bind, named will fail; if db.* files are under /var/lib/bind things will work fine.
Or people may choose to disable apparmor at all.
3. Dhcpd may yield "Permission denied" reading /etc/bind/rndc.key
On my new Ubuntu 8.04 server LTS system the rndc.key file has a rw-r----- by default. Change it with a+r to let dhcpd user read it.