要求:
1.R4为ISP,其上只能配置IP地址;
R4与其他所有直连设备间均使用公有IP;
2.R3-R5/6/7为MGRE环境,R3为中心站点;
3.整个OSPF环境IP基于172.16.0.0/16划分;
4.所有设备均可访问R4的环回;
5.减少LSA的更新量,加快收效,保障更新安全;
6.全网可达。
步骤一:划分网段
172.16.0.0/17-------OSPF
172.16.128.0/17-----RIP
172.16.0.0/20-------area 0
172.16.0.0/24---R5
172.16.1.0/24---R6
172.16.2.0/24---R7
172.16.3.0/24
172.16.16.0/20------area 1
172.16.16.0/24---骨干
172.16.17.0/24---r1
172.16.18.0/24---r2
172.16.18.0/24---r3
172.16.32.0/20------area 2
172.16.32.0/24---r11
172.16.48.0/20------area 3
172.16.48.0/24---r8
172.16.64.0/24---r9
172.16.64.0/20------area 4
172.16.65.0/24---r10
步骤二:配置IP地址
Area 1
R1
[r1-GigabitEthernet0/0/0]ip add 172.16.19.1 29
[r1]int l0
[r1-LoopBack0]ip add 172.16.16.1 24
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 172.16.16.1 0.0.0.0
[r1-ospf-1-area-0.0.0.1]network 172.16.19.1 0.0.0.0
R2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.19.2 29
[r2]int l0
[r2-LoopBack0]ip add 172.16.17.1 24
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 172.16.17.1 0.0.0.0
[r2-ospf-1-area-0.0.0.1]network 172.16.19.2 0.0.0.0
R3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.19.3 29
[r3]int l0
[r3-LoopBack0]ip add 172.16.18.1 24
[r3]ospf 1 rou
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]network 172.16.19.3 0.0.0.0
[r3-ospf-1-area-0.0.0.1]network 172.16.18.1 0.0.0.0
Area 0
R3
[r3]int s4/0/0
[r3-Serial4/0/0]ip add 43.0.0.3 24
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 43.0.0.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.0
R4---ISP
[r4-isp]int s4/0/0
[r4-isp-Serial4/0/0]ip add 43.0.0.4 24
[r4-isp]int s3/0/0
[r4-isp-Serial3/0/0]ip add 45.0.0.4 24
[r4-isp]int s3/0/1
[r4-isp-Serial3/0/1]ip add 46.0.0.4 24
[r4-isp]int g0/0/2
[r4-isp-GigabitEthernet0/0/2]ip add 47.0.0.4 24
[r4-isp]ospf 1 router-id 4.4.4.4
[r4-isp-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
R5
[r5]int s4/0/0
[r5-Serial4/0/0]ip add 45.0.0.5 24
[r5-Serial4/0/0]q
[r5]int l0
[r5-LoopBack0]ip add 172.16.1.1 24
[r5-LoopBack0]q
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 45.0.0.5 0.0.0.0
R6
[r6]int s4/0/0
[r6-Serial4/0/0]ip add 46.0.0.6 24
[r6]int l0
[r6-LoopBack0]ip add 172.16.2.1 24
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 46.0.0.6 0.0.0.0
R7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[r7]int l0
[r7-LoopBack0]ip add 172.16.3.1 24
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 47.0.0.7 0.0.0.0
配置缺省路由
[r3]ip route-static 0.0.0.0 0 43.0.0.4
[r5]ip route-static 0.0.0.0 0 45.0.0.4[r6]ip route-static 0.0.0.0 0 46.0.0.4
[r7]ip route-static 0.0.0.0 0 47.0.0.4
Area 2
R6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.33.1 30
[r6-GigabitEthernet0/0/0]q
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]network 172.16.33.1 0.0.0.0
R11
[r11]int g0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.33.2 30
[r11-GigabitEthernet0/0/0]q
[r11]int g0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.33.5 30
[r11-GigabitEthernet0/0/1]q
[r11]int l0
[r11-LoopBack0]ip add 172.16.32.1 24
[r11-LoopBack0]q
[r11]ospf 1 router-id 11.11.11.11
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]network 172.16.32.1 0.0.0.0
[r11-ospf-1-area-0.0.0.2]network 172.16.33.2 0.0.0.0
[r11-ospf-1-area-0.0.0.2]network 172.16.33.2 0.0.0.0
R12
[r12]int g0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.33.6 30
[r12-GigabitEthernet0/0/0]q
[r12]ospf 1
[r12-ospf-1]q
[r12]ospf 1 router-id 12.12.12.12
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]network 172.16.33.6 0.0.0.0
Area 3
R7
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.49.1 30
[r7-GigabitEthernet0/0/1]q
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 3
[r7-ospf-1-area-0.0.0.3]network 172.16.49.1 0.0.0.0
R8
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.49.2 30
[r8]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.49.5 30[r8]int l0
[r8-LoopBack0]ip add 172.16.48.1 24
[r8]ospf 1 router-id 8.8.8.8
[r8-ospf-1]area 3
[r8-ospf-1-area-0.0.0.3]network 172.16.49.5 0.0.0.0
[r8-ospf-1-area-0.0.0.3]network 172.16.49.2 0.0.0.0
[r8-ospf-1-area-0.0.0.3]network 172.16.48.1 0.0.0.0
Area 4
R9
[r9]int g0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.49.6 30
[r9-GigabitEthernet0/0/0]q
[r9]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.66.1 30
[r9-GigabitEthernet0/0/1]q
[r9]int l0
[r9-LoopBack0]ip add 172.16.64.1 24
[r9-LoopBack0]ospf network-type broadcast
R10
[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.66.2 30
[r10-GigabitEthernet0/0/0]q
[r10]int l0
[r10-LoopBack0]ip add 172.16.65.1 24
[r10-LoopBack0]ospf network-type broadcast
步骤三:配置MGRE
R3
[r3]int t0/0/0
[r3-Tunnel0/0/0]ip add 172.16.0.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source Serial 4/0/0
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r3-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]nhrp redirect
R5
[r5]int t0/0/0
[r5-Tunnel0/0/0]ip add 172.16.0.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source Serial 4/0/0
[r5-Tunnel0/0/0]nhrp entry 172.16.0.3 43.0.0.3 register
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]ospf dr-priority 0
[r5-Tunnel0/0/0]nhrp shortcut
R6
[r6]int t0/0/0
[r6-Tunnel0/0/0]ip add 172.16.0.6 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source Serial 4/0/0
[r6-Tunnel0/0/0]nhrp entry 172.16.0.3 43.0.0.3 register
[r6-Tunnel0/0/0]ospf network-type broadcast
[r6-Tunnel0/0/0]ospf dr-priority 0
R7
[r7]int t0/0/0
[r7-Tunnel0/0/0]ip add 172.16.0.7 24
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp
[r7-Tunnel0/0/0]source g0/0/0
[r7-Tunnel0/0/0]nhrp entry 172.16.0.3 43.0.0.3 register
[r7-Tunnel0/0/0]ospf network-type broadcast
[r7-Tunnel0/0/0]ospf dr-priority 0
查看nhrp映射表
加快收敛
[R7-Tunnel0/0/0]ospf timer hello 10
[R3-Tunnel0/0/0]ospf timer hello 10
[R5-Tunnel0/0/0]ospf timer hello 10
[R6-Tunnel0/0/0]ospf timer hello 10
划分特殊区域,减少LSA更新量
1.Totally Stub:Aarea1
[r3]ospf 1
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]stub no-summary
[r2]ospf 1
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]stub
[r1]ospf 1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]stub
2.Totally NSSA:Area2
[r6]ospf 1
[r6-ospf-1]area 2
[r6-ospf-1-area-0.0.0.2]nssa
[r11]ospf 1
[r11-ospf-1]area 2
[r11-ospf-1-area-0.0.0.2]nssa
[r12]ospf 1
[r12-ospf-1]area 2
[r12-ospf-1-area-0.0.0.2]nssa
3.Totally NSSA:Area 3
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8-ospf-1-area-0.0.0.3]nssa
[R9-ospf-1-area-0.0.0.3]nssa