Linux基础学习-使用DHCP动态管理主机地址

动态主机配置协议

部署dhcpd服务程序

参数 做用
ddns-update-style none; 设置DNS服务不自动进行动态更新
ignore client-updates; 忽略客户端更新DNS记录
subnet 192.168.56.0 netmask 255.255.255.0 做用域为192.168.56.0/24网段
range 192.168.56.50 192.168.56.200 IP地址池
option subnet-mask 255.255.255.0 子网掩码
option routers 192.168.56.2 客户端网关地址
option domain-name "linux.com" 默认搜索域
option domain-name-servers 192.168.56.2 客户端DNS地址
default-lease-time 21600 默认租约时间
max-lease-time 43200 最大预定时间
hardware ethernet 该主机mac地址
fixed-address 欲指定的ip地址
[root@qdlinux ~]# yum install dhcp -y
//编辑dhcpd服务程序配置文件
vim /etc/dhcp/dhcpd.conf
ddns-update-style none;
ignore client-updates;
subnet 192.168.65.0 netmask 255.255.255.0 {
    range 192.168.65.50 192.168.65.200;
    option subnet-mask 255.255.255.0;
    option routers 192.168.65.1;
    option domain-name-servers 192.168.65.1;
    default-lease-time 21600;
    max-lease-time 43200;
}
//重启服务并加入开机自启动
//分配固定IP地址
//tail -f /var/log/messages

host linuxprobe {
    hardware ethernet 00:0c:29:27:c6:12;
    fixed-address 192.168.65.88;
}