目录
1.4 .R1、R2、R3构建一个MGRE环境 ,R1为中心站点
实验要求:
- R5为ISP,只能进行IP地址配置,其所有地址均配为公有IP地址
- R1和R5间使用PPP的PAP认证,R5为主认证
- R2与R5之间使用ppp的CHAP认证,R5为主认证方
- R3与R5之间使用HDLC封装
- R1.R2、R3构建一个MGRE环境,R1为中心站点,R1、R4间为点到点的GRE
- R1整个私有网络基本RIP全网可达
- 所有PC设置私有IP为源IP,可以访问R5环回
实验过程:
1.1 搭建拓扑、IP地址的规划
1.1.2地址命令配置
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int s 4/0/0
[R1-Serial4/0/0]ip add 15.0.0.1 24
[R2]INT G 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[R2-GigabitEthernet0/0/0]int s 4/0/0
[R2-Serial4/0/0]ip add 25.0.0.1 24
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[R3-GigabitEthernet0/0/0]int s 4/0/0
[R3-Serial4/0/0]ip add 35.0.0.1 24
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 45.0.0.1 24
[R4-GigabitEthernet0/0/0]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[R5]int s 3/0/0
[R5-Serial3/0/0]ip add 15.0.0.2 24
[R5-Serial3/0/0]int s 3/0/1
[R5-Serial3/0/1]ip add 25.0.0.2 24
[R5-Serial3/0/1]int s 4/0/0
[R5-Serial4/0/0]ip add 35.0.0.2 24
[R5-Serial4/0/0]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.0.0.2 24
[R5-GigabitEthernet0/0/0]q
[R5]int l 0
[R5-LoopBack0]ip add 5.5.5.5 24
1.1.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
1.2 NAT配置
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255 -----通配符
[R1]int s 4/0/0
[R1-Serial4/0/0]nat outbound 2000 ------调用
[R2]ACL 2000
[R2-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R1]int s 4/0/0
[R2-acl-basic-2000]q
[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
[R1]int s 4/0/0
[R3-acl-basic-2000]q
[R3]int s 4/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
[R1]int s 4/0/0
[R4-acl-basic-2000]q
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
1.3 PPP认证与HDlC的封装
1.3.1 R1和R5使用PAP认证
认证方配置
[R5]aaa # 进入aaa模式
[R5-aaa]local-user huawei password cipher 123456 # 创建用户信息
[R5-aaa]local-user huawei service-type ppp # 规定服务协议
[R5-Serial3/0/0]ppp authentication-mode pap # 规定该串口的认证模式为PAP
被认证方配置
[R1-Serial4/0/0]ppp pap local-user huawei password cipher 123456
[R5]shoutdown
关闭重启激活认证
[R5]undo shoutdown
1.3.2 R2和R5使用chap认证
认证方配置
[R5]aaa
[R5-aaa]local-user yangjunjie password cipher 123456
---------------使用之前的用户信息也可以
[R5-aaa]local-user huawie service-type ppp
[R5-Serial3/0/1]ppp authentication-mode chap
被认证方配置
[R2]int s 4/0/0
[R2-Serial4/0/0]ppp chap user huawie
[R2-Serial4/0/0]ppp chap password cipher 123456
1.3.3 R3和R5使用HDlC的封装
[R5]interface Serial 4/0/0
[R5-Serial4/0/0]link-protocol hdlc
[R3]int Serial 4/0/0
[R3-Serial4/0/0]link-protocol hdlc
1.4 .R1、R2、R3构建一个MGRE环境 ,R1为中心站点
1.4.1 中心站点AR1配置
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 15.0.0.1
[R1-Tunnel0/0/0]nhrp network-id 100 创建nhrp域
1.4.2 分支站点AR2配置
[R2]int t 0/0/0
[R2-Tunnel0/0/0]ip add 10.0.0.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source S4/0/0
[R2-Tunnel0/0/0]nhrp network-id 100 将其增加到创建的nhrp域
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 15.0.0.1 register
# 隧道地址 物理地址 注册
1.4.3 分支站点AR3配置
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.1.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source s 4/0/0
[R3-Tunnel0/0/0]nhrp network-id 100 将其增加到创建的nhrp域
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 15.0.0.1 register
1.4.4 MGRE环境下配置RIP
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]undo summary
----关闭自动汇总功能,如果不关闭,宣告的属于同一个主类的路由就会
自动汇总;该功能在华为上不需要配置,因为华为默认关闭自动汇总功能。
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
注意:MGRE环境下配置RIP的中心站点,需要开启伪广播和关闭水平分割
[R1]int t 0/0/0
[R1-Tunnel0/0/0]nhrp entry multicast dynamic #开启伪广播域
[R1-Tunnel0/0/0]undo rip split-horizon #关闭水平分割
查看nhrp表
[R1]display nhrp peer all
1.5 R1、R4构建GRE
1.5.1 AR1 配置
[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add 10.1.2.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
1.5.2 AR4 配置
[R4]int t 0/0/1
[R4-Tunnel0/0/1]ip add 10.1.2.2 24
[R4-Tunnel0/0/1]tunnel-protocol gre
[R4-Tunnel0/0/1]source 45.0.0.1
[R4-Tunnel0/0/1]destination 15.0.0.1
1.5. GRE环境下配置RIP
此时R1设备不用进行RIP协议操作,因为在MGRE下已经配置了RIP协议,并且宣告了10.0.0.0网段,这个网段已经包含了10.1.2.0这个网段
[R4]rip 1
[R4-rip-1]version 2
[R4-rip-1]network 10.0.0.0
[R4-rip-1]network 192.168.4.0
查看nhrp表
[R1]display nhrp peer all
测试:
PC1 ping PC2、PC3、PC4、