1、创建好网络拓扑,在R1~R5上配置好环回、接口的IP地址;R6是ISP只在上面配置好接口IP地址。
2、R1/R4/R5是全连的MGRE
首先对三台路由器进行中心配置
对R1
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.6.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 1.1.0.1
[r1-Tunnel0/0/0]nhrp network-id 100
对R5
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip add 192.168.6.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
r5-Tunnel0/0/0]source 5.4.0.1
[r5-Tunnel0/0/0]nhrp network-id 400
对R4
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.6.3 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 4.4.0.1
[r4-Tunnel0/0/0]nhrp network-id 500
再把每台路由器向另外两台路由器配置
对R1配置
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]source g 0/0/1
[r1-Tunnel0/0/0]nhrp network-id 400
[r1-Tunnel0/0/0]nhrp network-id 500
[r1-Tunnel0/0/0]nhrp entry 192.168.6.3 5.1.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.6.2 4.1.0.1 register
对R4配置
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]source g 0/0/0
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp network-id 500
[r4-Tunnel0/0/0]nhrp entry 192.168.6.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.6.2 register
对R5配置
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]source g 0/0/0
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp network-id 400
[r5-Tunnel0/0/0]nhrp entry 192.168.6.1 register
[r5-Tunnel0/0/0]nhrp entry 192.168.6.3 register
检查表发现已配置好
R1/R2/R3为星型拓扑
[r1]int Tunnel 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 6.6.0.1
[r1-Tunnel0/0/1]nhrp network-id 200
[r2]int Tunnel 0/0/1
[r2-Tunnel0/0/1]ip add 192.168.7.2 24
[r2-Tunnel0/0/1]tunnel-protocol gre p2mp
[r2-Tunnel0/0/1]source g 0/0/0
[r2-Tunnel0/0/1]nhrp network-id 200
[r2-Tunnel0/0/1]nhrp entry 192.168.7.1 6.6.0.1
[r3]int Tunnel 0/0/1
[r3-Tunnel0/0/1]ip add 192.168.7.3 24
[r3-Tunnel0/0/1]tunnel-protocol gre p2mp
[r3-Tunnel0/0/1]source g 0/0/0
[r3-Tunnel0/0/1]nhrp network-id 200
[r3-Tunnel0/0/1]nhrp entry 192.168.7.1 6.6.0.1
3、所有网段可以互通,私有网段使用 OSPF完成
[r1]ospf 1 r
[r1]ospf 1 router-id 2.2.2.2
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]net
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r2]ospf 1 r
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]net 192.168.7.0 0.0.0.0
[r3]os
[r3]ospf 1 r
[r3]ospf 1 router-id 2.2.2.2
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net 192.168.3.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 192.168.7.0 0.0.0.0
[r4]ospf 1 r
[r4]ospf 1 router-id 2.2.2.2
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]net 192.168.4.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]net 4.4.0.0 0.0.0.0
[r5]ospf 1 r [r5]ospf 1 router-id 2.2.2.2 [r5-ospf-1]area 0 [r5-ospf-1-area-0.0.0.0]net 192.168.5.1 0.0.0.0 [r5-ospf-1-area-0.0.0.0]net 5.5.0.0 0.0.0.0
将R1/R4/R5的接口改为Broadcast
[r1-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]ospf network-type broadcast