要求:
1、左边三台设备配置OSPF 10,区域0;2、右边为OSPF 1 中间是Area0,下挂Area1和Area2.
2、两个进程之间有ISP设备,需要访问公网
3、OSPF 1区域零中,中心设备不启动动态路由协议,配置MGRE
如图:
配置IP地址,环回
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 123.1.1.1 24
[r1-GigabitEthernet0/0/0]int l 0
[r1-LoopBack0]ip add 1.1.1.1 32
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 123.1.1.2 24
[r2-GigabitEthernet0/0/0]int l 0
[r2-LoopBack0]ip add 2.2.2.2 32
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 123.1.1.3 24
[r3-GigabitEthernet0/0/0]int l 0
[r3-LoopBack0]ip add 3.3.3.3 32
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 34.0.0.4 24
[ISP-GigabitEthernet0/0/0]int g 0/0/1
[ISP-GigabitEthernet0/0/1]ip add 45.0.0.4 24
[ISP-GigabitEthernet0/0/1]int l0
[ISP-LoopBack0]ip add 4.4.4.4 32
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.0.0.5 24
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 56.0.0.5 24
[r5-GigabitEthernet0/0/1]int l0
[r5-LoopBack0]ip add 5.5.5.5 32
[r6]int g 0/0/1
[r6-GigabitEthernet0/0/1]ip add 56.0.0.6 24
[r6-GigabitEthernet0/0/1]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 67.0.0.6 24
[r6-GigabitEthernet0/0/0]int l0
[r6-LoopBack0]ip add 6.6.6.6 32
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]ip add 67.0.0.7 24
[r7-GigabitEthernet0/0/0]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip add 78.0.0.7 24
[r7-GigabitEthernet0/0/1]int g 0/0/2
[r7-GigabitEthernet0/0/2]ip add 117.0.0.7 24
[r7-GigabitEthernet0/0/2]int g 4/0/0
[r7-GigabitEthernet4/0/0]ip add 107.0.0.7 24
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ip add 78.0.0.8 24
[r8-GigabitEthernet0/0/0]int g 0/0/1
[r8-GigabitEthernet0/0/1]ip add 89.0.0.8 24
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ip add 8.8.8.8 32
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ip add 89.0.0.9 24
[r9-GigabitEthernet0/0/0]int l0
[r9-LoopBack0]ip add 9.9.9.9 32
[r10-GigabitEthernet0/0/1]int g 0/0/1
[r10-GigabitEthernet0/0/1]ip add 107.0.0.10 24
[r10-GigabitEthernet0/0/1]int g 0/0/0
[r10-GigabitEthernet0/0/0]ip add 110.0.0.10 24
[r10-GigabitEthernet0/0/0]int l0
[r10-LoopBack0]ip add 10.10.10.10 32
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ip add 110.0.0.11 24
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ip add 114.0.0.11 24
[r11-GigabitEthernet0/0/1]int l0
[r11-LoopBack0]ip add 11.11.11.11 32
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ip add 117.0.0.12 24
[r12-GigabitEthernet0/0/0]int g 0/0/1
[r12-GigabitEthernet0/0/1]ip add 112.0.0.12 24
[r12-GigabitEthernet0/0/1]int l0
[r12-LoopBack0]ip add 12.12.12.12 32
[r13]int g0/0/0
[r13-GigabitEthernet0/0/0]ip ad
[r13-GigabitEthernet0/0/0]ip address 112.0.0.13 24
[r13-GigabitEthernet0/0/0]int g 0/0/1
[r13-GigabitEthernet0/0/1]ip add 136.0.0.12 24
[r13-GigabitEthernet0/0/1]int l0
[r13-LoopBack0]ip add 13.13.13.13 32
[r14]int g 0/0/0
[r14-GigabitEthernet0/0/0]ip add 114.0.0.14 24
[r14-GigabitEthernet0/0/0]int g 0/0/1
[r14-GigabitEthernet0/0/1]ip add 145.0.0.14 24
[r14-GigabitEthernet0/0/1]int l0
[r14-LoopBack0]ip add 14.14.14.14 32
[r15]int g0/0/0
[r15-GigabitEthernet0/0/0]ip add 145.0.0.15 24
[r15-GigabitEthernet0/0/0]int l0
[r15-LoopBack0]ip add 15.15.15.15 32
[r16]int g 0/0/0
[r16-GigabitEthernet0/0/0]ip add 136.0.0.16 24
[r16-GigabitEthernet0/0/0]int l0
[r16-LoopBack0]ip add 16.16.16.16 32
测试ping通
起OSPF,起GRE建立tunnel隧道,配置静态路由等
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]a 0
[r1-ospf-1-area-0.0.0.0]network 123.1.1.1 0.0.0.0 //精准宣告
network 0.0.0.0 255.255.255.255 //单次宣告
[r2]ospf router-id 2.2.2.2
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]net
[r2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r3]ospf 1 rou 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]network 123.1.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[r3]ip route-static 0.0.0.0 0 34.0.0.4
[r3-ospf-1]default-route-advertise
[r3]acl 2000
[r3-acl-basic-2000]rule permit source any
[r3]int g 0/0/1
[r3-GigabitEthernet0/0/1]nat outbound 2000
[r5]acl 2000
[r5-acl-basic-2000]rule permit source any
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]nat outbound 2000
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ip add 10.0.0.6 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 67.0.0.6
[r6-Tunnel0/0/0]nhrp entry multicast dynamic
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ip add 10.0.0.8 24
[r8-Tunnel0/0/0]tunnel-protocol gre p2mp
[r8-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r8-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.6 register
[r10]int t 0/0/0
[r10-Tunnel0/0/0]ip add 10.0.0.10 24
[r10-Tunnel0/0/0]tunnel-protocol gre p2mp
[r10-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r10-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.6 register
[r12]int t 0/0/0
[r12-Tunnel0/0/0]ip add 10.0.0.12 24
[r12-Tunnel0/0/0]tunnel-protocol gre p2mp
[r12-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r12-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.6 register
[r6]ip route-static 78.0.0.0 24 67.0.0.7
[r6]ip route-static 107.0.0.0 24 67.0.0.7
[r6]ip route-static 117.0.0.0 24 67.0.0.7
[r8]ip route-static 67.0.0.0 24 78.0.0.7
[r8]ip route-static 107.0.0.0 24 78.0.0.7
[r8]ip route-static 117.0.0.0 24 78.0.0.7
[r10]ip route-static 67.0.0.0 24 107.0.0.7
[r10]ip route-static 78.0.0.0 24 107.0.0.7
[r10]ip route-static 117.0.0.0 24 107.0.0.7
[r12]ip route-static 67.0.0.0 24 117.0.0.7
[r12]ip route-static 78.0.0.0 24 117.0.0.7
[r12]ip route-static 107.0.0.0 24 117.0.0.7
[r5]ospf router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 56.0.0.5 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r6]ospf router-id 6.6.6.6
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 56.0.0.6 0.0.0.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 10.0.0.6 0.0.0.0
[r8]ospf router-id 8.8.8.8
[r8-ospf-1]a 0
[r8-ospf-1-area-0.0.0.0]network 10.0.0.8 0.0.0.0
[r8-ospf-1-area-0.0.0.0]network 89.0.0.8 0.0.0.0
[r8-ospf-1-area-0.0.0.0]network 8.8.8.8 0.0.0.0
[r9]ospf router-id 9.9.9.9
[r9-ospf-1]a 0
[r9-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r10]ospf r
[r10]ospf router-id 10.10.10.10
[r10-ospf-1]a 0
[r10-ospf-1-area-0.0.0.0]network 110.0.0.10 0.0.0.0
[r10-ospf-1-area-0.0.0.0]network 10.10.10.10 0.0.0.0
[r10-ospf-1-area-0.0.0.0]network 10.0.0.10 0.0.0.0
[r11]ospf router-id 11.11.11.11
[r11-ospf-1]a 0
[r11-ospf-1-area-0.0.0.0]network 110.0.0.11 0.0.0.0
[r11-ospf-1-area-0.0.0.0]networnetwork 11.11.11.11 0.0.0.0
[r11-ospf-1]a 1
[r11-ospf-1-area-0.0.0.1]network 114.0.0.11 0.0.0.0
[r12]ospf router-id 12.12.12.12
[r12-ospf-1]a 0
[r12-ospf-1-area-0.0.0.0]network 10.0.0.12 0.0.0.0
[r12-ospf-1-area-0.0.0.0]network 12.12.12.12 0.0.0.0
[r12-ospf-1-area-0.0.0.0]network 112.0.0.12 0.0.0.0
[r13]ospf router-id 13.13.13.13
[r13-ospf-1]a 0
[r13-ospf-1-area-0.0.0.0]network 112.0.0.13 0.0.0.0
[r13-ospf-1-area-0.0.0.0]network 13.13.13.13 0.0.0.0
[r13-ospf-1]a 2
[r13-ospf-1-area-0.0.0.2]network 136.0.0.13 0.0.0.0
[r14]ospf router-id 14.14.14.14
[r14-ospf-1]a 1
[r14-ospf-1-area-0.0.0.1]network 114.0.0.14 0.0.0.0
[r14-ospf-1-area-0.0.0.1]network 145.0.0.14 0.0.0.0
[r14-ospf-1-area-0.0.0.1]network 14.14.14.14 0.0.0.0
[r15]ospf router-id 15.15.15.15
[r15-ospf-1]a 1
[r15-ospf-1-area-0.0.0.1]network 0.0.0.0 255.255.255.255
[r16]ospf router-id 16.16.16.16
[r16-ospf-1]a 2
[r16-ospf-1-area-0.0.0.2]network 0.0.0.0 255.255.255.255
查看建邻情况,并更改接口类型
[r6]int t 0/0/0
[r6-Tunnel0/o/0]ospf network-type p2mp
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ospf network-type p2mp
[r10]int t 0/0/0
[r10-Tunnel0/0/0]ospf network-type p2mp
[r12]int t 0/0/0
[r12-Tunnel0/0/0]ospf network-type p2mp
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ospf timer hello 10
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ospf timer hello 10
[r10]int t 0/0/0
[r10-Tunnel0/0/0]ospf timer hello 10
[r12]int t 0/0/0
[r12-Tunnel0/0/0]ospf timer hello 10
[r5]ip route-static 0.0.0.0 0 45.0.0.4
[r5]ospf 1
[r5-ospf-1]default-route-advertise
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre
[r3-Tunnel0/0/0]soure 34.0.0.3
[r3-Tunnel0/0/0]destination 45.0.0.5
[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip a 10.1.1.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre
[r5-Tunnel0/0/0]source 45.0.0.5
[r5-Tunnel0/0/0]destination 34.0.0.3