随笔 - 196  文章 - 0  评论 - 9  阅读 - 63万

在CISCO路由器上配置DHCP与DHCP中继


企业网络中DHCP环境的搭建

企业DHCP需求描述:

   在大型企业中,一般都有很多个部门,各部门之间有时要求不能互通,这可以通过使用VLAN来解决,但是上千个人IP配置也是一件极大耗费人力的事。所以我们迫切需求一种全自动的,高效的配置方法,通过DHCP配置IP地址的方法很好地为我们解决了这个问题。

网络拓扑如下:

650) this.width=650;" onsubmit="" onchange="" onunload="" onselect="" onreset="">

 

配置描述

  一般小中型企业的网络拓扑如上图所示,在核心交换下面,接接入层交换机,各部门划分不同的VLAN,此时我们假设在核心交换上或路由器上,或在核心交换上单独接一台DHCP服务器。如果在三层上直接配置DHCP,则无需配置DHCP中继,此时我们假设在路由器上配置DHCP服务,一般大型企业分层的网络拓扑中间都是要跨网段的所以一般都会用到DHCP。

设备配置

路由器配置

ROUTER#en

ROUTER#

ROUTER#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

ROUTER(config)#

ROUTER(config)#no ip domain-lookup

ROUTER(config)#

ROUTER(config)#host R1

R1(config)#

R1(config)#int e0/0

R1(config-if)#

R1(config-if)#ip add 12.1.1.1 255.255.255.0   //和三层交换相连的接口

R1(config-if)#

R1(config-if)#no shutdown

R1(config-if)#

R1(config-if)#exit

R1(config)#

R1(config)#ip dhcp pool test1

R1(dhcp-config)#

R1(dhcp-config)#network 192.168.1.0 255.255.255.0          //vlan10的地址池

R1(dhcp-config)#

R1(dhcp-config)#default-router 192.168.1.1

R1(dhcp-config)#

R1(dhcp-config)#dns-server 1.1.1.1

R1(dhcp-config)#

R1(dhcp-config)#exit

R1(config)#

R1(config)#ip dhcp pool test2

R1(dhcp-config)#

R1(dhcp-config)#network 192.168.2.0 255.255.255.0         //vlan20的地址池

R1(dhcp-config)#

R1(dhcp-config)#default-router 192.168.2.1

R1(dhcp-config)#

R1(dhcp-config)#dns-server 2.2.2.2

R1(dhcp-config)#

R1(dhcp-config)#exit

R1(config)#

R1(config)#ip dhcp exclu

R1(config)#ip dhcp excluded-address 192.168.1.1        //去除网关的IP

R1(config)#

R1(config)#ip dhcp excluded-address 192.168.2.1          //去除网关的IP

R1(config)#

R1(config)#ip route 192.168.1.0 255.255.255.0 12.1.1.2   //添加去往VLAN10的路由

R1(config)#

R1(config)#ip route 192.168.2.0 255.255.255.0 12.1.1.2  //添加去往VLAN20的路由

 

 

三层交换机配置

SWITCH#en

SWITCH#

SWITCH#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

SWITCH(config)#

SWITCH(config)#host SW1

SW1(config)#

SW1(config)#int e0/0

SW1(config-if)#ip add 12.1.1.2 255.255.255.0   //和R1相连的接口

SW1(config-if)#

SW1(config-if)#no shutdown

SW1(config-if)#

SW1(config-if)#exit

SW1(config)#

SW1(config)#vlan 10

SW1(config-vlan)#

SW1(config-vlan)#name test1

SW1(config-vlan)#

SW1(config-vlan)#vlan 20

% Applying VLAN changes may take few minutes.  Please wait...

 

SW1(config-vlan)#

SW1(config-vlan)#name test2

SW1(config-vlan)#

SW1(config-vlan)#int vlan 10

% Applying VLAN changes may take few minutes.  Please wait...

 

SW1(config-if)#ip add 192.168.1.1 255.255.255.0

SW1(config-if)#ip helper

SW1(config-if)#ip helper-address 12.1.1.1        //设置DHCP服务器地址

SW1(config-if)#

SW1(config-if)#int vlan 20

SW1(config-if)#ip add 192.168.2.1 255.255.255.0

SW1(config-if)#ip helper-address 12.1.1.1           //设置DHCP服务器地址

SW1(config-if)#

SW1(config-if)#exit

SW1(config)#

 

 

DHCP中继的配置已经好了,接下来在二层交换机配置相应的VLAN,把相应交换机端口加入相应VLAN,然后开启DHCP获取地址即可。

posted on   周德顺  阅读(15871)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2012年12月 >
25 26 27 28 29 30 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示