≡ Menu

CentOS Linux Setup Dynamic DNS (DDNS)

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

{ 6 comments… add one }
  • cedail et appronfondi August 4, 2011, 10:28 am

    salut a tous
    s il vous plait j aurai bessoin d une documentation detailler et appronfondi sur la configuration d un DNS et DHCP sur centos afin qu il puisse administrer les machines clients sous win xp.

  • Chhorvorn November 12, 2011, 7:00 am

    Dear sir/madam:

    As I did with your document above and I restart the services both named and dhcpd it OK. But I cannot see any update on zones file.
    When I use command “tail -f /var/log/messages” it’s say:

    server dhcpd: Unable to add forward map from test.mydomain.org 192.168.169.200: timed out

    Do you have any ideas?

    Thanks for helping.

    Chhorvorn

    • vechheka August 5, 2012, 12:46 am

      Please make sure the permission on dhcp and dns of directory and file are correct and the time on both servers are syncronize.

      Cheer!
      vechheka

  • malc November 23, 2011, 8:24 am

    Hi I am trying to configure a Centos 6 server with DDNS because my ISP uses a DHCP connection. how can I use the above configuration in my case.

  • Facemaskman May 5, 2012, 10:45 am

    May I use free ddns service?

  • Rocco February 5, 2014, 7:02 am

    Perfect! Thanks a lot for your tutorial! 🙂

    Nice greetings from Vienna!

Seurity: Are you a robot or human?

Leave a Comment