天天看點

BSCI—6:OSPF鍊路狀态通告(LSA)與虛鍊路(Virtual Links)配置

一、OSPF的七種類型LSA詳解

 1、路由器LSA (Router LSA):由區域内所有路由器産生,并且隻能在本個區域内泛洪廣播,這些最基本的LSA通告列出了路由器所有的鍊路和接口,并指明了它們的狀态和沿每條鍊路方向出站的代價。

2、網絡lsa (Network LSA):由區域内的DR或BDR路由器産生,封包包括DR和BDR連接配接的路由器的鍊路資訊,網絡LSA也僅僅在産生這條網絡LSA的區域内部進行泛洪。

3、網絡彙總LSA (Network Summary Lsa):由ABR産生,可以通知本區域内的路由器通往區域外的路由資訊,在一個區域外部但是仍然在一個ospf自治系統内部的預設路由也可以通過這種LSA來通告,如果一台ABR路由器經過骨幹區域從其他的ABR路由器收到多條網絡彙總LSA,那麼這台始發的ABR路由器将會選擇這些LSA通告中代價最低的LSA,并且将這個LSA的最低代價通告給與它相連的非骨幹區域。

4、ASBR彙總LSA (ASBR Summary LSA):也是由ABR産生,但是它是一條主機路由,指向asbr路由器位址的路由。

5、自治系統外部LSA (Autonomous System External LSA):由ASBR産生,告訴相同自治區的路由器通往外部自治區的路徑,自治系統外部LSA是惟一不和具體的區域相關聯的lsa通告,将在整個自治系統中進行泛洪 6、組成員LSA (Group Membership LSA):目前不支援多點傳播ospf (Mospf協定)

7、Nssa外部LSA (Nssa External LSA):由ASBR産生,幾乎和LSA 5通告是相同的,但Nssa外部LSA通告僅僅在始發這個Nssa外部LSA通告的非純末梢區域内部進行泛洪,在Nsa區域中,當有一個路由器是ASBR時,不得不産生LSA 5封包,但是Nssa中不能有LSA 5封包,所有ASBR産生LSA 7封包,發給本區域的路由器。

二、虛鍊路配置

思考:我們都知道在OSPF網絡當中必需有一個骨幹區域(AREA0),非骨幹區域必需與骨幹區域相連,但是我們在遇到網絡擴容的情況下,比如兩家公司網絡合并,在此之前他們各自都有自己的骨幹區域,那麼在不重新做網的情況下如何使在一個網絡兩中有兩個骨幹區域互連呢?

實驗拓撲如下:接口資訊及IP資訊已經标注,在R1與R2之間我們起AREA0,在R2與R3之間起AREA1,R3與R4之間還起AREA0,這是一個不合理的網絡,一個OSPF網絡不允許有兩個區域0,但使用虛鍊路這項技術之後可以解決此問題.

步驟一:如圖的示,配置4台路由器,并啟用OSPF,是否會出錯?

R1:

Router>

Router>en

Router#conf t

Router(config)#hostname R1

R1(config)#interface loopback 0

R1(config-if)#ip address 1.1.1.1 255.255.255.0

R1(config-if)#int 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)#router ospf 1      //啟用OSPF路由協定

R1(config-router)#router-id 1.1.1.1     //指定路由器ID

R1(config-router)#network 192.168.1.1 0.0.0.0 area 0     //釋出網段

R1(config-router)#network 1.1.1.1 0.0.0.0 area 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)#int f0/1

R2(config-if)#ip address 172.16.1.1 255.255.255.252

R2(config-if)#exit

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

R2(config-router)#router-id 2.2.2.2

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

R2(config-router)#network 172.16.1.0 0.0.0.3 area 1

R2(config-router)#end

R2#

R3:

Router(config)#hostname R3

R3(config)#interface f0/1

R3(config-if)#ip address 172.16.1.2 255.255.255.252

R3(config-if)#no sh

R3(config-if)#int f0/0

R3(config-if)#ip address 192.168.2.2 255.255.255.0

R3(config-if)#exit

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

R3(config-router)#router-id 3.3.3.3

R3(config-router)#network 172.16.1.0 0.0.0.3 area 1

R3(config-router)#network 192.168.2.2 0.0.0.0 area 0

R3(config-router)#end

R3#

R4;

Router(config)#hostname R4

R4(config)#interface f0/0

R4(config-if)#ip address 192.168.2.1 255.255.255.0

R4(config-if)#no sh

R4(config-if)#int lo0

R4(config-if)#ip address 4.4.4.4 255.255.255.0

R4(config-if)#exit

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

R4(config-router)#router-id 4.4.4.4

R4(config-router)#network 4.4.4.4 0.0.0.0 area 0

R4(config-router)#network 192.168.2.1 0.0.0.0 area 0

R4(config-router)#end

R4#

檢視R2與R3路由表:

R2#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/32 is subnetted, 1 subnets

O       1.1.1.1 [110/2] via 192.168.1.1, 00:05:30, FastEthernet0/0

     172.16.0.0/30 is subnetted, 1 subnets

C       172.16.1.0 is directly connected, FastEthernet0/1

C    192.168.1.0/24 is directly connected, FastEthernet0/0

//隻有1.1.1.1的路由,而沒有4.4.4.4的路由

------------------------------------------------------------------------------------------

R3#show ip route 

     4.0.0.0/32 is subnetted, 1 subnets

O       4.4.4.4 [110/2] via 192.168.2.1, 00:04:00, FastEthernet0/0

C    192.168.2.0/24 is directly connected, FastEthernet0/0

//隻有4.4.4.4的路由而沒有1.1.1.1的路由

注:它們隻能學習本路由器區域0的路由,可想而知R1與R4不可能互相學習.

步驟二:在區域1的兩台路由器R2,R3配置虛鍊路,并檢視路由表.

R2:

R2(config)#router ospf 1

R2(config-router)#area 1 virtual-link 3.3.3.3

//因為區域1中0區域之間的連接配接區域,是以在區域1上的路由分别指定對方的route-id。

R3:

R3(config)#router ospf 1

R3(config-router)#area 1 virtual-link 2.2.2.2

//同上

檢視路由表:

O       1.1.1.1 [110/2] via 192.168.1.1, 00:15:46, FastEthernet0/0

O       4.4.4.4 [110/3] via 172.16.1.2, 00:01:25, FastEthernet0/1

O    192.168.2.0/24 [110/2] via 172.16.1.2, 00:01:25, FastEthernet0/1

//R2已經有R4上的4.4.4.4的路由

O       1.1.1.1 [110/3] via 172.16.1.1, 00:01:51, FastEthernet0/1

O       4.4.4.4 [110/2] via 192.168.2.1, 00:11:18, FastEthernet0/0

O    192.168.1.0/24 [110/2] via 172.16.1.1, 00:01:51, FastEthernet0/1

//R3也有R1上的1.1.1.1的路由

步驟三:檢視R1與R4路由表,并且驗證是否能拼能.

R1#show ip route 

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

O       4.4.4.4 [110/4] via 192.168.1.2, 00:04:52, FastEthernet0/0

O IA    172.16.1.0 [110/2] via 192.168.1.2, 00:18:02, FastEthernet0/0

O    192.168.2.0/24 [110/3] via 192.168.1.2, 00:04:52, FastEthernet0/0

R4#show ip route 

O       1.1.1.1 [110/4] via 192.168.2.2, 00:05:33, FastEthernet0/0

     4.0.0.0/24 is subnetted, 1 subnets

C       4.4.4.0 is directly connected, Loopback0

O IA    172.16.1.0 [110/2] via 192.168.2.2, 00:15:00, FastEthernet0/0

O    192.168.1.0/24 [110/3] via 192.168.2.2, 00:05:33, FastEthernet0/0

在R4上驗證:

R4#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 = 21/50/81 ms

總結:但是虛鍊路始終不建議我們使用,因為它不穩定,它本身的設計也是針對這種不合理的網絡結構!

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