MGRE综合实验

实验要求:
在这里插入图片描述
拓扑图搭建如下:
在这里插入图片描述
1、配置IP地址
r1:
[r1]inter s 4/0/0
[r1-Serial4/0/0]ip add 15.0.0.1 24
[r1-Serial4/0/0]inter g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
display ip interface brief (检查接口IP配置是否正确)
在每台路由器上写一条指向ISP的缺省路由,使其与ISP相连接的路由器的物理接口可以访问。
[r1]ip route-static 0.0.0.0 0 15.0.0.2

r2:
[r2]inter s4/0/0
[r2-Serial4/0/0]ip add 25.0.0.1 24
[r2-Serial4/0/0]inter g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r2]ip route-static 0.0.0.0 0 25.0.0.2

r3:
[r3]inter s4/0/0
[r3-Serial4/0/0]ip add 35.0.0.1 24
[r3-Serial4/0/0]inter g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[r3]ip route-static 0.0.0.0 0 35.0.0.2

r4:
[r4]inter g0/0/0
[r4-GigabitEthernet0/0/0]ip add 45.0.0.1 24
[r4-GigabitEthernet0/0/0]inter g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[r4]ip route-static 0.0.0.0 0 45.0.0.2
在这里插入图片描述

r5:
[isp]inter s3/0/0
[isp-Serial3/0/0]ip add 15.0.0.2 24
[isp-Serial3/0/0]inter s3/0/1
[isp-Serial3/0/1]ip add 25.0.0.2 24
[isp-Serial3/0/1]inter s4/0/0
[isp-Serial4/0/0]ip add 35.0.0.2 24
[isp-Serial4/0/0]inter g0/0/0
[isp-GigabitEthernet0/0/0]ip add 45.0.0.2 24

2、R1和R5之间使用PPP的PAP认证,R5为主认证方
首先由认证方提供用户名和密码
[isp]aaa
[isp-aaa]local-user r1 password cipher 123456
Info: Add a new user.

指定service-type为PPP协议
[isp-aaa]local-user r1 service-type ppp
因为华为设备中的串线连接的接口默认就是PPP协议,所以R1的协议类型不需要修改,只需要做认证。

主认证方接口配置选PAP认证:
[isp]inter s3/0/0
[isp-Serial3/0/0]ppp authentication-mode ?
chap Enable CHAP authentication
pap Enable PAP authentication
[isp-Serial3/0/0]ppp authentication-mode pap

被认证方的接口配置中要配置登录用的用户名和密码:
[r1]inter s4/0/0
[r1-Serial4/0/0]ppp pap local-user r1 password cipher 123456

因为PPP建立的是一次性对话,所以要想要检测PPP认证是否成功,得先把接口shutdown,然后再undo shutdown,如果能ping通,则说明会话建立成功,PPP认证成功:
[r1-Serial4/0/0]shutdown
[r1-Serial4/0/0]undo shutdown
在这里插入图片描述

3、R2与R5之间使用PPP的chap认证,R5为主认证方
[isp]aaa
[isp-aaa]local-user r2 password cipher 123456
Info: Add a new user.
[isp-aaa]local-user r2 service-type ppp

[isp]inter s3/0/1
[isp-Serial3/0/1]ppp authentication-mode chap

[r2-Serial4/0/0]ppp chap user r2
[r2-Serial4/0/0]ppp chap password cipher 123456

[r2-Serial4/0/0]shutdown
[r2-Serial4/0/0]undo shutdown
[r2-Serial4/0/0]ping 25.0.0.2
在这里插入图片描述

4、R3与R5之间使用HDLC封装
[r3]display interface Serial 4/0/0
在这里插入图片描述
因为R3的s4/0/0接口使用的PPP封装,所以要将PPP封装改为HDLC封装
[r3]inter s4/0/0
[r3-Serial4/0/0]link-protocol ?
fr Select FR as line protocol
hdlc Enable HDLC protocol
lapb LAPB(X.25 level 2 protocol)
ppp Point-to-Point protocol
sdlc SDLC(Synchronous Data Line Control) protocol
x25 X.25 protocol
[r3-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
但是此时会发现接口状态是down,因为R5的s4/0/0接口上没有启用相同的封装
[r3]display ip interface brief
在这里插入图片描述
[isp]inter s4/0/0
[isp-Serial4/0/0]li
[isp-Serial4/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
此时接口就是up状态了
在这里插入图片描述
在这里插入图片描述
5、R1/R2/R3构建一个MGRE环境,R1为中心站点;R1,R4间为点到点的GRE
1)中心站点配置:
建立隧道接口tunnel0/0/0
[r1]inter t0/0/0
[r1-Tunnel0/0/0]ip add 192.168.5.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre ?
p2mp Point to multi-point GRE mode
Please press ENTER to execute command
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
gre p2mp 代表选择MGRE封装
[r1-Tunnel0/0/0]source 15.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 100
network-id 100 : 创建NHRP域,所有加入这个NHRP域的私网都会向中心站点汇报隧道地址和出接口物理地址的对应关系。

中心站点可以收到分支的数据包,但是,分支不能收到中心站点的数据报—MGRE环境下不支持广播或者组播行为----在中心站点开启伪广播—分别给所有节点发送单播以达到广播的效果
[r1-Tunnel0/0/0]nhrp entry multicast dynamic —开启伪广播

2)分支站点进行配置:
[r2]int t0/0/0
[r2-Tunnel0/0/0]ip add 192.168.5.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source Serial 4/0/0
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 192.168.5.1 15.0.0.1 register—找中心站点进行注册(entry 加入 register 注册)
分支站点加入的NHRP域,必须和中心站点创建的域相同。
[r1]display nhrp peer all
在这里插入图片描述
[r3]inter t0/0/0
[r3-Tunnel0/0/0]ip add 192.168.5.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source s4/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
中心站点的: 隧道地址 物理地址
在这里插入图片描述

6、R1和R4之间为点到点的GRE
R1和R4之间建立虚拟的隧道地址:192.168.6.0/24
[r1]inter t0/0/1
[r1-Tunnel0/0/1]ip add 192.168.6.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre
[r1-Tunnel0/0/1]source 15.0.0.1
[r1-Tunnel0/0/1]destination 45.0.0.1

[r4]inter t0/0/0
[r4-Tunnel0/0/0]ip add 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre
[r4-Tunnel0/0/0]source 45.0.0.1
[r4-Tunnel0/0/0]destination 15.0.0.1

7、整个私有网络基于RIP全网可达
所有和公网连接的路由器都要运行RIP协议
所以R1、R2、R3、R4路由器上都要运行RIP协议
[r1]rip 1
[r1-rip-1]version 2
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 192.168.5.0
[r1-rip-1]network 192.168.6.0
只宣告连接的私网网段即可。

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

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

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

[r1]display ip routing-table protocol rip
在这里插入图片描述

在这里插入图片描述
开启伪广播后,分支站点只能收到中心站点的路由信息,却不能收到其他分支站点的路由信息。—RIP水平分割导致
[r1]inter t0/0/0
[r1-Tunnel0/0/0]undo rip sp
[r1-Tunnel0/0/0]undo rip split-horizon —关闭接口水平分割功能
在这里插入图片描述

8、所有PC设置私有IP为源IP,可以访问R5环回
PC1:
在这里插入图片描述
PC2:
在这里插入图片描述
PC3:
在这里插入图片描述
PC4:
在这里插入图片描述
想要访问公网就要做端口映射

[r1]acl 2000
[r1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[r1-acl-basic-2000]inter s4/0/0
[r1-Serial4/0/0]nat outbound 2000
PC>ping 5.5.5.5
在这里插入图片描述
[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[r2-acl-basic-2000]inter s4/0/0
[r2-Serial4/0/0]nat outbound 2000

[r3]acl 2000
[r3-acl-basic-2000]rule permit source 192.168.3.0 0.0.0.255
[r3-acl-basic-2000]inter s4/0/0
[r3-Serial4/0/0]nat outbound 2000

[r4]acl 2000
[r4-acl-basic-2000]rule permit source 192.168.4.0 0.0.0.255
[r4-acl-basic-2000]inter g0/0/0
[r4-GigabitEthernet0/0/0]nat outbound 2000

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值