ospf之nssa區域

首先作為nssa區域需要滿足以下條件:

1.該區域不能是骨幹區域

2.該區域不能存在虛鏈路

3.和stub區域類似,該區域只有一個出口,只不過這個區域是ASBR


ospf之nssa區域

網絡拓撲


配置ospf,如拓撲,全網運行ospf,R1將環回口100-102重分佈直連進ospf100,R5將200-202環回口重分佈直連進ospf,根據最開始提到的條件,本拓撲的area1中[R1(ASBR),R2(ASBR],area2中[R3(ABR),R4,R5(ASBR)]均滿足,那麼本節以area2中的R3-R4-R5為例,首先查看路由表:

R3#

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 23.1.1.1, 00:00:04, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/3] via 23.1.1.1, 00:00:04, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/2] via 23.1.1.1, 00:00:04, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 23.1.1.1, 00:00:04, FastEthernet0/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 23.1.1.1, 00:00:04, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 34.1.1.2, 00:00:04, FastEthernet1/0

O E2 201.1.1.0/24 [110/20] via 34.1.1.2, 00:00:04, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/3] via 34.1.1.2, 00:00:04, FastEthernet1/0

O E2 200.1.1.0/24 [110/20] via 34.1.1.2, 00:00:04, FastEthernet1/0

O E2 202.1.1.0/24 [110/20] via 34.1.1.2, 00:00:04, FastEthernet1/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/2] via 23.1.1.1, 00:00:06, FastEthernet0/0

45.0.0.0/24 is subnetted, 1 subnets

O 45.1.1.0 [110/2] via 34.1.1.2, 00:00:06, FastEthernet1/0


R4#

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 34.1.1.1, 00:01:30, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/4] via 34.1.1.1, 00:01:30, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/3] via 34.1.1.1, 00:01:30, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 34.1.1.1, 00:01:30, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/2] via 34.1.1.1, 00:01:30, FastEthernet0/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 34.1.1.1, 00:01:30, FastEthernet0/0

O E2 201.1.1.0/24 [110/20] via 45.1.1.2, 00:01:30, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/2] via 45.1.1.2, 00:01:30, FastEthernet1/0

O E2 200.1.1.0/24 [110/20] via 45.1.1.2, 00:01:30, FastEthernet1/0

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/2] via 34.1.1.1, 00:01:30, FastEthernet0/0

O E2 202.1.1.0/24 [110/20] via 45.1.1.2, 00:01:32, FastEthernet1/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/3] via 34.1.1.1, 00:01:32, FastEthernet0/0


R5#

34.0.0.0/24 is subnetted, 1 subnets

O 34.1.1.0 [110/2] via 45.1.1.1, 00:13:03, FastEthernet0/0

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 45.1.1.1, 00:13:03, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/5] via 45.1.1.1, 00:13:03, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/4] via 45.1.1.1, 00:13:03, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 45.1.1.1, 00:13:03, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/3] via 45.1.1.1, 00:13:03, FastEthernet0/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 45.1.1.1, 00:13:03, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 45.1.1.1, 00:13:03, FastEthernet0/0

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/3] via 45.1.1.1, 00:13:03, FastEthernet0/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/4] via 45.1.1.1, 00:13:04, FastEthernet0/0

其中R3從兩個方向收到了6條OE2的路由條目,R4也從兩個方向收到了6條OE2的路由條目,R5從一個方向收到了3條路由條目,接下來做一下nssa,如果要將該區域作為nssa區域,那麼在本區域內的每一臺設備都需要做nssa的配置,從ASBR(R5)一直做到ABR(R3):

R3#

router ospf 100

area 2 nssa default-information-originate


R4#

router ospf 100

area 2 nssa


R5#

router ospf 100

area 2 nssa

可以看到,這邊在該區域的ABR設備上敲的命令和其他設備上的不一樣,這個是為了保證路由可達,很多地方在講解ospf的nssa區域的時候都出現了類似的錯誤,如果只在R3(ABR)配置命令area 2 nssa 命令,會出現的情況是,當R1要去往R5上的環回口的時候,那麼會導致沒有回包路由的情況出現,所以為了能夠保證路由的可達性,需要R3在作為nssa區域的同時下方默認路由,查看R3-R5的路由表:

R3#

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 23.1.1.1, 00:07:24, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/3] via 23.1.1.1, 00:07:24, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/2] via 23.1.1.1, 00:07:24, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 23.1.1.1, 00:07:24, FastEthernet0/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 23.1.1.1, 00:07:24, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 34.1.1.2, 00:07:24, FastEthernet1/0

O N2 201.1.1.0/24 [110/20] via 34.1.1.2, 00:07:24, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/3] via 34.1.1.2, 00:07:24, FastEthernet1/0

O N2 200.1.1.0/24 [110/20] via 34.1.1.2, 00:07:24, FastEthernet1/0

O N2 202.1.1.0/24 [110/20] via 34.1.1.2, 00:07:24, FastEthernet1/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/2] via 23.1.1.1, 00:07:26, FastEthernet0/0

45.0.0.0/24 is subnetted, 1 subnets

O 45.1.1.0 [110/2] via 34.1.1.2, 00:07:26, FastEthernet1/0


R4#

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/4] via 34.1.1.1, 00:08:37, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/3] via 34.1.1.1, 00:08:37, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/2] via 34.1.1.1, 00:08:37, FastEthernet0/0

O N2 201.1.1.0/24 [110/20] via 45.1.1.2, 00:08:37, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/2] via 45.1.1.2, 00:08:37, FastEthernet1/0

O N2 200.1.1.0/24 [110/20] via 45.1.1.2, 00:08:37, FastEthernet1/0

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/2] via 34.1.1.1, 00:08:37, FastEthernet0/0

O N2 202.1.1.0/24 [110/20] via 45.1.1.2, 00:08:37, FastEthernet1/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/3] via 34.1.1.1, 00:08:37, FastEthernet0/0

O*N2 0.0.0.0/0 [110/1] via 34.1.1.1, 00:08:37, FastEthernet0/0


R5#

34.0.0.0/24 is subnetted, 1 subnets

O 34.1.1.0 [110/2] via 45.1.1.1, 00:09:21, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/5] via 45.1.1.1, 00:09:21, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/4] via 45.1.1.1, 00:09:21, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/3] via 45.1.1.1, 00:09:21, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 45.1.1.1, 00:09:21, FastEthernet0/0

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/3] via 45.1.1.1, 00:09:21, FastEthernet0/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/4] via 45.1.1.1, 00:09:21, FastEthernet0/0

O*N2 0.0.0.0/0 [110/1] via 45.1.1.1, 00:09:21, FastEthernet0/0

當將該區域area2作為nssa區域可以發現,在ABR(R3)設備上,將從ASBR傳過來的OE2(五類LSA)的條目轉換為了ON2(七類的LSA)的條目;在R4上,優化掉了從左邊的ABR傳過來的100-102的條目(5類的LSA),產生了一條由ABR下放的O*N2的默認路由指向ABR;R5在優化掉左邊ABR傳過來的路由條目(100-102)的同時也產生了一條由ABR下放的O*N2默認路由指向R4,當然,優化掉五類LSA的同時其實也優化掉了4類的LSA,因為5類的LSA由4類LSA通告的,也就是ASBR通告的,而4類的LSA就是指出誰是ASBR,既然沒有了5類LSA的存在,那麼4類LSA自然而然也就沒有了。

下面測試一下路由可達性:

R1#ping 200.1.1.1 source 100.1.1.1

Type escape sequence to abort.

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

Packet sent with a source address of 100.1.1.1

!!!!!

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

沒有問題,現在R1上用源100.1.1.1 去ping 200.1.1.1 可以通信。

當然,nssa區域其實算不上最大化的ospf優化,要做到最大化的優化,還需要用到完全nssa區域(完全非完全末節區域),配置完全nssa,只需要基於nssa區域的基礎之上,在本區域的ABR上敲上area 2 nssa no-summary命令即可:

R3(config)#router ospf 100

R3(config-router)#no area 2 nssa defa

R3(config-router)#no area 2 nssa default-information-originate

R3(config-router)#no area 2 nssa

*Mar 1 00:47:15.855: %OSPF-5-ADJCHG: Process 100, Nbr 4.4.4.4 on FastEthernet1/0 from FULL to DOWN, Neighbor Down: Adjacency forced to reset

R3(config-router)#area 2 nssa no-summary

*Mar 1 00:47:25.615: %OSPF-5-ADJCHG: Process 100, Nbr 4.4.4.4 on FastEthernet1/0 from DOWN to DOWN, Neighbor Down: Adjacency forced to reset

*Mar 1 00:47:29.935: %OSPF-5-ADJCHG: Process 100, Nbr 4.4.4.4 on FastEthernet1/0 from LOADING to FULL, Loading Done

R3(config-router)#exit

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 23.1.1.1, 00:01:33, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O IA 1.1.1.1 [110/3] via 23.1.1.1, 00:01:33, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O IA 2.2.2.2 [110/2] via 23.1.1.1, 00:01:33, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 23.1.1.1, 00:01:33, FastEthernet0/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 23.1.1.1, 00:01:33, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 34.1.1.2, 00:01:33, FastEthernet1/0

O N2 201.1.1.0/24 [110/20] via 34.1.1.2, 00:01:33, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/3] via 34.1.1.2, 00:01:33, FastEthernet1/0

O N2 200.1.1.0/24 [110/20] via 34.1.1.2, 00:01:33, FastEthernet1/0

O N2 202.1.1.0/24 [110/20] via 34.1.1.2, 00:01:33, FastEthernet1/0

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/2] via 23.1.1.1, 00:01:35, FastEthernet0/0

45.0.0.0/24 is subnetted, 1 subnets

O 45.1.1.0 [110/2] via 34.1.1.2, 00:01:35, FastEthernet1/0


R4#

O N2 201.1.1.0/24 [110/20] via 45.1.1.2, 00:02:23, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O 5.5.5.5 [110/2] via 45.1.1.2, 00:02:23, FastEthernet1/0

O N2 200.1.1.0/24 [110/20] via 45.1.1.2, 00:02:23, FastEthernet1/0

O N2 202.1.1.0/24 [110/20] via 45.1.1.2, 00:02:23, FastEthernet1/0

O*IA 0.0.0.0/0 [110/2] via 34.1.1.1, 00:02:23, FastEthernet0/0


R5#

34.0.0.0/24 is subnetted, 1 subnets

O 34.1.1.0 [110/2] via 45.1.1.1, 00:03:01, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/2] via 45.1.1.1, 00:03:01, FastEthernet0/0

O*IA 0.0.0.0/0 [110/3] via 45.1.1.1, 00:03:01, FastEthernet0/0

當做了完全nssa區域之後,可以看到,原本的R5基於nssa區域的情況下,並沒有產生多大的變化,但是看R4上,優化掉了從左邊ABR傳過來的3類,4類,5類的LSA,從本區域的ASBR傳過來的OE2的條目被轉換為了ON2的路由條目,取而代之的是一條3類的O*IA的條目指向ABR,R5上同樣也是優化掉了從左邊ABR傳過來的3類,4,5類LSA,並且也產生了一條指向R4的O*IA的默認,實現了最大化的路由條目優化。

接下來再次測試:

R1#ping 200.1.1.1 source 100.1.1.1

Type escape sequence to abort.

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

Packet sent with a source address of 100.1.1.1

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 88/152/208 ms

可以通信,沒有問題,那麼Area1呢,這裡直接做完全nssa區域優化,在做之前,先簡單的查看一下R1和R2的路由表:

R1#

34.0.0.0/24 is subnetted, 1 subnets

O IA 34.1.1.0 [110/3] via 12.1.1.2, 00:00:40, FastEthernet0/0

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/2] via 12.1.1.2, 00:00:40, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O IA 3.3.3.3 [110/3] via 12.1.1.2, 00:00:40, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O IA 4.4.4.4 [110/4] via 12.1.1.2, 00:00:40, FastEthernet0/0

O E2 201.1.1.0/24 [110/20] via 12.1.1.2, 00:00:40, FastEthernet0/0

5.0.0.0/32 is subnetted, 1 subnets

O IA 5.5.5.5 [110/5] via 12.1.1.2, 00:00:40, FastEthernet0/0

O E2 200.1.1.0/24 [110/20] via 12.1.1.2, 00:00:40, FastEthernet0/0

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/2] via 12.1.1.2, 00:00:40, FastEthernet0/0

O E2 202.1.1.0/24 [110/20] via 12.1.1.2, 00:00:40, FastEthernet0/0

45.0.0.0/24 is subnetted, 1 subnets

O IA 45.1.1.0 [110/4] via 12.1.1.2, 00:00:40, FastEthernet0/0


R2#

34.0.0.0/24 is subnetted, 1 subnets

O IA 34.1.1.0 [110/2] via 23.1.1.2, 00:01:15, FastEthernet1/0

102.0.0.0/24 is subnetted, 1 subnets

O E2 102.1.1.0 [110/20] via 12.1.1.1, 00:01:15, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/2] via 12.1.1.1, 00:01:15, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O E2 100.1.1.0 [110/20] via 12.1.1.1, 00:01:15, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.3 [110/2] via 23.1.1.2, 00:01:15, FastEthernet1/0

101.0.0.0/24 is subnetted, 1 subnets

O E2 101.1.1.0 [110/20] via 12.1.1.1, 00:01:15, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O IA 4.4.4.4 [110/3] via 23.1.1.2, 00:01:15, FastEthernet1/0

O E2 201.1.1.0/24 [110/20] via 23.1.1.2, 00:01:15, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O IA 5.5.5.5 [110/4] via 23.1.1.2, 00:01:15, FastEthernet1/0

O E2 200.1.1.0/24 [110/20] via 23.1.1.2, 00:01:15, FastEthernet1/0

O E2 202.1.1.0/24 [110/20] via 23.1.1.2, 00:01:16, FastEthernet1/0

45.0.0.0/24 is subnetted, 1 subnets

O IA 45.1.1.0 [110/3] via 23.1.1.2, 00:01:16, FastEthernet1/0

可以看到,一大堆的路由條目,那麼接下來開始配置:

R1(config)#router ospf 100

R1(config-router)#area 1 nssa

R1(config)#end


R2(config)#router ospf 100

R2(config-router)#area 1 nssa no-summary

R2(config-router)#end

配置後的路由信息:

R1#

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.2 [110/2] via 12.1.1.2, 00:01:21, FastEthernet0/0

O*IA 0.0.0.0/0 [110/2] via 12.1.1.2, 00:01:21, FastEthernet0/0


R2#

34.0.0.0/24 is subnetted, 1 subnets

O IA 34.1.1.0 [110/2] via 23.1.1.2, 00:02:22, FastEthernet1/0

102.0.0.0/24 is subnetted, 1 subnets

O N2 102.1.1.0 [110/20] via 12.1.1.1, 00:02:22, FastEthernet0/0

1.0.0.0/32 is subnetted, 1 subnets

O 1.1.1.1 [110/2] via 12.1.1.1, 00:02:22, FastEthernet0/0

100.0.0.0/24 is subnetted, 1 subnets

O N2 100.1.1.0 [110/20] via 12.1.1.1, 00:02:22, FastEthernet0/0

3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.3 [110/2] via 23.1.1.2, 00:02:32, FastEthernet1/0

101.0.0.0/24 is subnetted, 1 subnets

O N2 101.1.1.0 [110/20] via 12.1.1.1, 00:02:22, FastEthernet0/0

4.0.0.0/32 is subnetted, 1 subnets

O IA 4.4.4.4 [110/3] via 23.1.1.2, 00:02:22, FastEthernet1/0

O E2 201.1.1.0/24 [110/20] via 23.1.1.2, 00:02:22, FastEthernet1/0

5.0.0.0/32 is subnetted, 1 subnets

O IA 5.5.5.5 [110/4] via 23.1.1.2, 00:02:22, FastEthernet1/0

O E2 200.1.1.0/24 [110/20] via 23.1.1.2, 00:02:22, FastEthernet1/0

O E2 202.1.1.0/24 [110/20] via 23.1.1.2, 00:02:24, FastEthernet1/0

45.0.0.0/24 is subnetted, 1 subnets

O IA 45.1.1.0 [110/3] via 23.1.1.2, 00:02:24, FastEthernet1/0

可以看到,R2上雖然變化並不大,但是在R1上,優化掉了3,4,5類的LSA,由10條路由條目變為了2條路由條目,並且產生了一條O*IA的默認,指向ABR。

至此,nssa區域的優化示例結束,歡迎大家共同探討技術問題,關注瞭解更多,thank you !



分享到:


相關文章: