在CCNP的教学过程中,OSPF的几个特殊区域和OSPF的数据库内容,是很多学员头大的地方,对于自己比较难理解的知识点,个人认为:第一:放到实验中去理解(也就是理论要有具体的场景);第二:实验拓扑简单为好(以能理解本知识点为好)。
本文用一个最简单的拓扑讲解OSPF的特殊区域:OSPF STUB、total STUB、NSSA、total NSSA。欢迎交流。
一,端口和协议基本配置略:先不要重分发任何路由
二,首先重分发RIP,产生OSPF外部路由
r3(config)#routerospf 1
r3(config-router)#redistributerip subnets
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
OIA 3.1.1.1 [110/129] via 12.1.1.2,00:00:01, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
OIA 23.1.1.0 [110/128] via 12.1.1.2,00:00:01, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
30.0.0.0/24 is subnetted, 1 subnets
O E2 30.1.1.0 [110/20] via 12.1.1.2, 00:00:01,Serial1/1
#正常区域可以接受所有路由
三,配置区域1为STUB
r2(config)#routerospf 1
r2(config-router)#area1 stub
r1(config)#routerospf 1
r1(config-router)#area1 stub
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
OIA 3.1.1.1 [110/129] via 12.1.1.2,00:00:35, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
OIA 23.1.1.0 [110/128] via 12.1.1.2,00:00:35, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
O*IA 0.0.0.0/0 [110/65] via 12.1.1.2, 00:00:35, Serial1/1
#STUB区域隔离外部路由,产生指向ABR的默认路由
四,配置完全STUB区域
r2(config)#routerospf 1
r2(config-router)#area1 stub no-au
r1(config)#routerospf 1
r1(config-router)#area1 stub
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
O*IA0.0.0.0/0 [110/65] via 12.1.1.2, 00:01:27, Serial1/1
#完全STUB区域隔离外部和域间路由,产生指向ABR的默认路由
五,STUB区域特性
r1(config)#routerospf 1
r1(config-router)#redistributeconnected subnets
Warning:Router is currently an ASBR while having only one area which is a stub area
# 也就说此时的区域1无法引入如何的外部路由
六,配置NSSA区域
r2(config)#routerospf 1
r2(config-router)#area1 nssa
r1(config)#routerospf 1
r1(config-router)#area1 nssa
注意:NSSA区域和STUB区域一样,会隔离外部路由,但不同的是此时r2不会自动向r1通告默认路由
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
OIA 3.1.1.1 [110/129] via 12.1.1.2,00:01:19, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
OIA 23.1.1.0 [110/128] via 12.1.1.2,00:01:19, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
NSSA区域产生默认路由:
r2(config)#routerospf 1
r2(config-router)#area1 nssa default-information-originate
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
OIA 3.1.1.1 [110/129] via 12.1.1.2,00:00:01, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
OIA 23.1.1.0 [110/128] via 12.1.1.2,00:00:01, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
O*N20.0.0.0/0 [110/1] via 12.1.1.2, 00:00:01, Serial1/1
#NSSA区域的默认路由
七,配置完全NSSA区域
r2(config)#routerospf 1
r2(config-router)#area1 nssa no-summary
#不配置no-summary,则为NSSA区域
r1(config)#routerospf 1
r1(config-router)#area1 nssa
r1#showip ro
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
O*IA0.0.0.0/0 [110/65] via 12.1.1.2, 00:00:55, Serial1/1
# 完全NSSA区域和完全STUB区域一样,隔离外部和域间路由,产生指向ABR的默认路由
r2#showip route
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 12.1.1.1, 00:05:14,Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.1.1.1 [110/65] via 23.1.1.2, 00:05:51,Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected,Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/0
30.0.0.0/24 is subnetted, 1 subnets
OE2 30.1.1.0 [110/20] via 23.1.1.2,00:05:14, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
O N2 10.1.1.0 [110/20] via 12.1.1.1, 00:05:14,Serial1/0
#NSSA区域类型
r3#showip ro
1.0.0.0/32 is subnetted, 1 subnets
OIA 1.1.1.1 [110/129] via 23.1.1.1,00:01:50, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.1.1.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected,Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
O E2 10.1.1.0 [110/20] via 23.1.1.1, 00:01:49,Serial1/0
#NSSA路由穿越ABR时改变
12.0.0.0/24 is subnetted, 1 subnets
#(7类LSA转换为5类LSA)
OIA 12.1.1.0 [110/128] via 23.1.1.1,00:02:31, Serial1/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected,Loopback10
八,同时使用default-information-originate和no-summary 参数
r2(config)#routerospf 1
r2(config-router)#area1 nssa default-information-originate no-summary
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
O*IA0.0.0.0/0 [110/65] via 12.1.1.2, 00:00:16, Serial1/1
#说明OIA的路由优于0N2
九,NSSA区域特性
r2(config)#interlo 10
r2(config-if)#ipadd 20.1.1.1 255.255.255.0
r2(config-if)#routerospf 1
r2(config-router)#redistributeconnected subnets
#命令没有报错,说明在NSSA区域中,可以存在ASBR,也就是虽然不接收外部路由,但是可以存在外部路由,并通过出去
r1#showip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
OIA 3.1.1.1 [110/129] via 12.1.1.2,00:02:35, Serial1/1
20.0.0.0/24 is subnetted, 1 subnets
O N2 20.1.1.0 [110/20] via 12.1.1.2, 00:00:14,Serial1/1
#NSSA 区域路由类型-7类LSA
23.0.0.0/24 is subnetted, 1 subnets
OIA 23.1.1.0 [110/128] via 12.1.1.2,00:02:35, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected,Loopback10
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected,Serial1/1
r3#showip route
1.0.0.0/32 is subnetted, 1 subnets
OIA 1.1.1.1 [110/129] via 23.1.1.1,00:33:53, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.1.1.0 is directly connected, Loopback0
20.0.0.0/24 is subnetted, 1 subnets
O E2 20.1.1.0 [110/20] via 23.1.1.1, 00:00:34, Serial1/0
#R3收到了来自NSSA的外部路由
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected,Serial1/0
10.0.0.0/24 is subnetted, 1 subnets
OE2 10.1.1.0 [110/20] via 23.1.1.1,00:11:16, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
OIA 12.1.1.0 [110/128] via 23.1.1.1,00:34:34, Serial1/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected,Loopback10
十:关于default-information-originate命令需注意
r2(config-router)#area1 nssa default-information-originate
这条命令如果是用在ASBR上,要生成默认路由,本地必须已存在一条静态默认路由。
理论总结
个人觉得华为3COM的一篇相关技术文档写的比较通俗,所以摘抄了下来,加以引用,在此特表感谢!