1. The configuration of the dhcp service is
in the server:
ifconfig eth0
7 option domain-name "example.com"; ("example.com":域名)
29 subnet 172.25.254.0 (network bit) netmask 255.255.255.0 { (subnet mask)
30 range 172.25.254.200 172.25.254.210;
31 option routers 172.25.254.250; (172.25.254.250: gateway)
In the test side:
unplug the network cable to reset the virtual machine
ifconfig
In the server:
The final query result is the same as success
in the server:
ifconfig eth0
vim /etc/hosts
yum install dhcp.x86_64 -y installs the dhcp.x86_64 file
cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim dhcpd.conf7 option domain-name "example.com"; ("example.com":域名)
8 option domain-name-servers 114.114.114.114; (114.114.114.1140:DNS)
29 subnet 172.25.254.0 (network bit) netmask 255.255.255.0 { (subnet mask)
30 range 172.25.254.200 172.25.254.210;
31 option routers 172.25.254.250; (172.25.254.250: gateway)
32 }
delete after line 34
systemctl start dhcpdsystemctl enable dhcpd
In the test side:
unplug the network cable to reset the virtual machine
ifconfig
In the server:
cat /var/lib/dhcpd/dhcpd.leasea
The final query result is the same as success