码迷,mamicode.com
首页 > 其他好文 > 详细

DHCP的搭建

时间:2017-03-28 11:47:54      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:dhcp的搭建

系统 环境:

[root@RHCE ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[root@RHCE ~]# uname -r 

3.10.0-327.el7.x86_64

[root@RHCE ~]# ip addr show enp0s8 | awk ‘NR==3{print $2}‘ 

192.168.235.36/24

[root@RHCE ~]# yum install -y dhcp

[root@RHCE ~]# cp -a /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf


[root@RHCE ~]# 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


[root@RHCE ~]#  systemctl start dhcpd

[root@RHCE ~]# setenforce 0

[root@RHCE ~]# systemctl stop firewalld


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


技术分享

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


[root@RHCE ~]# 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";

}

技术分享

本文出自 “梦1场ー〉╯” 博客,请务必保留此出处http://cqwujiang.blog.51cto.com/10808946/1910894

DHCP的搭建

标签:dhcp的搭建

原文地址:http://cqwujiang.blog.51cto.com/10808946/1910894

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!