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

DHCP中继服务

时间:2020-05-28 19:30:33      阅读:65      评论:0      收藏:0      [点我收藏+]

标签:work   mic   global   gate   服务   ati   dhcp中继   分配   add   

一:实验环境
1.1: 华为ensp软件
1.2: PC机和路由器及交换机
初始化状态的PC机和初始化状态的路由器,交换机
二.实验需求,实现全网互通且DHCP中继在R4上
三:实验过程
3.1:配置设备
在ensp中,将PC机和路由器及交换机准备好,并启动。
技术图片

3.2配置思路
配置R1
1)配置接口

Int g0/0/0 ; ip add 12.0.0.1 24 ;un sh
Int g0/0/2 ; ip add 14.0.0.1 24 ;un sh

2)配置单臂路由及中继

dhcp enable    #系统视图下命令
int g0/0/1.10 ;
ip add 192.168.10.1;
d t v 10 ;
a b e;
dhcp select relay;    #配置中继模式
dhcp relay server-ip 14.0.0.2; #配置中继地址
un sh
int g0/0/1.20 ;
ip add 192.168.20.1;
d t v 20 ;a b e;dhcp select relay;
dhcp relay server-ip 14.0.0.2;
un sh

3)配置静态/默认路由
ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
配置R2
1) 配置接口

int g0/0/0
ip add 12.0.0.2 24
un sh
int g0/0/1
ip add 15.0.0.1 24
un sh;q

2)配置开启中继模式

dhcp enable
dhcp select relay 
dhcp relay server-ip 14.0.0.2 ##指定中继地址

3)配置静态/默认路由(运营商端)

ip route-static 14.0.0.0 24 12.0.0.1
ip route-static 192.168.10.0 24 12.0.0.1
ip route-static 192.168.20.0 24 12.0.0.1

配置R4,提供中继服务
1)配置路由接口

Int g0/0/0 
Ip add 14.0.0.2 24
un sh

2)配置DHCP中继服务

dhcp enable
int g0/0/0
ip add 14.0.0.2 24
dhcp select global  #在接口上声明去全局模式找配置的DHCP服务
undo sh
配置中继池子,一个网段配置一个
ip pool DHCP15  #进DHCP15,配置PC5 15网段的池子
network 15.0.0.0 mask 24
gateway-list 15.0.0.1
dns-list 8.8.8.8 2.2.2.2
excluded-ip-address 15.0.0.100 15.0.0.254
static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F
ip pool DHCPvlan10 #进DHCPvlan10配置10.0网段池子
network 192.168.10.0 mask 24
gateway-list 192.168.10.1
dns-list 8.8.8.8 2.2.2.2
ip pool DHCPvlan20 #进DHCPvlan20配置20.0网段池子
network 192.168.20.0 mask 24
gateway-list 192.168.20.1
dns-list 8.8.8.8 2.2.2.2

3)配置路由
ip route-static 0.0.0.0 0.0.0.0 14.0.0.1
3.3 配置SW1交换机

[SW1] vlan batch 10 20
[SW1] interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]un sh
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]un sh
[SW1] interface Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 10
[SW1-Ethernet0/0/3]un sh
[SW1]interface Ethernet0/0/4
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]port default vlan 20
[SW1-Ethernet0/0/4]un sh
[SW1-Ethernet0/0/4]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a
[SW1-GigabitEthernet0/0/1]un sh

3.4配置R1路由器
3.4.1 配置单臂路由

[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh
[R1-GigabitEthernet0/0/2]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/0]un sh
[R1]dhcp enable
[R1]int GigabitEthernet 0/0/1.10
[R1-GigabitEthernet0/0/1.10]d t v 10
[R1-GigabitEthernet0/0/1.10]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/1.10]a b e
[R1-GigabitEthernet0/0/1.10]un sh
[R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20
[R1-GigabitEthernet0/0/1.20]d t v 20
[R1-GigabitEthernet0/0/1.20]ip address 192.168.20.1 24
[R1-GigabitEthernet0/0/1.20]a b e
[R1-GigabitEthernet0/0/1.20]un sh

3.4.2配置DHCP中继服务(指定中继路由地址)

[R1-GigabitEthernet0/0/1.20]int GigabitEthernet 0/0/1.10
[R1-GigabitEthernet0/0/1.10]dhcp select relay  #选择中继模式
[R1-GigabitEthernet0/0/1.10]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.10]un sh
[R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20
[R1-GigabitEthernet0/0/1.20]dhcp select relay
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]un sh

3.4.3配置静态路由
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
3.5 配置R2路由器
3.5.1配置接口

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/0]un sh
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[R2-GigabitEthernet0/0/1]un sh

3.5.2配置中继服务

[R2]dhcp enable
[R2-GigabitEthernet0/0/1]dhcp select relay
[R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2
[R2-GigabitEthernet0/0/1]undo sh
[R2-GigabitEthernet0/0/1]q

3.5.3配置路由

[R2]ip route-static 14.0.0.0 24 12.0.0.1
[R2]ip route-static 192.168.10.0 24 12.0.0.1
[R2]ip route-static 192.168.20.0 24 12.0.0.1

3.6 配置R4路由器
3.6.1配置路由接口

Int g0/0/0 
Ip add 14.0.0.2 24
un sh

3.6.2配置DHCP中继服务

[R4]dhcp enable #系统模式声明启用DHCP
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.0.0.2 24
[R4-GigabitEthernet0/0/0]dhcp select global  #在接口上声明去全局模式找配置的DHCP

3.6.3配置的DHCP服务

[R4-GigabitEthernet0/0/0]undo sh
[R4-GigabitEthernet0/0/0]q
[R4]ip pool DHCP15
[R4-ip-pool-DHCP15]network 15.0.0.0 mask 24
[R4-ip-pool-DHCP15]gateway-list 15.0.0.1
[R4-ip-pool-DHCP15]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCP15]excluded-ip-address 15.0.0.100 15.0.0.254
[R4-ip-pool-DHCP15]static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F    #此处MAC地址配的是PC5的mac,且配置分配15.0.0.88地址
[R4-ip-pool-DHCP15]dis this
ip pool DHCP15
 gateway-list 15.0.0.1
 network 15.0.0.0 mask 255.255.255.0
 static-bind ip-address 15.0.0.88 mac-address 5489-98c3-6b6f
 excluded-ip-address 15.0.0.100 15.0.0.254
 dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCP15]q
[R4]ip pool DHCPvlan10
[R4-ip-pool-DHCPvlan10]network 192.168.10.0 mask 24
[R4-ip-pool-DHCPvlan10]gateway-list 192.168.10.1
[R4-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCPvlan10]ip pool DHCPvlan20
[R4-ip-pool-DHCPvlan20]network 192.168.20.0 mask 24
[R4-ip-pool-DHCPvlan20]gateway-list 192.168.20.1
[R4-ip-pool-DHCPvlan20]dns-list 8.8.8.8 2.2.2.2
[R4-ip-pool-DHCPvlan20]q
[R4]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1

3.7 检查是否满足需求
技术图片
PC5已经获取指定配置的IP
技术图片
技术图片
技术图片
技术图片
技术图片

DHCP中继服务

标签:work   mic   global   gate   服务   ati   dhcp中继   分配   add   

原文地址:https://blog.51cto.com/14625831/2499365

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