R1:
#0/0/0接口
[[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 12.0.0.2 24
[R1-GigabitEthernet0/0/1]q
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.1.1 24
[R1-LoopBack0]q
#0/0/1接口
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.168.1.1 24
[R1-GigabitEthernet0/0/0]q
R2:
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 60.0.0.2 24
[R2-GigabitEthernet0/0/0]q
[R2]interface LoopBack 0
[R2-LoopBack0]ip address 192.168.2.1 24
R3:
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 48.0.0.2 24
[R3-GigabitEthernet0/0/0]q
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 192.168.4.1 24
R4:
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 36.0.0.2 24
[R4-GigabitEthernet0/0/0]q
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 192.168.4.1 24
R5:
[R5]interface GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address 24.0.0.2 24
[R5-GigabitEthernet0/0/0]q
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 192.168.5.1 24
R6:
#0/0/0接口
[R6]interface GigabitEthernet 0/0/0
[R6-GigabitEthernet0/0/0]ip address 172.168.1.2 24
#0/0/1接口
[R6]interface GigabitEthernet 0/0/1
[R6-GigabitEthernet0/0/1]ip address 12.0.0.1 24
#0/0/2接口
[R6]interface GigabitEthernet 0/0/2
[R6-GigabitEthernet0/0/2]ip address 60.0.0.1 24
#4/0/0接口
[R6]interface GigabitEthernet 4/0/0
[R6-GigabitEthernet4/0/0]ip address 48.0.0.1 24
#4/0/1接口
[R6]interface GigabitEthernet 4/0/1
[R6-GigabitEthernet4/0/1]ip address 36.0.0.1 24
#4/0/2接口
[R6]interface GigabitEthernet 4/0/2
[R6-GigabitEthernet4/0/2]ip address 24.0.0.1 24
配置缺省路由到公网全网通
R1
[R1]ip route-static 0.0.0.0 0 12.0.0.1
[R1]ip route-static 0.0.0.0 0 172.168.1.2
R2
[R2]ip route-static 0.0.0.0 0 60.0.0.1
R3
[R3]ip route-static 0.0.0.0 0 48.0.0.1
R4
[R4]ip route-static 0.0.0.0 0 36.0.0.1
R5
[R5]ip route-static 0.0.0.0 0 24.0.0.1
R1/4/5为全连的MGRE结构,R1为中心站点。
R1
[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 12.0.0.1
[R1-Tunnel0/0/0]nhrp network-id 100
R4
[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 24.0.0.1
[R4-Tunnel0/0/0]nhrp entry 192.168.6.1 12.0.0.2 register
R5
[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 36.0.0.1
[R5-Tunnel0/0/0]nhrp entry 192.168.6.1 12.0.0.2 register
配置静态路由
R1
[R1]ip route-static 192.168.5.0 24 192.168.6.3
[R1]ip route-static 192.168.4.0 24 192.168.6.2
R4
[R4]ip route-static 192.168.1.0 24 192.168.6.1
[R4]ip route-static 192.168.5.0 24 192.168.6.3
R5
[R5]ip route-static 192.168.4.0 24 192.168.6.2
[R5]ip route-static 192.168.1.0 24 192.168.6.1
R1/2/3为星型的拓扑结构,R1为中心站点。
R1
[R1]ospf
[R1-ospf-1]ar
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net
[R1-ospf-1-area-0.0.0.0]network 172.168.1.1 0.0.0.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 12.0.0.2 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]q
[R1-Tunnel0/0/0]ospf network-type broadcast
[R1-Tunnel0/0/0]ospf dr-priority 10
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2]network 60.0.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.2]network 192.168.2.1 0.0.0.0
[R2-ospf-1-area-0.0.0.2]q
[R2-ospf-1]q
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ospf network-type p2mp
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]network 48.0.0.2 0.0.0.0
[R3-ospf-1-area-0.0.0.2]network 192.168.3.1 0.0.0.0
[R3-ospf-1-area-0.0.0.2]q
[R3-ospf-1]q
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf network-type p2mp