1、DHCP安装及配置
yum install dhcp
cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
option domain-name "redhat.com";
option domain-name-servers 202.96.128.166, 114.114.114.114; # 设置DNS
default-lease-time 3600; # 默认租约时间,单位秒
max-lease-time 7200; # 最大租约时间,单位秒
log-facility local7; # 日志级别
subnet 192.168.101.0 netmask 255.255.255.0 {
range 192.168.101.150 192.168.101.180; # DHCP可获取的IP地址范围
option routers 192.168.101.254; # 网关
option subnet-mask 255.255.255.0; # 子网掩码
host test {
hardware ethernet 00:0C:29:6F:38:E4; # 绑定主机的MAC地址
fixed-address 192.168.101.208; # 绑定的IP
}
}
2、启动DHCP服务
service dhcpd restart
3、查看DHCP客户端状态
cat /var/lib/dhcpd/dhcpd.leases
cat /var/lib/dhcpd/dhcpd.leases~
dhclient:获取地址
-d:在前台运行并显示获取过程
-r:释放地址
原文地址:http://yuyucat.blog.51cto.com/9627004/1652941