Centos 7 配置 DHCP 服务

yum install dhcp
vim /etc/dhcp/dhcpd.conf 

输入

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

default-lease-time 600;
max-lease-time 7200;

subnet 192.168.0.0 netmask 255.255.255.0 {
    #option routers 192.168.0.1;
    #option domain-name-servers 192.168.0.11;
    range 192.168.0.50 192.168.0.80;
}
~  

指定监听网卡

vim /usr/lib/systemd/system/dhcpd.service

ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dh
    cpd -group dhcpd --no-pid enp1s0

在最后添加上 enp1s0

重启

systemctl daemon-reload
systemctl restart dhcp

分配的网段需要和 网卡上的地址在同一个网段

参考

https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/networking_guide/sec-dhcp-configuring-server

https://blog.csdn.net/lyn_00/article/details/80798323

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code