# yum -y install dhcp
# systemctl enable dhcpd
# cp -a /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example/etc/dhcp/dhcpd.conf
# vi /etc/dhcp/dhcpd.conf
ddns-update-style interim; # non:不支持 interim:互动更新模式 ad-hoc:特殊更新模式 subnet 10.5.5.0 netmask 255.255.255.224 { # subnet 网段 netmask 子网掩码 range 10.5.5.26 10.5.5.30; # 分配的ip地址范围 option domain-name-servers ns1.internal.example.org; # 设置client dns ip option domain-name "internal.example.org"; # 设置 client domain域 option routers 10.5.5.1; # 设置路由信息 网关 option broadcast-address 10.5.5.31; # 广播地址 default-lease-time 600; # 租约时间 max-lease-time 7200; # 最长租约时间 }
host fantasia { # 保存固定分配地址 hardware ethernet 08:00:07:26:c0:a5; # mac硬件地址 fixed-address fantasia.fugue.com; # 固定ip } |
# systemctl start dhcpd