[root@CentOS6 ~]# yum -y install dhcp
[root@CentOS6 ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
option domain-name "text.com";
option domain-name-servers 172.18.0.1;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.138.0 netmask 255.255.255.0 {
range 192.168.138.100 192.168.138.200;
}
host CentOS7 {
hardware ethernet 00:0c:29:83:97:3b;
fixed-address 192.168.138.150;
}
④ 开启服务端的dhcp服务
[root@CentOS6 ~]# /etc/init.d/dhcpd start
Starting dhcpd: [ OK ]
排错小技巧,如果dhcpd开启Failed,可以查看/var/log/messages
⑤ 激活客户端CentOS7的网卡ens34/CentOS6-mini的网卡eth1
[root@CentOS7 ~]# ifup ens34 # 因为绑定IP的缘故,激活网卡会比较快
[root@mini6 ~]# ifup eth1 # 因为有分配IP的过程,因此会明显的慢
Determining IP information for eth1... done.
CentOS 6.5下DHCP服务器搭建与配置 https://www.linuxidc.com/Linux/2014-10/108220.htm
CentOS搭建NAT和DHCP服务,实现共享上网 https://www.linuxidc.com/Linux/2018-07/153294.htm
Ubuntu 16.04安装搭建DHCP服务详解 https://www.linuxidc.com/Linux/2018-06/152742.htm
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx