14.我們注意到R1路由學習到的本次實驗拓撲中所有的路由,在實際網絡應用中,R1路由並不需要學習到整個網絡路由。過多的路由條目會導致路由器變大,不利用路由查詢,同時也不利於網絡的收斂。OSPF網絡路由是通過LSA來進行通告。可以限制LSA的泛洪的範圍,並輔以適當的彙總路由,從而有效的減少路由表的大小,便於網絡的收斂,同時增強網絡穩定性。
15.配置R1和R2之間的區域爲stub區域
R1(config)#router ospf 1 R1(config-router)#area 1 stub //配置區域1爲stub區域 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) //1型LSA 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) //3型LSA 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.配置R1和R2所在的stub區域爲totally stub區域。
R2(config)#router ospf 1 R2(config-router)#area 1 stub no-summary //no-summary命令可以拒絕類型3的LSA泛洪到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) //1型LSA 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) //3型LSA 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和類型5的LSA。而對於其它區域的非OSPF自治系統的網絡使用默認路由替代。