Prepare the lab environment
Host type |
Operating system |
IP Address |
DHCP Service side |
CONTOS7 (RHEL7) operating system |
192.168.0.1 |
DHCP client |
CONTOS7 (RHEL7) operating system |
DHCP Auto get address |
Configure the virtual machine network type
Configuring IP using the nmtui command
Configuration of the DHCP server (requires a fixed IP: (Manual))
DCHP client settings (set to get IP automatically: (Automatic))
The virtual machine's DHCP service should be turned on by default for the virtual machine software vmwareworkstation, and must be turned off after the following operation
Start configuring the DHCP configuration file after completing the above operation
[Email protected] system]# cat/etc/dhcp/dhcpd.conf
Ddns-update-style none; #设置DHCP服务不自动动态更新
Ignore client-updates; #忽略客户机更新DNS记录
Subnet 192.168.10.0 netmask 255.255.255.0 {#作用域为192.168.10.0/24 network Segment
Range 192.168.10.50 192.168.10.100; #IP地址池为192.168.10.50--100 (approximately 50 IP addresses)
Option Subnet-mask 255.255.255.0; #定义客户机的子网掩码
Option routers 192.168.10.1; #定义客户机的网关地址
Option Domain-name "Baidu.com"; #定义默认的搜索域
Option Domain-name-servers 192.168.10.1; #定义客户机的DNS地址
Default-lease-time 2300; #定义默认租约时间
Max-lease-time 3211; #定义最大预约时间
} #此为结束符
Each parameter in the configuration file of the DHCPD service program needs to be ";" Good ending.
Start the DHCPD service program Systemctl restart DHCPD
Add to boot Systemctl enable DHCPD
Finally, restart the network on the DHCP client (systemctl restart networks) to see the results.
DHCP Auto-Assign IP