Setup a DHCP Server on CentOS

Getting started

First we need to make sure dhcpd (the DHCP daemon) is installed.

yum install dhcp
# cp -f /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

Once it’s installed you’ll need to create/edit the file /etc/dhcpd.conf adding entries.

nano /etc/dhcpd.conf

# tell DHCP to set option 66 as a string variable
option boot-server code 66 = string;
option option-66 code 66 = text;
option option-67 code 67 = text; option vlan-flag code 190 = unsigned integer 8;
option voice-vlan-id code 191 = unsigned integer 16;
option data-vlan-id code 192 = unsigned integer 16; ddns-update-style interim; default-lease-time 21600; max-lease-time 43200; class "poly550" { match if substring (option vendor-class-identifier,7,21) = "SoundPointIP-SPIP_550"; option tftp-server-name "";
#option boot-server ""; } class "poly335" { match if substring (option vendor-class-identifier,7,21) = "SoundPointIP-SPIP_335";
#option boot-server ""; #match if substring (hardware,0,10) = "00:04:f2";
option tftp-server-name ""; #option option-66 ""; #option option-67 ""; #option vlan-flag 1; #option voice-vlan-id 133; #option data-vlan-id 133;
} class "cisco7960" {
match if substring (option vendor-class-identifier,0,21) = "Cisco IP Phone 7960";
option tftp-server-name "";
} class "cisco7961" {
match if substring (option vendor-class-identifier,0,36) = "Cisco Systems, Inc. IP Phone CP-7961";
option tftp-server-name "";
} # dhcp to issue IP's to other computers in your network (separate from the phones) # specify your network and subnetmask subnet netmask
{ option routers; # specify default gateway option subnet-mask; option domain-name "asterisk.local"; # default DNS domain name option domain-name-servers,; # DNS Server option time-offset -21600; # Central Standard Time range; # if you want dhcp to issue ip's to other pool {
allow members of "poly550"; range;
     } pool { allow members of "poly335";
     } pool { allow members of "cisco7960";
} pool { allow members of "cisco7961";
} # static phones host conf2570 {
hardware ethernet 00:04:f2:e1:cf:a5;
} host conf2571 {
hardware ethernet 00:04:f2:e1:8d:2e;
} # --- End Of File ---# /etc/rc.d/init.d/dhcpd start chkconfig dhcpd on

How to find the vendor-class-identifier string for a new phone as it sends out it’s DHCP REQUEST packets.  From the shell on your dhcpd server, run the following command while you’re booting your phone:

tcpdump -lenv -s 1500 port bootps or port bootpc -i eth0 > tcpdump.txt