CentOS 7中安装dhcpd服务器
安装
yum install dhcp
配置
vim /etc/dhcp/dhcpd.conf
内容如下:
option domain-name-servers 172.16.0.1, 202.x.x.x, 166.x.x.x,202.x.x.x;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
}
subnet 172.16.0.0 netmask 255.255.255.0{
# set up bootp begin
next-server 172.16.0.1;
# for debian
# filename "pxelinux.0";
# set up bootp end
option broadcast-address 172.16.0.255;
range 172.16.0.10 172.16.0.59;
option routers 172.16.0.1;
}
host gateway {
hardware ethernet 6c:f0:49:81:36:5e;
fixed-address 172.16.0.1;
option routers 172.16.0.1;
}
监听指令网卡
vim /etc/sysconfig/dhcpd,增加如下:
DHCPDARGS=enp2s0
启动
service dhcpd start
查看状态
systemctl status dhcpd.service
结果
11月 02 19:36:36 localhost.localdomain systemd[1]: Started DHCPv4 Server Daemon.