Centos 7 DHCP 安装和配置

1.安装

yum install dhcp -y

2.修改DHCP的配置文件

subnet 要包含本机ip的网段

[root@test-dns ~]# rpm -ql dhcp | grep dhcpd.conf.example
/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
[root@test-dns dhcp]# mv dhcpd.conf dhcpd.conf.bak
[root@test-dns dhcp]# cp -rf /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[root@test-dns dhcp]# vim dhcpd.conf
subnet 192.168.71.0 netmask 255.255.255.0 {
  range 192.168.71.1 192.168.71.250;
  option domain-name-servers 192.168.70.152;
#  option domain-name "internal.example.org";
  option routers 192.168.71.254;
#  option broadcast-address 10.5.5.31;
  default-lease-time 600;
  max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host boss { ----主机声明
#hardware ethernet MAC地址 ----指定其它pc(打印机)mac地址
#fixed-address 192.168.80.188; ----固定地址
#}

3.启动

#关闭selinux防火墙
setenforce 0 
systemctl restart dhcpd

 

 

 

你可能感兴趣的:(Linux,&,DevOps,Huawei,Network,linux,dhcp)