How do I setup Dynamic DNS (DDNS) in CentOS Linux 4 or 5 server operating systems?
Dynamic DNS (DDNS) is nothing but a simple method that provides the capability for a PC or router using the Internet Protocol Suite, to notify a domain name server to change and set hostname (and other information), in real time. For example, our Internet gateway assigns dhcp IP address to over 300 pcs and our DNS servers are updated to track all those hostname through DNS queries such as pc122.floor2.example.com. In other words, DDNS allows a client to updates its hostname in our DNS via DHCP. However, you need to configure both DHCP and BIND 9 DNS server to all the client to update its DNS A record.
Step # 1: Update DHCP Configuration
Edit /etc/dhcpd.conf, enter:
# vi /etc/dhcpd.conf
Make sure clients are allowed to update DNS hostname records, enter:
allow client-updates;
Use BIND 9 rndc.key file, enter:
include "/etc/rndc.key";
Allow dnsknowledge.com to use this key:
zone dnsknowledge.com. {
# Set the IP address of the name server whose zone information is to be updated
# 192.168.1.1 == is your primary master bind 9 server
primary 192.168.1.1;
# and the key to use
key rndckey;
}
# update the reverse lookup zone
zone 1.168.192.in-addr.arpa. {
primary 192.168.1.1;
key rndckey;
}
Save and close the file.
Step #2: BIND 9 DNS Server Configuration
Next, you need to edit Bind 9 configuration file and allow DDNS for given zone, enter:
# vi /var/named/chroot/etc/named.conf
Make sure dnsknowledge.com is allowed to update by clients:
zone "dnsknowledge.com" IN {
type master;
file "dnsknowledge.com.zone";
allow-update { key rndckey; };
};
# reverse zone
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.in-addr.arpa.zone";
allow-update { key rndckey; };
};
Save and close the file. Finally, make sure the following files exists with correct permissions:
# touch /var/named/chroot/var/named/dnsknowledge.com.zone.jnl
# chown named:named /var/named/chroot/var/named/dnsknowledge.com.zone.jnl
Save and close the file. Finally, restart the both DHCP and BIND 9 services:
# service named restart
# service dhcpd restart