14.我们注意到R1路由学习到的本次实验拓扑中所有的路由,在实际网络应用中,R1路由并不需要学习到整个网络路由。过多的路由条目会导致路由器变大,不利用路由查询,同时也不利于网络的收敛。OSPF网络路由是通过LSA来进行通告。可以限制LSA的泛洪的范围,并辅以适当的汇总路由,从而有效的减少路由表的大小,便于网络的收敛,同时增强网络稳定性

 

15.配置R1R2之间的区域为stub区域

R1(config)#router ospf 1

R1(config-router)#area 1 stub  //配置区域1stub区域

R1(config-router)#exit

R2(config)#router ospf 1

R2(config-router)#area 1 stub

R2(config-router)#exit

16.再次查看R1的链路状态数据库

R1#show ip ospf da

 

            OSPF Router with ID (172.16.1.1) (Process ID 1)

 

                Router Link States (Area 1)   //1LSA

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

172.16.1.1      172.16.1.1      92          0x80000004 0x0079A3 3

172.16.255.5    172.16.255.5    90          0x80000003 0x005395 2

 

                Summary Net Link States (Area 1)  //3LSA

 

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         172.16.255.5    95          0x80000001 0x00017B 

172.16.2.1      172.16.255.5    95          0x80000002 0x005EDC

172.16.255.0    172.16.255.5    95          0x80000002 0x00F608

172.16.255.4    172.16.255.5    95          0x80000002 0x00B7C6

172.16.255.8    172.16.255.5    95          0x80000002 0x001228

说明:4型和5型的LSA被拒绝了,从而限制了LSA洪范的范围。

 

17.查看R1的路由表

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is 172.16.255.2 to network 0.0.0.0

 

     172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks

C       172.16.255.0/30 is directly connected, Serial0/0

O IA    172.16.255.0/24 [110/256] via 172.16.255.2, 00:05:33, Serial0/0

O IA    172.16.255.4/30 [110/128] via 172.16.255.2, 00:05:33, Serial0/0

O IA    172.16.255.8/30 [110/192] via 172.16.255.2, 00:05:33, Serial0/0

C       172.16.1.0/24 is directly connected, Loopback0

O IA    172.16.2.1/32 [110/193] via 172.16.255.2, 00:05:33, Serial0/0

O*IA 0.0.0.0/0 [110/65] via 172.16.255.2, 00:05:33, Serial0/0

//stub有一条默认路由指向stub区域

18.再次测试连通性

R1#ping 10.1.1.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 28/68/100 ms

说明:stub区域拒绝了4型和5型的LSA

 

19.通过stub的区域特性配置,已经可以有效的减少路由表的大小。但是此时R1的路由表并不是最精简的。可以使用totally stub区域特性来进一步的减少路由表尺寸.

 

20.配置R1R2所在的stub区域为totally stub区域。

R2(config)#router ospf 1

R2(config-router)#area 1 stub no-summary //no-summary命令可以拒绝类型3LSA泛洪到area 1区域。

R2(config-router)#exit

21.查看R1的链路状态数据库

R1#show ip ospf da

 

            OSPF Router with ID (172.16.1.1) (Process ID 1)

 

                Router Link States (Area 1)  //1LSA

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

172.16.1.1      172.16.1.1      1036        0x80000004 0x0079A3 3

172.16.255.5    172.16.255.5    1034        0x80000003 0x005395 2

 

                Summary Net Link States (Area 1)   //3LSA

 

Link ID         ADV Router      Age         Seq#       Checksum

0.0.0.0         172.16.255.5    129         0x80000002 0x00FE7C

说明:totally stub区域只有一条3型的默认路由。

 

22.查看R1的路由表

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is 172.16.255.2 to network 0.0.0.0

 

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

C       172.16.255.0/30 is directly connected, Serial0/0

C       172.16.1.0/24 is directly connected, Loopback0

O*IA 0.0.0.0/0 [110/65] via 172.16.255.2, 00:03:37, Serial0/0

23.测试连通性

R1#ping 10.1.1.1 

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 20/62/112 ms

说明:完全末节区域(Totally Stub Area)拒绝了类型3、类型4和类型5LSA。而对于其它区域的非OSPF自治系统的网络使用默认路由替代。