1.编译安装
# tar xvzf dhcp-4.1.0a1.tar.gz
#cd dhcp-4.1.0a1
#./configure --prefix=/usr/local --localstatedir=/usr/local/var/ --with-srv-lease-file=/usr/local/var/db/dhcpd.leases --with-srv-pid-file=/usr/local/var/run/dhcpd.pid
#make
#make install
2.新建需要的文件
#mkdir -p /usr/local/var/db
#touch /usr/local/var/db/dhcpd.leases
#mkdir -p /usr/local/var/run
#touch /usr/local/var/run/dhcpd.pid
3.编辑dhcpd文件
#touch /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates; shared-network share { option subnet-mask 255.255.255.0; option domain-name "china.com"; option domain-name-servers 192.168.11.1,192.168.11.2; option broadcast-address 192.168.11.255; default-lease-time 86400; max-lease-time 172800; #configure subnet 1 subnet 192.168.11.0 netmask 255.255.255.0 { range 192.168.11.100 192.168.11.200; option routers 192.168.11.254; host pc1 { hardware ethernet 00:1A:4D:84:82:3E; fixed-address 192.168.11.20; } host pc2 { hardware ethernet 01:E0:2C:4C:EE:93; fixed-address 192.168.11.30; } } #configure subnet 2 subnet 192.168.12.0 netmask 255.255.255.0 { range 192.168.12.100 192.168.12.200; option routers 192.168.11.254; host pc3 { hardware ethernet 00:E0:4C:4C:FE:93; fixed-address 192.168.12.20; } host pc4 { hardware ethernet 01:E0:2C:4C:EE:93; fixed-address 192.168.12.30; } } }
#vi /etc/dhcpd.conf
4.启动dhcpd#dhcpd