【HCIP(MGRE、GRE)实验】

一、题目要求

二、配置

r1

[r1-Serial4/0/0]ip address 15.0.0.1 24
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add	
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24

r2

[r2]int s 4/0/0
[r2-Serial4/0/0]ip add	
[r2-Serial4/0/0]ip address 25.0.0.1 24
[r2-Serial4/0/0]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add	
[r2-GigabitEthernet0/0/0]ip address 192.168.2.1 24

r3

[r3]int s 4/0/0
[r3-Serial4/0/0]ip add	
[r3-Serial4/0/0]ip address 35.0.0.1 24
[r3-Serial4/0/0]int g 0/0/0
[r3-GigabitEthernet0/0/0]192.168.3.1 24

r4

[r4]int g  0/0/0
[r4-GigabitEthernet0/0/0]ip add	
[r4-GigabitEthernet0/0/0]ip address 45.0.0.1 24
[r4-GigabitEthernet0/0/0]
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add	
[r4-GigabitEthernet0/0/1]ip address 192.168.4.1 24

r5

[isp]int s 3/0/0
[isp-Serial3/0/0]ip add	
[isp-Serial3/0/0]ip address 15.0.0.2 24
[isp-Serial3/0/0]int s 3/0/1
[isp-Serial3/0/1]ip add	
[isp-Serial3/0/1]ip address 25.0.0.2 24
[isp-Serial3/0/1]int s 4/0/0
[isp-Serial4/0/0]ip add	
[isp-Serial4/0/0]ip address 35.0.0.2 24
[isp-GigabitEthernet0/0/0]int lo0
[isp-LoopBack0]ip add	
[isp-LoopBack0]ip address 5.5.5.5 24

三、进行ppp、chap认证和hdlc封装

1、ppp认证

主认证方:R5
----创建用户信息
[isp]aaa
[isp-aaa]local-user admin password cipher 123456
[isp-aaa]local-user admin service-type ppp
[isp-aaa]
----配置认证方式
[isp]int s 4/0/0
[isp-Serial4/0/0]ppp a	
[isp-Serial4/0/0]ppp authentication-mode pap
[isp-Serial4/0/0]
被认证方:R1
[r1]int s 4/0/0
[r1-Serial4/0/0]ppp pap local-user admin password cipher 123456
[r1-Serial4/0/0]

2、chap认证

主认证方:R5
----创建用户信息
[isp]aaa
[isp-aaa]local-user admin2 password cipher 123456
[isp-aaa]local-user admin2 service-type ppp
----配置认证方式
[isp-aaa]int s 4/0/0
[isp-Serial4/0/0]ppp authentication-mode chap
被认证方:R2
[r2-GigabitEthernet0/0/0]int s 4/0/0
[r2-Serial4/0/0]ppp chap user admin2
[r2-Serial4/0/0]ppp chap password cipher 123456
[r2-Serial4/0/0

3、HDLC封装

R3:
[r3-GigabitEthernet0/0/0]int s 4/0/0
[r3-Serial4/0/0]link-protocol hdlc
R5:
[isp-GigabitEthernet0/0/0]int s 4/0/0
[isp-Serial4/0/0]link-protocol hdlc

四、构建MGRE和GRE环境

1、MGRE环境
a、环境配置
因为R1为中心站点,所以我选择将R1作为主干,R2和R3作为分支,然后分别去配路由信息

R1主干线路:
[r1]int t 0/0/0   ——————创建虚拟隧道接口
[r1-Tunnel0/0/0]ip address 192.168.5.1 24  ————IP地址是虚拟的
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp ——————定义封装方式
[r1-Tunnel0/0/0]source 15.0.0.1 ——————定义封装内容,因为R1为中心站点,其出接口为15.0.0.1,所以我将院IP地址选择为15.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 100  ——声明id,具有全局意义,类似于一个大范围,其他分支可以通过查找100这个门牌号,找到主干线路。
[r1-Tunnel0/0/0]

R2分支:
[r2]int t 0/0/0  ——————创建虚拟隧道接口
[r2-Tunnel0/0/0]ip address 192.168.5.2 24	
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp  ——————定义封装方式
[r2-Tunnel0/0/0]source Serial 4/0/0 ——————定义封装内容。因为其IP地址可能发生变化,但是接口是不会变的,如果以接口为源目标,那么其可靠性就得到了很大的保障。
[r2-Tunnel0/0/0]nhrp network-id 100 ——————通过查找100这个区域号,然后加入到里面去
[r2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register  ——————将分支信息上报到主干线路R1里面

R3分支:(原理同R2)
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.5.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source Serial 4/0/0
[r3-Tunnel0/0/0]nhrp network-id 100	
[r3-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register 

b、邻居表
R1:主干道路的邻居表

R2:分支道路的邻居表(因为他是R1的分支,所以说其只有R1一个邻居

R3:分支道路的邻居表(因为他是R1的分支,所以说其只有R1一个邻居)

2、GRE环境
a、R1到R4的路线分析:
真实的路线走法:源:15.0.0.1/24 | 目标:45.0.0.1/24
希望的路线走法:源:192.168.5.1/24 | 目标: 192.168.5.4
加了GRE后的走法:源:15.0.0.1/24 | 目标:45.0.0.1/24 |GRE| 源:192.168.5.1/24 | 目标: 192.168.5.4 |数据
a、环境配置

R1:
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.6.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 15.0.0.1
[r1-Tunnel0/0/0]description 45.0.0.1
[r1-Tunnel0/0/0]

R4:
[r4]int t 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.5.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre
[r4-Tunnel0/0/0]source 45.0.0.1 
[r4-Tunnel0/0/0]description 15.0.0.1
[r4-Tunnel0/0/0]

3、配置公网环境

——————这里我选择的是缺省路由来配
[r1]ip route-static 0.0.0.0 0 15.0.0.2
[r2]ip route-static 0.0.0.0 0 25.0.0.2
[r3]ip route-static 0.0.0.0 0 35.0.0.2
[r4]ip route-static 0.0.0.0 0 45.0.0.2

[r1]ip route-static 192.168.2.0 24 192.168.5.2 
[r1]ip route-static 192.168.3.0 24 192.168.5.3

[r2]ip route-static 192.168.1.0 24 192.168.5.1
[r2]ip route-static 192.168.3.0 24 192.168.5.3

[r3]ip route-static 0.0.0.0 0 35.0.0.2
[r3]ip route-static 192.168.2.0 24 192.168.5.2 
[r3]ip route-static 192.168.1.0 24 192.168.5.1

五、配置RIP

R1

[r1]rip 
[r1-rip-1]version 2
[r1-rip-1]network 192.168.6.0
[r1-rip-1]network 192.168.5.0
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 1.0.0.0
[r1-rip-1]q
[r1]int t 0/0/0
[r1-Tunnel0/0/0]undo rip split-horizon 
[r1-Tunnel0/0/0]

R2

[r2]rip
[r2-rip-1]version 2
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 192.168.5.0
[r2-rip-1]network 192.168.2.0
[r2-rip-1]

R3

[r3]rip 
[r3-rip-1]version 2
[r3-rip-1]network 3.0.0.0
[r3-rip-1]network 192.168.5.0
[r3-rip-1]network 192.168.3.0
[r3-rip-1]

R4

[r4]rip
[r4-rip-1]version 2	
[r4-rip-1]network 4.0.0.0
[r4-rip-1]network 192.168.6.0
[r4-rip-1]network 192.168.5.0
[r4-rip-1]network 192.168.4.0
[r4-rip-1]

将所有私有IP设置为源IP,可以访问R5环回(使用NAT映射)

————————R1
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 1.0.0.0 0.255.255.255
[r1-acl-basic-2000]int s 4/0/0
[r1-Serial4/0/0]nat outbound 2000
[r1-Serial4/0/0]

————————R2
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 2.0.0.0 0.255.255.255
[r2-acl-basic-2000]int s 4/0/0
[r2-Serial4/0/0]nat outbound 2000
[r2-Serial4/0/0]

————————R3
[r3]acl 2000
[r3-acl-basic-2000]rule permit source 3.0.0.0 0.255.255.255
[r3-acl-basic-2000]int s 4/0/0
[r3-Serial4/0/0]nat outbound 2000
[r3-Serial4/0/0]

————————R4
[r4]acl 2000
[r4-acl-basic-2000]rule permit source 4.0.0.0 0.255.255.255
[r4-acl-basic-2000]int g 0/0/0
[r4-GigabitEthernet0/0/0]nat outbound 2000
[r4-GigabitEthernet0/0/0]

六、测试全网可达

给PC分配地址

测试截图

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孔橘猫不吃鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值