Configure DHCP service in CentOS
DHCP(Dynamic Host Configuration Protocol)is a lan network protocol, The communication
based on UDP protocal.
There are 2 functions:allocate ip addresss for internal devices automatically; aviod the ip confliction.
How to install DHCP: yum install dhcp -y
After DHCP installed, sample configuration file path: /usr/local/doc/dhcp-x.x.x/
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcpd.conf
edit this file: vim /etc/dhcpd.conf
在这个配置文件主要填写分配的ip的
set ip range, netmask, default gateway and DNS servers in dhcpd.conf
ip range: 192.168.13.1-192.168.13.250
net mask: 255.255.255.0
default gateway: 192.168.13.254
DNS servers: 202.101.224.68 ; 202.101.224.69
max-lease-time by default
As shown in the following figure!
After finshed off dhcpd.conf, you can execute “service dhcpd start” to
confirm whether dhcpd service is running or not. you must modify dhcpd.conf if dhcpd
service is not running.
add dhcpd to system service: chkconfig –add dhcpd
set dhcpd start automatically when system starts:dhcpchkconfig –list dhcpd
confirm whether dhcpd can start automatically when system starts.
chkconfig –list dhcpd
add UDP port 67 to ipatbles.
then restart iptables , /etc/init.d/iptables restart
check whether UDP 67 open or not.