拓扑图
配置IP
[r1]interface GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ip address 20.1.1.1 24
[r1-GigabitEthernet0/0/1]quit
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 30.1.1.1 24
[r1-GigabitEthernet0/0/0]quit
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 24
[r1-LoopBack0]quit
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 40.1.1.1 24
[r2-GigabitEthernet0/0/0]quit
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.2.1 24
[r2-LoopBack0]quit
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 50.1.1.1 24
[r3-GigabitEthernet0/0/0]quit
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.3.1 24
[r3-LoopBack0]quit
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 60.1.1.1 24
[r4-GigabitEthernet0/0/0]quit
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.4.1 24
[r4-LoopBack0]quit
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 70.1.1.1 24
[r5-GigabitEthernet0/0/0]quit
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.5.1 24
[r5-LoopBack0]quit
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip address 30.1.1.2 24
[r6-GigabitEthernet0/0/0]quit
[r6]interface GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/1]ip address 20.1.1.2 24
[r6-GigabitEthernet0/0/1]quit
[r6]interface GigabitEthernet 0/0/2
[r6-GigabitEthernet0/0/2]ip address 40.1.1.2 24
[r6-GigabitEthernet0/0/2]quit
[r6]interface GigabitEthernet 4/0/0
[r6-GigabitEthernet4/0/0]ip address 50.1.1.2 24
[r6-GigabitEthernet4/0/0]quit
[r6]interface GigabitEthernet 2/0/0
[r6-GigabitEthernet2/0/0]ip address 60.1.1.2 24
[r6-GigabitEthernet2/0/0]quit
[r6]interface GigabitEthernet 3/0/0
[r6-GigabitEthernet3/0/0]ip address 70.1.1.2 24
[r6-GigabitEthernet3/0/0]quit
[r6]interface LoopBack 0
[r6-LoopBack0]ip address 5.5.5.1 24
写缺省路由
[r1]ip route-static 0.0.0.0 0 20.1.1.2
[r1]ip route-static 0.0.0.0 0 30.1.1.2
[r2]ip route-static 0.0.0.0 0 40.1.1.2
[r3]ip route-static 0.0.0.0 0 50.1.1.2
[r4]ip route-static 0.0.0.0 0 60.1.1.2
[r5]ip route-static 0.0.0.0 0 70.1.1.2
R1/4/5建立全连MGRE
[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 20.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r4-Tunnel0/0/0]nhrp entry 192.168.6.1 20.1.1.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.5.1 70.1.1.1 register
[r4-Tunnel0/0/0]nhrp network-id 100
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 192.168.6.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r5-Tunnel0/0/0]nhrp entry 192.168.6.1 20.1.1.1 register
[r5-Tunnel0/0/0]nhrp entry 192.168.4.1 60.1.1.1 register
[r5-Tunnel0/0/0]nhrp network-id 100
R1/2/3为星型的拓扑结构,R1为中心站点,建立MGRE
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 30.1.1.1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp network-id 200
[r1-Tunnel0/0/1]undo rip split-horizon
[r2-Tunnel0/0/1]ip address 192.168.7.2 255.255.255.0
[r2-Tunnel0/0/1]tunnel-protocol gre p2mp
[r2-Tunnel0/0/1]source GigabitEthernet0/0/0
[r2-Tunnel0/0/1]nhrp network-id 200
[r2-Tunnel0/0/1]nhrp entry 192.168.7.1 30.1.1.1 register
[r3-Tunnel0/0/1]ip address 192.168.7.3 255.255.255.0
[r3-Tunnel0/0/1] tunnel-protocol gre p2mp
[r3-Tunnel0/0/1]source GigabitEthernet0/0/0
[r3-Tunnel0/0/1]nhrp entry 192.168.7.1 30.1.1.1 register
[r3-Tunnel0/0/1]nhrp network-id 200
R1/2/3中使用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.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.7.1 0.0.0.0
[r1-ospf-1-area-0.0.0.1]network 192.168.6.1 0.0.0.0
[r1-Tunnel0/0/1]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.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.7.2 0.0.0.0
[r2-Tunnel0/0/1]ospf network-type broadcast
[r2-Tunnel0/0/1]ospf dr-priority 0
[r3-ospf-1]area 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.7.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[r3-Tunnel0/0/1]ospf network-type broadcast
[r3-Tunnel0/0/1]ospf dr-priority 0
R1/4/5中使用OSPF协议使私有网段互通
[r1-ospf-1-area-0.0.0.1]network 192.168.6.1 0.0.0.0
[r1-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1-area-0.0.0.1]network 192.168.6.2 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 192.168.4.1 0.0.0.0
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]are 1
[r5-ospf-1-area-0.0.0.1]network 192.168.6.3 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.5.1 0.0.0.0
测试
R1pingR2
R1pingR3
R1pingR4
R1pingR5
R2pingR3
R2pingR4
R2pingR5
R4pingR5
R1的OSPF的路由表,邻居表
站点注册表