DHCP的搭建

系统 环境:

[[email protected] ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[[email protected] ~]# uname -r 

3.10.0-327.el7.x86_64

[[email protected] ~]# ip addr show enp0s8 | awk 'NR==3{print $2}' 

192.168.235.36/24

[[email protected] ~]# yum install -y dhcp

[[email protected] ~]# cp -a /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf


[[email protected] ~]# cat /etc/dhcp/dhcpd.conf 

subnet 192.168.235.0 netmask 255.255.255.0 {

  range 192.168.235.10 192.168.235.20;

 default-lease-time 600;

 max-lease-time 7200;

}


#可以看到我们的配置非常少,此处主要演示是 安装服务 更多配置在  man 5 dhcpd.conf


[[email protected] ~]#  systemctl start dhcpd

[[email protected] ~]# setenforce 0

[[email protected] ~]# systemctl stop firewalld


另开启一台虚拟机windows server 2003  与 DHCP服务器在同一个VM里面


DHCP的搭建

可以看到 windows server 2003 可以获取到 IP地址


[[email protected] ~]# cat /var/lib/dhcpd/dhcpd.leases 

# The format of this file is documented in the dhcpd.leases(5) manual page.

# This lease file was written by isc-dhcp-4.2.5


server-duid "\000\001\000\001 k\264U\010\000'x\377\204";


lease 192.168.235.10 {

  starts 1 2017/03/27 11:32:21;

  ends 1 2017/03/27 11:42:21;

  cltt 1 2017/03/27 11:32:21;

  binding state active;

  next binding state free;

  rewind binding state free;

  hardware ethernet 08:00:27:2a:05:ad;                #客户机的MAC地址

  uid "\001\010\000'*\005\255"; 

  client-hostname "cqwu-8b3601776c";

}

DHCP的搭建










本文转自 chaunceyjiang  51CTO博客,原文链接:http://blog.51cto.com/cqwujiang/1910894,如需转载请自行联系原作者