实验拓扑
实验要求
- R5为ISP,其上只能配置IP地址;R4作为企业边界路由器,出口公网地址需要通过PPP协议获取,并进行chap认证;
- 整个OSPF环境IP基于172.16.0.0/16划分;
- 所有设备均可访问R5的环回;
- 减少LSA的更新量,加快收敛,保障更新安全;
- 全网可达。
子网划分
把每一个区域规划成一个网段,后面汇总可以得到最少网段结果
172.16.0.0/16
area 0:172.16.0.0/19
172.16.0.0/24 骨干
172.16.0.0/30
172.16.0.4/30
172.16.0.8/30
172.16.0.1/24 R4环回
area 1:172.16.32.0/19
172.16.32.0/24 骨干
172.16.32.0/29
172.16.33.0/24 R1
172.16.34.0/24 R2
172.16.35.0/24 R3
area 2:172.16.64.0/19
area 3:172.16.96.0/19
area 4:172.16.128.0/19
实验配置
R1:
[r1]int l 0
[r1-LoopBack0]ip add 172.16.32.1 24
[r1-LoopBack0]ospf net
[r1-LoopBack0]ospf network-type b
[r1-LoopBack0]ospf network-type broadcast
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.35.1 29
[r1-GigabitEthernet0/0/0]q
R2:
[r2]int l 0
[r2-LoopBack0]ip add 172.16.32.1 24
[r2-LoopBack0]ospf net
[r2-LoopBack0]ospf network-type b
[r2-LoopBack0]ospf network-type broadcast
[r2-LoopBack0]qu
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.35.2 29
R3:
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.35.3 29
[r3-LoopBack0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r3-GigabitEthernet0/0/1]int l 0
[r3-LoopBack0]ip add 17.16.34.1 24
[r3-LoopBack0]ospf net
[r3-LoopBack0]ospf network-type b
[r3-LoopBack0]ospf network-type broadcast
R4:
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 172.16.0.2 30
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 172.16.0.5 30
[r4-GigabitEthernet0/0/2]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 172.16.0.9 30
[r4-GigabitEthernet0/0/0]qu
[r4]int l 0
[r4-LoopBack0]ip add 172.16.1.1 24
[r4-LoopBack0]ospf net
[r4-LoopBack0]ospf network-type b
[r4-LoopBack0]ospf network-type broadcast
R6:
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.66.1 30
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 172.16.0.6 30
[r6-GigabitEthernet0/0/1]int l 0
[r6-LoopBack0]ip add 172.16.64.1 24
[r6-LoopBack0]ospf net
[r6-LoopBack0]ospf network-type b
[r6-LoopBack0]ospf network-type broadcast
R7:
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 172.16.0.10 30
[r7-GigabitEthernet0/0/0]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.98.1 30
[r7-GigabitEthernet0/0/1]int l 0
[r7-LoopBack0]ip add 172.16.96.1 24
[r7-LoopBack0]ospf net
[r7-LoopBack0]ospf network-type b
[r7-LoopBack0]ospf network-type broadcast
R8:
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.98.2 30
[r8-GigabitEthernet0/0/0]int g0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.98.5 30
[r8-GigabitEthernet0/0/1]int l 0
[r8-LoopBack0]ip add 172.16.97.1 24
[r8-LoopBack0]ospf net
[r8-LoopBack0]ospf network-type b
[r8-LoopBack0]ospf network-type broadcast
R9:
[r9]int g0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.98.6 30
[r9-GigabitEthernet0/0/0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.130.1 30
[r9-GigabitEthernet0/0/1]int l 0
[r9-LoopBack0]ip add 172.16.128.1 24
[r9-LoopBack0]ospf net
[r9-LoopBack0]ospf network-type b
[r9-LoopBack0]ospf network-type broadcast
R10:
[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.130.2 30
[r10-GigabitEthernet0/0/0]int l 0
[r10-LoopBack0]ip add 172.16.129.1 24
[r10-LoopBack0]ospf net
[r10-LoopBack0]ospf network-type b
[r10-LoopBack0]ospf network-type broadcast
R11:
[r11]int g0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.66.2 30.
[r11-GigabitEthernet0/0/0]int l 0
[r11-LoopBack0]ip add 172.16.65.1 24
[r11-LoopBack0]ospf net
[r11-LoopBack0]ospf network-type b
[r11-LoopBack0]ospf network-type broadcast
[r11-LoopBack0]int g0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.66.5 30
R12:
[r12]int g0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.66.6 30
[r12-GigabitEthernet0/0/0]int l 0
[r12-LoopBack0]ip add 10.1.1.1 24
[r12-LoopBack0]int l 1
[r12-LoopBack1]ip add 10.1.2.1 24
测试(直连是否能ping通)
配置ospf
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 1
[r3-ospf-1-area-0.0.0.1]net
[r3-ospf-1-area-0.0.0.1]network 172.16.34.1 0.0.0.0
[r3-ospf-1-area-0.0.0.1]network 172.16.35.3 0.0.0.0
[r3-ospf-1-area-0.0.0.1]a 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.6 0.0.0.0
[r6-ospf-1-area-0.0.0.0]q
[r6-ospf-1]a 2
[r6-ospf-1-area-0.0.0.2]
[r6-ospf-1-area-0.0.0.2]net
[r6-ospf-1-area-0.0.0.2]network 172.16.64.1 0.0.0.0
[r6-ospf-1-area-0.0.0.2]network 172.16.66.1 0.0.0.0
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]a 0
[r7-ospf-1-area-0.0.0.0]net
[r7-ospf-1-area-0.0.0.0]network 172.16.0.10 0.0.0.0
[r7-ospf-1-area-0.0.0.0]a 3
[r7-ospf-1-area-0.0.0.3]network 172.16.96.1 0.0.0.0
[r7-ospf-1-area-0.0.0.3]network 172.16.98.1 0.0.0.0
[r8]ospf 1 router-id 8.8.8.8
[r8-ospf-1]a 3
[r8-ospf-1-area-0.0.0.3]net
[r8-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.31.255
[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]a 3
[r9-ospf-1-area-0.0.0.3]net
[r9-ospf-1-area-0.0.0.3]network 172.16.98.6 0.0.0.0
[r9]ospf 2 router-id 9.9.9.9
[r9-ospf-2]a 4
[r9-ospf-2-area-0.0.0.4]network 172.16.128.1 0.0.0.0
[r9-ospf-2-area-0.0.0.4]network 172.16.130.1 0.0.0.0
配置R12的rip
多进程双向重发布
配置isp
所有设备均可访问R5环回
汇总
空接口防环
特殊区域
#R1
[r1]ospf 1
[r1-ospf-1]a 1
[r1-ospf-1-area-0.0.0.1] stub
#R2
[r2]ospf 1
[r2-ospf-1]a 1
[r2-ospf-1-area-0.0.0.1]stub
#R3
[r3]ospf 1
[r3-ospf-1]a 1
[r3-ospf-1-area-0.0.0.1]stub no-
[r3-ospf-1-area-0.0.0.1]stub no-summary
#R6
[r6]ospf 1
[r6-ospf-1]a 2
[r6-ospf-1-area-0.0.0.2]stub no-
[r6-ospf-1-area-0.0.0.2]stub no-summary
#R11
[r11]ospf 1
[r11-ospf-1]a 2
[r11-ospf-1-area-0.0.0.2]nssa
#R12
[r12]ospf 1
[r12-ospf-1]a 2
[r12-ospf-1-area-0.0.0.2]nssa
#R7
[r7]ospf 1
[r7-ospf-1]a 3
[r7-ospf-1-area-0.0.0.3]nssa no-summary
#R8
[r8]ospf 1
[r8-ospf-1]a 3
[r8-ospf-1-area-0.0.0.3]nssa
#R9
[r9]ospf 1
[r9-ospf-1]a 3
[r9-ospf-1-area-0.0.0.3]nssa
[r9]ospf 2
[r9-ospf-2]dis th
[r9-ospf-2]undo im
[r9-ospf-2]undo import-route ospf 1