CentOS7 Operation and Maintenance-DHCP Service
DHCP service overview
DHCP
Using the UDP
transmission protocol, the server controls an IP
address segment. When the client requests service like the server, the server will automatically assign the IP
address and subnet mask to the client
Three allocation mechanisms of DHCP
① Automatic allocation
►Once successfully rented, it IP
will be used forever
②Dynamic allocation
►The allocation IP
has a time limit, and it can be replaced when it expires or the client actively releases itIP
③Manually assign
►Manually assigned by the administrator, DHCP
only as a communicator
Realize dynamic allocation of IP
①Install the DHCP software package
yum -y install dhcp
cd /etc/dhcp
②Modify the configuration file
vim dhcpd.conf //打开DHCP配置文件
►The configuration file will tell us where DHCP
the configuration file style is
:r /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
//使用vi命令行指令将样式文件内容写入到当前文件
►Find subnet
, here are 4 kinds of examples officially provided
subnet 网段 netmask 掩码
range 地址范围 - 地址范围
option domain-name-servers DNS服务器地址
option domain-name 网段的域名
option routers 默认网关地址
option broadcast-address 广播地址
default-lease-time 时间 //默认租约时间
max-lease-time 时间 //最大租约时间
③DHCP service optimization [optional]
[Global configuration parameters] [Independent configuration has priority over global configuration]
ddns-update-style none; #禁用 DNS 动态更新
- Improve the efficiency of DHCP and reduce bandwidth usage
④Start verification
►Open DHCP
service
systemctl start dhcpd
netstat -anptu | grep dhcp
//检查67端口是否开启
►Turn off the firewall and SELinux
systemctl stop firewalld
setenforce 0
►Win10 in the same LAN
Realize fixed allocation of IP
①Enter the DHCP configuration file
vim /etc/dhcp/dhcpd.conf
►Find host fantasia
it and change it tohost hostname
hardware ethernet MAC地址
fixed address IP地址
②Start verification
►Restart the DHCP service
systemctl restart dhcpd
►Refresh Win10 network
ipconfig/release
ipconfig/renew