1.R1-R3-R4构建全连的MGRE环境
2.R1-R5-R6建立hub-spoke的MGRE环境,其中R1为中心
3.R1-R3…R6均存在环回网段模拟用户私网,使用OSPF使全网可达
4.其中R2为ISP路由器,仅配置IP地址
网络拓扑
注意事项:图中所有路由器都为AR3260设备,其中AR6需要加装一块4GEW-T的接口
IP地址的区域划分
具体如网络拓扑图所示,其中AR6为网络运营商其端口IP地址均为xx.x.x.2/24,其余路由端口均为192.168.x.1/24,全连的MGRE结构使用的是192.168.6.0/24网段,星型的MGRE结构使用的是192.168.7.0/24网段
设备配置
R1
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 60.6.6.1 24
[R1-GigabitEthernet0/0/1]q
[R1]ip route-static 0.0.0.0 0 60.6.6.2 # 建立缺省
[R1]ip route-static 0.0.0.0 0 10.1.1.2
[R1]interface LoopBack 0 # 建立环回
[R1-LoopBack0]ip address 192.168.1.1 24
[R1]interface Tunnel 0/0/0 # 搭建隧道
[R1-Tunnel0/0/0]ip address 192.168.6.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 10.1.1.1
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]nhrp entry multicast dynamic #既为中心
[R1-Tunnel0/0/0]nhrp entry 192.168.5.2 50.5.5.1 register #也为分支
[R1-Tunnel0/0/0]nhrp entry 192.168.4.2 40.4.4.1 register
R6
R5
R4,R3,R2同样操作可得
星型MGRE R1,R2,R3
[R1]in g0/0/0
[R1-GigabitEthernet0/0/0]ip ad
[R1-GigabitEthernet0/0/0]ip address 10.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]in tu0/0/1
[R1-Tunnel0/0/1]ip address 192.168.3.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]source 10.1.1.1
[R1-Tunnel0/0/1]nhrp entry multicast dynamic
[R1-Tunnel0/0/1]nhrp network-id 200
[R2]interface g0/0/0
[R2-GigabitEthernet0/0/0]ip address 20.2.2.1 24
[R2]ip route-static 0.0.0.0 0 20.2.2.2
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 2.2.2.2 24
[R2-LoopBack0]q
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ip address 192.168.3.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source 20.2.2.1
[R2-Tunnel0/0/0]nhrp network-id 200
[R2-Tunnel0/0/0]nhrp entry 192.168.3.1 20.2.2.1 register
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 192.168.3.3 24
[R3-LoopBack0]q
[R3]ip route-static 0.0.0.0 0 30.3.3.2
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 30.3.3.1 24
[R3-GigabitEthernet0/0/0]q.
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 3.3.3.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 20.2.2.1
[R3-Tunnel0/0/0]nhrp network-id 200
[R3-Tunnel0/0/0]nhrp entry 192.168.3.1 10.1.1.1 register
[R3-Tunnel0/0/0]q
设备配置-ospf
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]in tu0/0/0
[R1-Tunnel0/0/0]ospf network-type broadcast
[R1-Tunnel0/0/0]in tu0/0/1
[R1-Tunnel0/0/1]ospf network-type p2mp
[R1-Tunnel0/0/1]q.
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]in tu0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]in tu0/0/0
[R4-Tunnel0/0/0]ospf network-type broadcast
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]in tu0/0/0
[R2-Tunnel0/0/0]ospf network-type p2mp
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]in tu0/0/0
[R3-Tunnel0/0/0]ospf network-type p2mp
结果验证
用R1环回地址pingR5和R2,然后结束实验