vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="dhcp"
systemctl restart network
会自动启动 dhclient 服务 udp 68端口
/var/lib/dhclient/dhclient.leases dhcp客户端信息文件
手动启动dhclient 是后台运行的
dhclient //后台运行
dhclient -d //前台方式运行
nmcli device show ens33
nmcli connection show ens33
windows中命令
ipconfig/release 立即释放现在在从dhcp服务器获取的地址,优先旧的地址,重新申请ip
ipconfig/renew 强迫立即续约,获取一个新的租期
配置 DHCP 服务器
yum install dhcp -y
相关文件
/usr/lib/systemd/system/dhcpd.service
/usr/sbin/dhcpd
/etc/dhcp/dhcpd.conf
配置文件
option domain-name "xuepeng.com";
option domain-name-servers 180.76.76.76, 223.6.6.6;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.43.0 netmask 255.255.255.0 {
range 192.168.43.100 192.168.43.200;
range 192.168.43.210 192.168.43.220;
option routers 192.168.43.2;
}
host centos7-43-17 {
option domain-name "study.com";
option domain-name-servers 8.8.8.8, 114.114.114.114;
default-lease-time 86400;
max-lease-time 864000;
hardware ethernet 00:0c:29:49:cb:28;
option routers 192.168.43.2;
fixed-address 192.168.43.206;
}
启动
systemctl start httpd // 会开启udp的67端口