试验目的:熟悉OSPF的特殊区域:stub和stub totally
使用拓扑:
STUB 区域的练习:
说明,R1上写一个lo1 Ip:200.200.200.200 然后重分布进area 1,这样R1就变成了一个asbr,同样他就产生了5类LSA,在R4,R5上看到的路由如下:
R5#show ip route os
200.200.200.0/32 is subnetted, 1 subnets
O E2 200.200.200.200 [110/20] via 10.1.45.4, 00:00:21, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/257] via 10.1.45.4, 00:00:21, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/193] via 10.1.45.4, 00:00:21, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 10.1.45.4, 00:00:21, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 10.1.45.4, 00:00:21, Serial1/0
10.0.0.0/24 is subnetted, 4 subnets
O IA 10.1.12.0 [110/256] via 10.1.45.4, 00:00:21, Serial1/0
O IA 10.1.23.0 [110/192] via 10.1.45.4, 00:00:21, Serial1/0
O IA 10.1.34.0 [110/128] via 10.1.45.4, 00:00:21, Serial1/0
R4#show ip route os
200.200.200.0/32 is subnetted, 1 subnets
O E2 200.200.200.200 [110/20] via 10.1.34.3, 00:00:42, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/193] via 10.1.34.3, 00:00:42, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/129] via 10.1.34.3, 00:00:42, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 10.1.34.3, 00:01:07, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/65] via 10.1.45.5, 00:00:42, Serial1/1
10.0.0.0/24 is subnetted, 4 subnets
O IA 10.1.12.0 [110/192] via 10.1.34.3, 00:00:42, Serial1/0
O 10.1.23.0 [110/128] via 10.1.34.3, 00:01:07, Serial1/0
然而R5由于没有和其他的设备相连,可以看成一个末节区域,他没有必要看到5类LSA,于是在R5和R4上配置:
R5(config-router)#area 2 stub
R5(config-router)#
*Jun 17 09:18:42.535: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on Serial1/0 from FULL to DOWN, Neighbor Down: Adjacency forced to reset//会进行一下重置,重新允许SPF算法。
R4(config-router)#area 2 stub
设置成末节区域后的R5,R4路由表:
R5# show ip route os
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/257] via 10.1.45.4, 00:01:27, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/193] via 10.1.45.4, 00:01:27, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 10.1.45.4, 00:01:27, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 10.1.45.4, 00:01:27, Serial1/0
10.0.0.0/24 is subnetted, 4 subnets
O IA 10.1.12.0 [110/256] via 10.1.45.4, 00:01:27, Serial1/0
O IA 10.1.23.0 [110/192] via 10.1.45.4, 00:01:27, Serial1/0
O IA 10.1.34.0 [110/128] via 10.1.45.4, 00:01:27, Serial1/0
O*IA 0.0.0.0/0 [110/65] via 10.1.45.4, 00:01:27, Serial1/0//产生了一条缺省的3类LSA
R4#show ip route ospf //R4的路由表没有什么变化
200.200.200.0/32 is subnetted, 1 subnets
O E2 200.200.200.200 [110/20] via 10.1.34.3, 00:00:29, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/193] via 10.1.34.3, 00:00:29, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/129] via 10.1.34.3, 00:00:29, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 10.1.34.3, 00:01:03, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/65] via 10.1.45.5, 00:00:29, Serial1/1
10.0.0.0/24 is subnetted, 4 subnets
O IA 10.1.12.0 [110/192] via 10.1.34.3, 00:00:29, Serial1/0
O 10.1.23.0 [110/128] via 10.1.34.3, 00:01:03, Serial1/0
从这里可以看出:末节区域允许的LSA1,LSA2,LSA3
由于R1重分布了直连的路由,所以他就成了一个ASBR的路由器,在上面敲了STUB的命令后,提示如下错误:
R1(config-router)#area 1 stub
Warning: Router is currently an ASBR while having only one area which is a stub area
总结:
stub区域存在的几个条件:
· 只能接收LSA1,LSA2,LSA3,并且他会产生一条缺省的LSA3的路由
· 不能在ASBR上配置为STUB区域(因为ASBR会产生LSA5,但是stub区域是不能产生LSA5的)
· 不能穿越骨干区域
R3(config-router)#area 0 stub
OSPF: Backbone can not be configured as stub area
· 不能穿越虚链路
· 现在在R5上起来一个区域3,将loopbck 宣告进去了,然后在R5上敲
· R5(config-router)#area 2 stub
· % OSPF: Area cannot be a stub as it contains a virtual link
· 一个区域最多只能有一个ABR,多个ABR时会产生次优路径(多个ABR在向内通过缺省路由时,可能出现多个出口的情况)
R4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 1797 0x80000003 0x008DB1 2
3.3.3.3 3.3.3.3 282 0x80000006 0x003AD4 5
4.4.4.4 4.4.4.4 225 0x80000003 0x00888E 2
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 2.2.2.2 497 0x80000001 0x00AB44
2.2.2.2 2.2.2.2 1793 0x80000002 0x00F832
4.4.4.4 4.4.4.4 225 0x80000002 0x0060BA
5.5.5.5 4.4.4.4 783 0x80000001 0x00B621
10.1.12.0 2.2.2.2 1793 0x80000002 0x00BA22
10.1.45.0 4.4.4.4 225 0x80000002 0x0012A1
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 2.2.2.2 498 0x80000001 0x00935C
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 798 0x80000009 0x001EB5 3
5.5.5.5 5.5.5.5 798 0x80000008 0x003F8D 3
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 4.4.4.4 817 0x80000001 0x0039F4 //向内通告了一个缺省路由
1.1.1.1 4.4.4.4 492 0x80000001 0x0092D6
2.2.2.2 4.4.4.4 817 0x80000004 0x00DBC6
3.3.3.3 4.4.4.4 817 0x80000004 0x002BB3
10.1.12.0 4.4.4.4 817 0x80000004 0x009DB6
10.1.23.0 4.4.4.4 817 0x80000004 0x00A1E7
10.1.34.0 4.4.4.4 817 0x80000004 0x00A519
R5# show ip ospf database
OSPF Router with ID (5.5.5.5) (Process ID 1)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 793 0x80000009 0x001EB5 3
5.5.5.5 5.5.5.5 793 0x80000008 0x003F8D 3
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 4.4.4.4 812 0x80000001 0x0039F4
1.1.1.1 4.4.4.4 488 0x80000001 0x0092D6
2.2.2.2 4.4.4.4 812 0x80000004 0x00DBC6
3.3.3.3 4.4.4.4 812 0x80000004 0x002BB3
10.1.12.0 4.4.4.4 812 0x80000004 0x009DB6
10.1.23.0 4.4.4.4 812 0x80000004 0x00A1E7
10.1.34.0 4.4.4.4 812 0x80000004 0x00A519
上图中的接口,在区域2上的路由器由于接收了LSA3,并且LSA 3的数目占了不少数量,能不能把LSA3也给禁用掉,然到其他区域的流量通过缺省路由出去呢,这就产生了完全STUB区域。
此时再看一下R5的路由表:
R5#show ip route os
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 10.1.45.4, 00:00:20, Serial1/0
O*IA 0.0.0.0/0 [110/65] via 10.1.45.4, 00:00:20, Serial1/0
比以前少了非常多。
R5#sh ip ospf da
R5#sh ip ospf database
OSPF Router with ID (5.5.5.5) (Process ID 1)
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 87 0x8000000D 0x0016B9 3
5.5.5.5 5.5.5.5 91 0x8000000C 0x003791 3
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
0.0.0.0 4.4.4.4 131 0x80000001 0x0039F4
R4的路由表还是没有变化。
总结:
完全STUB区域:禁止了LSA3(但是他自己产生了一条LSA3的缺省路由),只允许LSA1,LSA2通行。
配置只需要在ABR上做配置就可以了,首先清除R4,R5上的area 2 stub后,在R4上配置: area 2 stub no-summary
,此时R4,R5不能建立邻居,于是在R5上打开debug开关发现:R5#s
*Jun 17 09:42:52.027: OSPF: Rcv hello from 4.4.4.4 area 2 from Serial1/0 10.1.45.4
*Jun 17 09:42:52.027: OSPF: Hello from 10.1.45.4 with mismatched Stub/Transit area option bit
*Jun 17 09:42:52.539: OSPF: Send hello to 224.0.0.5 area 2 on Serial1/0 from 10.1.45.5
然后在R5上敲了area 2 stub后,邻居就 可以建立起来了。说明完全末节区域是建立在stub区域的基础上的,还是要敲试图把区域的命令才可以。