实验要求
R1、R3、R4建立全连的MGRE环境
R1、R5、R6建立MGRE环境,其中R1为中心
R1-R6均存在环回网络段模拟用户私网,使用OSPF使全网可达,其中R2为ISP路由器,仅配置IP地址
第一步:配置接口IP地址、公网IP地址。
对R1接口进行配置:
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add
[Huawei-GigabitEthernet0/0/0]ip address 12.0.0.1 24[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add
[Huawei-GigabitEthernet0/0/1]ip address 21.0.0.1 24
对R1创建环回网段---1.1.1.1/24:
[r1]interface LoopBack 0
[r1-LoopBack0]ip add
[r1-LoopBack0]ip address 1.1.1.1 24
对R3接口进行配置:
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip add
[r3-GigabitEthernet0/0/0]ip address 23.0.0.1 24
对R3创建环回网段---3.3.3.3/24:
[r3]interface loo
[r3]interface LoopBack 0
[r3-LoopBack0]ip add
[r3-LoopBack0]ip address 3.3.3.3 24
对R4接口进行配置:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add
[r4-GigabitEthernet0/0/0]ip address 24.0.0.1 24
对R4创建环回网段---4.4.4.4/24:
[r4]interface loo
[r4]interface LoopBack 0
[r4-LoopBack0]ip add
[r4-LoopBack0]ip address 4.4.4.4 24
对R5接口进行配置:
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip add
[r5-GigabitEthernet0/0/0]ip address 25.0.0.1 24
对R5创建环回网段---5.5.5.5/24:
[r5]interface loop
[r5]interface LoopBack 0
[r5-LoopBack0]ip add
[r5-LoopBack0]ip address 5.5.5.5 24
对R6接口进行配置:
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip add
[r6-GigabitEthernet0/0/0]ip address 26.0.0.1 24
对R6创建环回接口---6.6.6.6/24:
[r6]interface LoopBack 0
[r6-LoopBack0]ip add
[r6-LoopBack0]ip address 6.6.6.6 24
对R2运营商进行配置:
[ISP]interface GigabitEthernet 0/0/0
[ISP-GigabitEthernet0/0/0]ip add
[ISP-GigabitEthernet0/0/0]ip address 12.0.0.2 24
[ISP]interface GigabitEthernet 0/0/1
[ISP-GigabitEthernet0/0/1]ip ad
[ISP-GigabitEthernet0/0/1]ip address 21.0.0.2 24
[ISP]interface GigabitEthernet 0/0/2
[ISP-GigabitEthernet0/0/2]ip add
[ISP-GigabitEthernet0/0/2]ip address 23.0.0.2 24
[ISP]interface GigabitEthernet 4/0/0
[ISP-GigabitEthernet4/0/0]ip add
[ISP-GigabitEthernet4/0/0]ip address 24.0.0.2 24
[ISP]interface GigabitEthernet 4/0/1
[ISP-GigabitEthernet4/0/1]ip add
[ISP-GigabitEthernet4/0/1]ip address 25.0.0.2 24
[ISP]interface GigabitEthernet 4/0/2
[ISP-GigabitEthernet4/0/2]ip add
[ISP-GigabitEthernet4/0/2]ip address 26.0.0.2 24
对R1配置缺省路由:
[r1]ip route-static 0.0.0.0 0 12.0.0.2
[r1]ip route-static 0.0.0.0 0 21.0.0.2
对R3配置缺省路由:
[r3]ip route-static 0.0.0.0 0 23.0.0.2
对R4配置缺省路由:
[r4]ip route-static 0.0.0.0 0 24.0.0.2
对R5配置缺省路由:
[r5]ip route-static 0.0.0.0 0 25.0.0.2
对R6配置缺省路由:
[r6]ip route-static 0.0.0.0 0 26.0.0.2
随机测验公网是否配通:拿R6 ping R1
第二步:搭建全连的MGRE网络:
在r1上创建隧道:
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]shutdown
[r1-Tunnel0/0/0]source 12.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry 192.168.1.3 23.0.0.1 register[r1-Tunnel0/0/0]nhrp entry 192.168.1.4 24.0.0.1 register
在R3上创建隧道:
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]set
[r3-Tunnel0/0/0]shutdown
[r3-Tunnel0/0/0]source 23.0.0.1
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.1.1 12.0.0.1 register[r3-Tunnel0/0/0]nhrp entry 192.168.1.4 24.0.0.1 register
在R4上创建隧道:
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.1.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]s
[r4-Tunnel0/0/0]set
[r4-Tunnel0/0/0]shutdown
[r4-Tunnel0/0/0]source 24.0.0.1
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp entry 192.168.1.1 12.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.1.3 23.0.0.1 register
配完之后R1\R3\R4的情况:
第三步:用R1、R5、R6搭建hub-spoke的MGRE网络
对R1上建立隧道:
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 192.168.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]s
[r1-Tunnel0/0/1]set
[r1-Tunnel0/0/1]shutdown
[r1-Tunnel0/0/1]source 21.0.0.1
[r1-Tunnel0/0/1]nhrp network-id 100
对R5上建立隧道:
[r5]interface Tunnel 0/0/1
[r5-Tunnel0/0/1]ip address 192.168.2.2 24
[r5-Tunnel0/0/1]tunnel-protocol gre p2mp
[r5-Tunnel0/0/1]s
[r5-Tunnel0/0/1]set
[r5-Tunnel0/0/1]shutdown
[r5-Tunnel0/0/1]source 25.0.0.1
[r5-Tunnel0/0/1]nhrp network-id 100
[r5-Tunnel0/0/1]nhrp entry 192.168.2.1 21.0.0.1 register
对r6上建立隧道:
[r6]interface Tunnel 0/0/1
[r6-Tunnel0/0/1]ip address 192.168.2.3 24
[r6-Tunnel0/0/1]tunnel-protocol gre p2mp
[r6-Tunnel0/0/1]s
[r6-Tunnel0/0/1]set
[r6-Tunnel0/0/1]shutdown
[r6-Tunnel0/0/1]source 26.0.0.1
[r6-Tunnel0/0/1]nhrp network-id 100
[r6-Tunnel0/0/1]nhrp entry 192.168.2.1 21.0.0.1 register
第四步:搭建OSPF网络环境:
在R1上运行OSPF协议并宣告1.1.1.1和192.168.1.0和192.168.2.0网段
[r1]ospf 1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.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.2.0 0.0.0.255
在R3上运行OSPF协议并宣告3.3.3.3和192.168.1.0网段:
[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]netw
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
在R4上运行OSPF协议并宣告4.4.4.4和192.168.1.0网段:
[r4]ospf 1
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]netw
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
在R5上运行OSPF协议并宣告5.5.5.5和192.168.2.0网段:
[r5]ospf 1
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]netw
[r5-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
在R6上运行OSPF协议并宣告6.6.6.6和192.168.2.0网段:
[r6]ospf 1
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
在中心上开启伪广播(在R1上开启):
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]q
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
在R3/R4/R5/R6上分别开启伪广播:
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/1]nhrp entry multicast dynamic
[r6-Tunnel0/0/1]nhrp entry multicast dynamic
在R1上查看:
在R3上查看:
修改R1的网络接口类型:
[r1-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]ospf network-type broadcast
建邻查看效果:
修改R1的tunnel 0/0/1 网络接口类型:
[r1-Tunnel0/0/1]ospf network-type p2mp
R5/R6同理:
[r5-Tunnel0/0/1]ospf network-type p2mp
[r6-Tunnel0/0/1]ospf network-type p2mp
r1的效果: