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 "10.100.32.50";
#option boot-server "http://10.100.32.50:8088/phoneprov"; } class "poly335" { match if substring (option vendor-class-identifier,7,21) = "SoundPointIP-SPIP_335";
#option boot-server "http://10.100.32.50:8088/phoneprov"; #match if substring (hardware,0,10) = "00:04:f2";
option tftp-server-name "10.100.32.50"; #option option-66 "10.100.32.50"; #option option-67 "10.100.32.50"; #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 "10.100.32.50";
} class "cisco7961" {
match if substring (option vendor-class-identifier,0,36) = "Cisco Systems, Inc. IP Phone CP-7961";
option tftp-server-name "10.100.32.50";
} # dhcp to issue IP's to other computers in your network (separate from the phones) # specify your network and subnetmask subnet 10.100.32.0 netmask 255.255.255.0
{ option routers 10.100.32.1; # specify default gateway option subnet-mask 255.255.255.0; option domain-name "asterisk.local"; # default DNS domain name option domain-name-servers 68.87.72.134,68.87.77.134; # DNS Server option time-offset -21600; # Central Standard Time range 10.100.32.70 10.100.32.99; # if you want dhcp to issue ip's to other pool {
allow members of "poly550"; range 10.100.32.60 10.100.32.69;
     } pool { allow members of "poly335";
range 10.100.32.50 10.100.32.59;
     } pool { allow members of "cisco7960";
range 10.100.32.40 10.100.32.49;
} pool { allow members of "cisco7961";
range 10.100.32.30 10.100.32.39;
} # static phones host conf2570 {
hardware ethernet 00:04:f2:e1:cf:a5;
fixed-address 10.100.32.254;
} host conf2571 {
hardware ethernet 00:04:f2:e1:8d:2e;
fixed-address 10.100.32.253;
}
} # --- 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