Tuesday, September 14, 2010

Adding an ISC DHCP server with DDNS (CentOS 5.5)

Adding an ISC DHCP server with DDNS (CentOS 5.5)


BIND (DDNS) server is already in place and running.

Built server with server package only.

Install DHCP package:

yum update dhcp

Create rndc.key:

touch /etc/rndc.key

Edit rndc.key to use the same key being used by BIND:

key "rndckey" {
       algorithm hmac-md5;
       secret "h7mAgf+HKPCSzBCBW4Wjiw==";
};


Edit dhcpd.conf as follows:

vi /etc/dhcpd.conf

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample 
#

authoritative;
ddns-update-style interim;
allow client-updates;
include "/etc/rndc.key";

zone mydomain.local. {
       # Set the IP address of the name server whose zone information is to be updated
       # 192.168.1.103 == is your primary master bind 9 server
       primary 192.168.1.103;
       # and the key to use
       key rndckey;
}

# update the reverse lookup zone
zone 1.168.192.in-addr.arpa. {
       primary 192.168.1.103;
       key rndckey;
}

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
       option routers             192.168.1.1;
       option subnet-mask         255.255.255.0;

#      option nis-domain          "domain.org";
       option domain-name         "mydomain.local";
       option domain-name-servers 192.168.1.103, 192.168.1.104;

       option time-offset         -21600;       # Central Standard Time
#      option ntp-servers         192.168.1.1;
#      option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#      option netbios-node-type 2;

       range dynamic-bootp 192.168.1.10 192.168.1.20;
       default-lease-time 21600;
       max-lease-time 43200;

       # we want the nameserver to appear at a fixed address
#      host ns {
#             next-server marvin.redhat.com;
#             hardware ethernet 12:34:56:78:AB:CD;
#             fixed-address 207.175.42.254;
#      }
}

Configure DHCP for automatic startup:

/sbin/chkconfig –level 35 dhcpd on
/sbin/chkconfig –list dhcpd

Start dhcpd daemon:

/sbin/service dhcpd start

Test:

tail –f /var/log/messages


Add dhcp  A record to dns1 (don’t forget to change serial number)

rndc freeze mydomain.local
vi /var/named/chroot/var/named/slaves/mydomain.local.zone.db
rndc thaw mydomain.local
rndc reload


No comments:

Post a Comment