天天看點

BSCI—8-(1):OSPF的特殊區域類型與配置(末節與完全末節區域)

一、介紹

标準區域:預設的區域類型,接收鍊路更新路由彙總外部路由

末節區域:将某區域設為Stub可縮小區域的LSDB,降低記憶體消耗。阻止LSA4/5進入Stub區域。

成為末節區域的标準:1.必須将Stub區域的所有路由器都配成Stub。 2.Stub區域不能用作虛鍊路的中轉區域。 3.Stub中不能出現ASBR。 4.Area 0不能配成Stub。

完全末節區域(CISCO私有):更加縮小區域的LSDB,在Stub基礎上,阻止LSA3。(阻止LSA3/4/5 ),也會由ABR發出一條LSA3預設路由給Stub的其他路由器。

NSSA:隻有NSSA區域中才會現LSA7,可以存在ASBR,阻止LSA4/5,ABR将LSA7轉成LSA5,傳播到其他區域,這時,ABR也成為了ASBR,因為它也引入了LSA5,其它路由器看到LSA5的通告路由器是ABR。

二、在這節我會示範末節與完全末節兩個執行個體

實驗一:配置OSPF末節區域,在R1上運作RIP與OSPF兩種路由協定,R1到R2屬區域0,R2到R3屬區域1,IP位址資訊如圖所示:

步驟一:配置3台路由器,并且釋出網段.

R1:

Router>

Router>en

Router#conf t

Router(config)#hostname R1

R1(config-line)#exit

R1(config)#interface f0/0

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#exit

R1(config)#interface loopback 0

R1(config-if)#ip address 1.1.1.1 255.255.255.0

R1(config-if)#int lo1

R1(config-if)#ip address 1.1.2.1 255.255.255.0

R1(config)#router ospf 1     //啟用OSPF路由協定

R1(config-router)#network 192.168.1.1 0.0.0.0 area 0

R1(config-router)#exit

R1(config)#router rip     //啟用RIP路由協定

R1(config-router)#version 2     //指定版本2

R1(config-router)#no auto-summary     //不要自動彙總

R1(config-router)#network 1.1.1.0     //釋出網段

R1(config-router)#network 1.1.2.0

R1(config-router)#end

R1#

R2:

Router(config)#hostname R2

R2(config)#interface f0/0

R2(config-if)#ip address 192.168.1.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#exit

R2(config)#interface f0/1

R2(config-if)#ip address 192.168.2.2 255.255.255.0

R2(config)#interface loopback 0

R2(config-if)#ip address 2.2.1.1 255.255.255.0

R2(config-if)#int lo1

R2(config-if)#ip address 2.2.2.1 255.255.255.0

R2(config)#router ospf 1     //同上

R2(config-router)#network 192.168.1.2 0.0.0.0 area 0

R2(config-router)#network 192.168.2.2 0.0.0.0 area 1

R2(config-router)#network 2.2.1.1 0.0.0.0 area 0

R2(config-router)#network 2.2.2.1 0.0.0.0 area 0

R2(config-router)#end

R2#

R3:

Router(config)#hostname R3

R3(config-line)#exit

R3(config)#interface f0/1

R3(config-if)#ip address 192.168.2.1 255.255.255.0

R3(config-if)#no sh

R3(config-if)#exit

R3(config)#router ospf 1      //同上

R3(config-router)#network 192.168.2.1 0.0.0.0 area 1

R3(config-router)#end

R3#

步驟二:在R1上把RIP與OSPF互相重釋出,并在R3檢視路由表

R1(config)#router ospf 1

R1(config-router)#redistribute rip

R1(config-router)#redistribute rip subnets      //把RIP中路由釋出進OPSF

R1(config)#router rip

R1(config-router)#redistribute ospf 1 metric 1     //把OSPF釋出進RIP,路徑成本為1

檢視R3路由表:     //學習到2條外部路由,與3條區域間路由.

R3#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

       i - IS-IS, 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 not set

     1.0.0.0/24 is subnetted, 2 subnets

O E2    1.1.1.0 [110/20] via 192.168.2.2, 00:00:45, FastEthernet0/1

//E2代表OSPF外部類型2的路由.

O E2    1.1.2.0 [110/20] via 192.168.2.2, 00:00:45, FastEthernet0/1

     2.0.0.0/32 is subnetted, 2 subnets

O IA    2.2.1.1 [110/2] via 192.168.2.2, 00:03:09, FastEthernet0/1

O IA    2.2.2.1 [110/2] via 192.168.2.2, 00:03:09, FastEthernet0/1

O IA 192.168.1.0/24 [110/2] via 192.168.2.2, 00:03:09, FastEthernet0/1

C    192.168.2.0/24 is directly connected, FastEthernet0/1

步驟三:下面一步把區域1配置為末節區域,并再檢視R3路由。(末節區域能阻止類型4,類型5的LSA,并産生一條OSPF的預設路由)

R2(config)#router ospf 1

R2(config-router)#area 1 stub      //把區域1配置為末節區域

R3(config)#router ospf 1

R3(config-router)#area 1 stub      //同上

檢視R3路由表:     //之前的外部E2路由不見了,取而代之的為一條OSPF預設路由.

Gateway of last resort is 192.168.2.2 to network 0.0.0.0

O IA    2.2.1.1 [110/2] via 192.168.2.2, 00:01:56, FastEthernet0/1

O IA    2.2.2.1 [110/2] via 192.168.2.2, 00:01:56, FastEthernet0/1

O IA 192.168.1.0/24 [110/2] via 192.168.2.2, 00:01:56, FastEthernet0/1

O*IA 0.0.0.0/0 [110/2] via 192.168.2.2, 00:01:56, FastEthernet0/1

//帶*表示預設路由,O*表示OSPF的預設路由.

步驟四:檢視R3鍊路狀态資料庫是否阻止4/5類LSA,并測試能否拼通.

R3#show ip ospf database  //很明顯隻有前三種LSA,在3類LSA中多了一條預設路由

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

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.1         2.2.2.1         575         0x80000008 0x0065ff 1

192.168.2.1     192.168.2.1     757         0x80000a52 0x003810 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.1     192.168.2.1     655         0x80000002 0x009fcd

                Summary Net Link States (Area 1)

192.168.1.0     2.2.2.1         1480        0x80000001 0x00a04c

2.2.1.1         2.2.2.1         1438        0x80000002 0x00143c

2.2.2.1         2.2.2.1         1438        0x80000003 0x000747

0.0.0.0         2.2.2.1         633         0x80000007 0x0051ff

驗證:R3拼R1

R3#ping 1.1.1.1

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 33/45/64 ms

總結:因為末節區域阻止了4,5類的LSA,是以它是不能學習到E2,E1的外部路由,之是以最後能拼能R1,是因為末節區域自動加了一條預設路由指向ABR.

實驗二:配置OSPF完全末節區域,拓撲如下:

步驟一:配置3台路由器,并且釋出網段.    //與實驗一配置一樣

步驟二:在R1上把RIP與OSPF互相重釋出,并在R3檢視路由表    //與實驗一配置一樣

步驟三:在R1與R3上把區域1改變成完全末節區域,并在R3上檢視路由表

R2(config)#router ospf 1

R2(config-router)#area 1 stub no-summary    //把區域1配置為完全末節區域

R3(config)#router ospf 1

R3(config-router)#area 1 stub no-summary    //同上

檢視R3路由表:   //隻剩一條區域間的預設路由

R3#show ip route 

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

       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 192.168.2.2 to network 0.0.0.0

C    192.168.2.0/24 is directly connected, FastEthernet0/1

O*IA 0.0.0.0/0 [110/2] via 192.168.2.2, 00:02:34, FastEthernet0/1

步驟四:檢視R3的鍊路狀态資料庫,測試拼R1.

檢視R3鍊路狀态資料庫:     //3,4,5類型LSA換成一條區域間的預設路由

R3#show ip ospf database 

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

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count

2.2.2.1         2.2.2.1         253         0x80000006 0x0087BF 1

192.168.2.1     192.168.2.1     266         0x80000004 0x00116F 1

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum

192.168.2.1     192.168.2.1     266         0x80000001 0x00C827

                Summary Net Link States (Area 1)

0.0.0.0         2.2.2.1         334         0x80000001 0x007BBB

R3拼R1:

R3#ping 1.1.1.1

Type escape sequence to abort.

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

Success rate is 100 percent (5/5), round-trip min/avg/max = 424/664/1140 ms

實驗完成.

本文轉自 meiyanaa 51CTO部落格,原文連結:http://blog.51cto.com/justim/271357,如需轉載請自行聯系原作者

繼續閱讀