取消
显示结果 
搜索替代 
您的意思是: 
cancel
2214
查看次数
0
有帮助
2
评论
碧云天
Spotlight
Spotlight
本帖最后由 碧云天 于 2020-2-20 17:08 编辑
一.测试拓扑
165645zdkk1jrfkp881jcd.png
测试总结:
1.Stub区域ABR会过滤进入该区域的4/5类LSA,它会以一条3类LSA发布通往外部的全0的默认路由,Stub区域仍有其他区域的3类LSA
3.Totally Stub相对Stub区域,ABR过滤掉进入该区域3/4/5类LSA,保留一条全0的3类LSA在本区域传递,只需在ABR上配置
4.NSSA主要是解决Stub和Totally Stub不能有ASBR的限制问题,其区域的ASBR以7类LSA发布去往外部的路由,而ABR又将7类转换成3类LSA传递到area0
5.对于其他非NSSA区域,它会认为NSSA区域的ABR为ASBR,如果NSSA区域有多个ABR,会根据Router-ID竞选出一个转换器,由它负责将7类转成3类向其他区域传递
6.NSSA区域的ABR,会过滤掉进入该区域的4/5类LSA,并且不会自动产生默认路由,通过default-information-originate参数配置产生的默认路由,是以7类LSA在本区域传递
7.Totally NSSA的ABR,会过滤掉进入该区域的3/4/5类LSA,并且会自动产生全0的外部路由,以3类LSA在本区域传递
二.基本配置
1.R4路由器

hostname R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 24.1.1.4 255.255.255.0
no shutdown
router ospf 1
router-id 94.4.4.4
network 4.4.4.4 0.0.0.0 area 1
network 24.1.1.4 0.0.0.0 area 1
passive-interface Loopback0
2.R2路由器
hostname R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 24.1.1.2 255.255.255.0
no shutdown
interface Ethernet0/1
ip address 12.1.1.2 255.255.255.0
no shutdown
router ospf 1
router-id 92.2.2.2
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
network 24.1.1.2 0.0.0.0 area 1
3.R1路由器
hostname R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 12.1.1.1 255.255.255.0
no shutdown
interface Ethernet0/1
ip address 13.1.1.1 255.255.255.0
no shutdown
router ospf 1
router-id 91.1.1.1
passive-interface Loopback0
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.1 0.0.0.0 area 0
network 13.1.1.1 0.0.0.0 area 2
4.R3路由器
hostname R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
ip ospf network point-to-point
interface Ethernet0/0
ip address 13.1.1.3 255.255.255.0
no shutdown
interface Ethernet0/1
ip address 35.1.1.3 255.255.255.0
no shutdown
router ospf 1
router-id 93.3.3.3
passive-interface Loopback0
redistribute rip subnets
network 3.3.3.3 0.0.0.0 area 2
network 13.1.1.3 0.0.0.0 area 2
network 123.1.1.3 0.0.0.0 area 0
router rip
version 2
network 35.0.0.0
no auto-summary
5.R5路由器
hostname R5
interface Loopback0
ip address 5.5.5.5 255.255.255.0
interface Ethernet0/0
ip address 35.1.1.5 255.255.255.0
no shutdown
router rip
version 2
passive-interface Loopback0
network 5.0.0.0
network 35.0.0.0
no auto-summary
三.配置Area1为Stub区域
1.配置之前先看一下R4的路由,有两条O E2的外部路由
R4#show ip route ospf | begin Gateway
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O IA 1.1.1.0 [110/21] via 24.1.1.2, 00:04:06, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/11] via 24.1.1.2, 00:04:06, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/31] via 24.1.1.2, 00:04:01, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
O E2 5.5.5.0 [110/20] via 24.1.1.2, 00:03:56, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/20] via 24.1.1.2, 00:04:06, Ethernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/30] via 24.1.1.2, 00:04:06, Ethernet0/0
35.0.0.0/24 is subnetted, 1 subnets
O E2 35.1.1.0 [110/20] via 24.1.1.2, 00:03:56, Ethernet0/0
R4#
2.配置之前先看一下R4的链路状态数据库,里面有1/2/3/4/5类LSA
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 333 0x80000003 0x0051D6 1
94.4.4.4 94.4.4.4 332 0x80000003 0x00F207 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 332 0x80000001 0x00C81C
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.0 92.2.2.2 333 0x80000001 0x006A62
2.2.2.0 92.2.2.2 365 0x80000001 0x00E1F1
3.3.3.0 92.2.2.2 323 0x80000001 0x008636
12.1.1.0 92.2.2.2 365 0x80000001 0x00D0F1
13.1.1.0 92.2.2.2 333 0x80000001 0x00288F
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
93.3.3.3 92.2.2.2 323 0x80000001 0x00B9A5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.0 93.3.3.3 379 0x80000001 0x00AB7F 0
35.1.1.0 93.3.3.3 380 0x80000001 0x008094 0
R4#
3.配置之前先在R4上查看一下ABR和ASBR信息
R4#show ip ospf border-routers
OSPF Router with ID (94.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
I 93.3.3.3 [30] via 24.1.1.2, Ethernet0/0, ASBR, Area 1, SPF 2
i 92.2.2.2 [10] via 24.1.1.2, Ethernet0/0, ABR, Area 1, SPF 2
R4#
4.配置Area1为Stub区域
①R2路由器
R2(config)#router ospf 1
R2(config-router)#area 1 stub
R2(config-router)#
*Feb 20 02:20:29.761: %OSPF-5-ADJCHG: Process 1, Nbr 94.4.4.4 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Adjacency forced to reset
R2(config-router)#
备注:可以看到只是R2一端配置Stub,邻居会down
②R4路由器
R4#
*Feb 20 02:21:08.711: %OSPF-5-ADJCHG: Process 1, Nbr 92.2.2.2 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired
R4#config t
R4(config)#router ospf 1
R4(config-router)#area 1 stub
R4(config-router)#
*Feb 20 02:22:32.146: %OSPF-5-ADJCHG: Process 1, Nbr 92.2.2.2 on Ethernet0/0 from LOADING to FULL, Loading Done
R4(config-router)#
5.再次查看R4的路由,没有了O E2的外部路由,取而代之的是1条全0的O*IA
R4#show ip route ospf | begin Gateway
Gateway of last resort is 24.1.1.2 to network 0.0.0.0
O*IA 0.0.0.0/0 [110/11] via 24.1.1.2, 00:04:41, Ethernet0/0
1.0.0.0/24 is subnetted, 1 subnets
O IA 1.1.1.0 [110/21] via 24.1.1.2, 00:00:49, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/11] via 24.1.1.2, 00:00:49, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/31] via 24.1.1.2, 00:00:49, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/20] via 24.1.1.2, 00:00:49, Ethernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/30] via 24.1.1.2, 00:00:49, Ethernet0/0
R4#
6.再次查看R4的链路状态数据库,只有1/2/3类LSA
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 48 0x80000005 0x006BBC 1
94.4.4.4 94.4.4.4 47 0x80000005 0x000DEC 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 43 0x80000003 0x00E202
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 92.2.2.2 171 0x80000001 0x004893
1.1.1.0 92.2.2.2 171 0x80000002 0x008647
2.2.2.0 92.2.2.2 171 0x80000002 0x00FDD6
3.3.3.0 92.2.2.2 171 0x80000002 0x00A21B
12.1.1.0 92.2.2.2 171 0x80000002 0x00ECD6
13.1.1.0 92.2.2.2 171 0x80000002 0x004474
R4#
7.再次在R4上查看一下ABR和ASBR信息,只有ABR没有ASBR
R4#SHOW IP OSpf BOrder-routers
OSPF Router with ID (94.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 92.2.2.2 [10] via 24.1.1.2, Ethernet0/0, ABR, Area 1, SPF 5
R4#
四.配置Area1为Totally Stub区域
---配置Totally Stub只需在ABR上增加一条命令即可,其他的与Stub区域相同
1.从上面R4的链路状态数据库可以看到,还有很多其他区域的3类LSA
--配置Totally Stub区域就是让ABR把那些其他区域的3类LSA也干掉
2.在ABR路由器即R2路由器上配置
R2(config)#router ospf 1
R2(config-router)#area 1 stub no-summary
3.再次查看R4的链路状态数据库,只有1/2/3类LSA,并且3类LSA只有一条全0的
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 669 0x80000005 0x006BBC 1
94.4.4.4 94.4.4.4 668 0x80000005 0x000DEC 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 664 0x80000003 0x00E202
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 92.2.2.2 129 0x80000003 0x004495
R4#
4.再次查看R4的路由,可以发现,O IA的路由都没有了,只有一条全0的O*IA路由
R4#show ip route ospf | begin Gateway
Gateway of last resort is 24.1.1.2 to network 0.0.0.0
O*IA 0.0.0.0/0 [110/11] via 24.1.1.2, 00:00:02, Ethernet0/0
R4#
五.配置Area1为NSSA区域
1.配置之前需要取消R4和R2的stub配置

R4(config)#router ospf 1
R4(config-router)#no area 1 stub
R2(config)#router ospf 1
R2(config-router)#no area 1 stub no-summary
R2(config-router)#no area 1 stub
备注:R2上面show run虽然只能看到一条命令,但是要执行两条命令,才能取消Totally Stub的配置
2.R4配置静态路由并重分布到OSPF
R4(config)#ip route 100.1.1.0 255.255.255.0 loopback 0
R4(config)#router ospf 1
R4(config-router)#redistribute static subnets
3.查看R4的路由表,有两条O E2的路由
R4# show ip route ospf | begin Gateway
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O IA 1.1.1.0 [110/21] via 24.1.1.2, 00:03:08, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/11] via 24.1.1.2, 00:03:18, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/31] via 24.1.1.2, 00:03:08, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
O E2 5.5.5.0 [110/20] via 24.1.1.2, 00:03:03, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/20] via 24.1.1.2, 00:03:18, Ethernet0/0
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/30] via 24.1.1.2, 00:03:08, Ethernet0/0
35.0.0.0/24 is subnetted, 1 subnets
O E2 35.1.1.0 [110/20] via 24.1.1.2, 00:03:03, Ethernet0/0
R4#
4.查看R4上面的链路状态数据库,有1/2/3/4/5类LSA
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 539 0x80000008 0x0047DB 1
94.4.4.4 94.4.4.4 340 0x80000009 0x00EC05 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 533 0x80000006 0x00BE21
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.0 92.2.2.2 541 0x80000002 0x006863
2.2.2.0 92.2.2.2 541 0x80000002 0x00DFF2
3.3.3.0 92.2.2.2 541 0x80000002 0x008437
12.1.1.0 92.2.2.2 541 0x80000002 0x00CEF2
13.1.1.0 92.2.2.2 541 0x80000002 0x002690
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
93.3.3.3 92.2.2.2 541 0x80000001 0x00B9A5
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.0 93.3.3.3 1516 0x80000002 0x00A980 0
35.1.1.0 93.3.3.3 1516 0x80000002 0x007E95 0
100.1.1.0 94.4.4.4 339 0x80000001 0x0012BD 0
R4#
5.配置Area1为NSSA区域
①R4路由器
R4(config)#router ospf 1
R4(config-router)#area 1 nssa
②R2路由器
R2(config)#rouer ospf 1
R2(config-router)#area 1 nssa
6.查看R4的链路状态数据库,只有1/2/3类和自身发出的7类LSA,没有了4/5类LSA
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 131 0x80000007 0x00F427 1
94.4.4.4 94.4.4.4 130 0x80000007 0x009657 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 125 0x80000005 0x006674
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.0 92.2.2.2 138 0x80000004 0x000AB9
2.2.2.0 92.2.2.2 138 0x80000004 0x008149
3.3.3.0 92.2.2.2 138 0x80000004 0x00268D
12.1.1.0 92.2.2.2 138 0x80000004 0x007049
13.1.1.0 92.2.2.2 138 0x80000004 0x00C7E6
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
100.1.1.0 94.4.4.4 154 0x80000001 0x00466F 0
R4#
7.在R2上查看路由表,可以看到NSSA区域ASBR重分布进来的路由为O N2的路由
R2#show ip route ospf | begin Gateway
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/11] via 12.1.1.1, 00:20:48, Ethernet0/1
3.0.0.0/24 is subnetted, 1 subnets
O IA 3.3.3.0 [110/21] via 12.1.1.1, 00:20:48, Ethernet0/1
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/11] via 24.1.1.4, 00:20:28, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
O E2 5.5.5.0 [110/20] via 12.1.1.1, 00:20:48, Ethernet0/1
13.0.0.0/24 is subnetted, 1 subnets
O IA 13.1.1.0 [110/20] via 12.1.1.1, 00:20:48, Ethernet0/1
35.0.0.0/24 is subnetted, 1 subnets
O E2 35.1.1.0 [110/20] via 12.1.1.1, 00:20:48, Ethernet0/1
100.0.0.0/24 is subnetted, 1 subnets
O N2 100.1.1.0 [110/20] via 24.1.1.4, 00:20:28, Ethernet0/0
R2#
8.在R1和R3上查看路由表,可以看到路由已经改为O E2的路由
R1#show ip route ospf | begin Gateway
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/11] via 12.1.1.2, 01:32:11, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/11] via 13.1.1.3, 01:32:11, Ethernet0/1
4.0.0.0/24 is subnetted, 1 subnets
O IA 4.4.4.0 [110/21] via 12.1.1.2, 00:22:46, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
O E2 5.5.5.0 [110/20] via 13.1.1.3, 01:32:11, Ethernet0/1
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/20] via 12.1.1.2, 00:22:46, Ethernet0/0
35.0.0.0/24 is subnetted, 1 subnets
O E2 35.1.1.0 [110/20] via 13.1.1.3, 01:32:11, Ethernet0/1
100.0.0.0/24 is subnetted, 1 subnets
O E2 100.1.1.0 [110/20] via 12.1.1.2, 00:22:45, Ethernet0/0
R1#
R3#show ip route ospf | begin Gateway
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O IA 1.1.1.0 [110/11] via 13.1.1.1, 01:31:06, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O IA 2.2.2.0 [110/21] via 13.1.1.1, 01:31:06, Ethernet0/0
4.0.0.0/24 is subnetted, 1 subnets
O IA 4.4.4.0 [110/31] via 13.1.1.1, 00:21:41, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/20] via 13.1.1.1, 01:31:06, Ethernet0/0
24.0.0.0/24 is subnetted, 1 subnets
O IA 24.1.1.0 [110/30] via 13.1.1.1, 00:21:41, Ethernet0/0
100.0.0.0/24 is subnetted, 1 subnets
O E2 100.1.1.0 [110/20] via 13.1.1.1, 00:21:40, Ethernet0/0
R3#
9.NSSA区域ABR过滤外部的4/类LSA,而又不发布全0的缺省路由,因此需要添加参数 default-information-originate
R2(config)#router ospf 1
R2(config-router)# area 1 nssa default-information-originate
R2#show ip ospf database | sec Type-7
Type-7 AS External Link States (Area 1)
R2#show ip ospf database | begin Type-7
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 92.2.2.2 185 0x80000001 0x00A3AB 0
100.1.1.0 94.4.4.4 209 0x80000002 0x004470 0
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.0 93.3.3.3 193 0x80000004 0x00A582 0
35.1.1.0 93.3.3.3 194 0x80000004 0x007A97 0
100.1.1.0 92.2.2.2 132 0x80000002 0x0015B1 0
R2#
备注:配置完成后,可以看到全0的默认路由是以7类LSA在本区域传递的

五.配置Area1为Totally NSSA区域
1.Totally NSSA可以只在ABR上配置
①R4路由器

router ospf 1
router-id 94.4.4.4
area 1 nssa
redistribute static subnets
passive-interface Loopback0
network 4.4.4.4 0.0.0.0 area 1
network 24.1.1.4 0.0.0.0 area 1
②R2路由器
router ospf 1
router-id 92.2.2.2
area 1 nssa no-summary
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
network 24.1.1.2 0.0.0.0 area 1
2.配置完成后,可以看到R4只有一条全0标记为O*IA 的OSPF路由
R4#show ip route ospf | begin Gateway
Gateway of last resort is 24.1.1.2 to network 0.0.0.0
O*IA 0.0.0.0/0 [110/11] via 24.1.1.2, 00:10:34, Ethernet0/0
R4#
3.在R4上查看OSPF链路状态数据库,可以看到1/2/3/7类LSA
---备注:3类LSA只有一条由ABR产生的全0默认路由
R4#show ip ospf database
OSPF Router with ID (94.4.4.4) (Process ID 1)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
92.2.2.2 92.2.2.2 751 0x8000000B 0x00EC2B 1
94.4.4.4 94.4.4.4 1532 0x80000008 0x009458 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
24.1.1.4 94.4.4.4 1532 0x80000006 0x006475
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 92.2.2.2 757 0x80000001 0x00CF04
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
100.1.1.0 94.4.4.4 1786 0x80000002 0x004470 0
R4#
评论
one-time
Level 13
Level 13
感谢楼主分享,谢谢~
likuo
Spotlight
Spotlight
认真学习。
入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区:









快捷链接