Set up DHCP
Install DHCP server: Yum install dhcp-y
Complete installation under File/etc/dhcp/dhcpd.conf
Vim/etc/dhcp/dhcp.confdefault-leaste-time 259200;max-lease-time 777600;option domain-name "Wangconggao";
The first and second lines define the default period and the maximum period for the lease, and the values are calculated in seconds, which is "three days" and "Nine days". The last line specifies the name that the network uses.
Subnet 192.168.20.0 netmask 255.255.255.0 {range 192.168.20.1 192.168.20.19;range 192.168.20.21 192.168.20.253;option Broadcast-address 192.168.20.255;option Routers 192.168.20.20;option domain-name-servers 192.168.20.20,219.141.136.10,219.141.140.10;}
Here, specify two scopes under the network (192.168.20.0), which is the IP range that allocates DHCP: 192.168.20.1 and 192.168.20.19 to 192.168.20.21 to 192.168.253, and I also specified ' Address of the broadcast address ', ' Router address ', and ' DNS '. Host Xiaohai {hardware Ethernet 48:54:e8:27:75:77;fixed-address 192.168.20.252;}
The client machine that obtains IP through DHCP, if its lease period has expired, then may lose the original IP, if I want to always use the original IP above method can be realized.
Then build the dhcp.leases file: touch/etc/dhcp.leases do not try to modify this file yourself, if you change the file has a problem, say it deleted or renamed. And then re-establish the file.
Restart DHCP server:/ETC/RC.D/INIT.D/DHCPD restart or: service dhcpd Restart See if there are any errors below if not stated successfully!
This article is from the "Wangconggao" blog, make sure to keep this source http://wangconggao.blog.51cto.com/3253868/1579677
DHCP setup under Linux