一:实验要求
1、R1-R3-R4构建全连的MGRE环境
2、R1-R5-R6建立hub-spoke的MGRE环境,其中r1为中心
3、R1-R3.....R6均存在环回段模拟用户私网,使用OSPF使全网可达,其中R2为ISP路由器,仅配
置IP地址
二:实验拓扑
三:实验步骤
1、配置IP地址及环回地址
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 16.0.0.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 116.0.0.1 24
[r1-GigabitEthernet0/0/1]int loopB 0
[r1-LoopBack0]ip add 192.168.1.1 24
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 56.0.0.1 24
[r3-GigabitEthernet0/0/0]int loop 0
[r3-LoopBack0]ip add 192.168.3.1 24
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 46.0.0.1 24
[r4-GigabitEthernet0/0/0]int loop 0
[r4-LoopBack0]ip add 192.168.4.1 24
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 36.0.0.1 24
[r5-GigabitEthernet0/0/0]int loop 0
[r5-LoopBack0]ip add 192.168.5.1 24
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 26.0.0.1 24
[r6-GigabitEthernet0/0/0]int loop 0
[r6-LoopBack0]ip add 192.168.6.1 24
[ISP]int loop 0
[ISP-LoopBack0]ip add 6.6.6.6 24
[ISP-GigabitEthernet0/0/1]ip add 116.0.0.2 24
[ISP-GigabitEthernet0/0/0]ip add 16.0.0.2 24
[ISP-GigabitEthernet4/0/2]ip add 26.0.0.2 24
[ISP-GigabitEthernet4/0/1]ip add 36.0.0.2 24
[ISP-GigabitEthernet4/0/0]ip add 46.0.0.2 24
[ISP-GigabitEthernet0/0/2]ip add 56.0.0.2 24
2、配置缺省路由,实现全公网通
检查是否可以ping通
3、R1-R3-R4构建全连的MGRE环境
[r1]int T 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry 192.168.2.2 46.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.2.3 56.0.0.1 register
[r4]int T 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.2.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.0.0.1
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp entry 192.168.2.1 16.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.2.3 56.0.0.1 register
[r3]int T 0/0/0
[r3-Tunnel0/0/0]ip add 192.168.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 56.0.0.1
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.2.1 16.0.0.1 register
[r3-Tunnel0/0/0]nhrp entry 192.168.2.2 46.0.0.1 register
检查配置是否成功
4、R1-R5-R6建立hub-spoke的MGRE环境,其中r1为中心
[r1]int T 0/0/1
[r1-Tunnel0/0/1]ip add 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 116.0.0.1
[r1-Tunnel0/0/1]nhrp network-id 100
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r5]int T 0/0/1
[r5-Tunnel0/0/1]ip add 192.168.7.2 24
[r5-Tunnel0/0/1]tunnel-protocol gre p2mp
[r5-Tunnel0/0/1]nhrp network-id 100
[r5-Tunnel0/0/1]source GigabitEthernet 0/0/0
[r5-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1 register
[r6]int T 0/0/1
[r6-Tunnel0/0/1]ip add 192.168.7.3 24
[r6-Tunnel0/0/1]tunnel-protocol gre p2mp
[r6-Tunnel0/0/1]source GigabitEthernet 0/0/0
[r6-Tunnel0/0/1]nhrp network-id 100
[r6-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1 register
检查配置是否成功
5、配置ospf,实现私网通
检查是否ping通
ping不通,原因是因为跟MGRE环境下接口的网络类型有关,它是以P2P的工作方式进行的,P2P
是点到点的工作方式,且P2P是不需要进行DR/BDR的选举的,它只能建立一个邻居,所以我们需
要更改网络类型为breadcast。
6、更改网络类型
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast
[r1-Tunnel0/0/1]ospf network-type broadcast
[r3]int t0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
[r4]int t0/0/0
[r4-Tunnel0/0/0]ospf network-type broadcast
[r5]int t0/0/1
[r5-Tunnel0/0/1]ospf network-type broadcast
[r6]int t0/0/1
[r6-Tunnel0/0/1]ospf network-type broadcast
7、修改R5和R6的参选接口优先级,使他们放弃选举,避免R5和R6产生分歧
[r6-Tunnel0/0/1]ospf dr-priority 0
[r5-Tunnel0/0/1]ospf dr-priority 0
四:实验测试