虛連線(Virtual-link ):由於網路的拓撲結構複雜,有時無法滿足每個區域必須和骨幹區域直接相連的要求,為解決此問題,OSPF提出了虛鏈路的概念。
虛連線是設定在兩個路由器之間,這兩個路由器都有一個連線埠與同一個非主幹區域相連。虛連線被認為是屬於主幹區域的,在OSPF路由協定看來,虛連線兩端的兩個路由器被一個點對點的鏈路連線在一起。在OSPF路由協定中,通過虛連線的路由信息是作為域內路由來看待的。
命令分析
Router(config-router)#area transit area-id virtual-link router-id
1, 在OSPF的路由選擇配置模式下,
2, Transit area-id :轉換區域的區域號
3, Router-id :虛連線到目標的路由ID
4, 兩個ABR上都需要配置。
注意
如果其中一台路由器配置了虛連線,而另外一台沒有配置,則會提示這樣的信息。
*Mar 1 01:48:10.907: %OSPF-4-ERRRCV:Received invalid packet: mismatch area ID,from backbone area must be virtual-link but not found from 2.2.2.2,Serial0/1
如果配置成功則會提示這樣的信息
*Mar 1 00:41:32.795: %OSPF-5-ADJCHG: Process 3, Nbr 4.4.4.4 on OSPF_VL2 from LOADING to FULL, Loading Done
area area-id virtual-link router-id | Defines a virtual link between ABRs. |
如果上述方式還不容易理解,你也可以將virtual-link可以想像成:將R2與R3合併成一台路由器,如下圖:
r1#sh ip ro
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
O IA 193.1.1.0/24 [110/20] via 192.1.1.2, 00:00:57, Ethernet0/0
C 192.1.1.0/24 is directly connected, Ethernet0/0
O IA 194.1.1.0/24 [110/74] via 192.1.1.2, 00:00:24, Ethernet0/0
r2#sh ip ro
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
C 193.1.1.0/24 is directly connected, Ethernet1/0
C 192.1.1.0/24 is directly connected, Ethernet0/0
C 194.1.1.0/24 is directly connected, Serial2/0
r3#sh ip ro
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 193.1.1.0/24 is directly connected, Ethernet1/0
O IA 192.1.1.0/24 [110/20] via 193.1.1.2, 00:01:06, Ethernet1/0
O IA 194.1.1.0/24 [110/74] via 193.1.1.2, 00:00:37, Ethernet1/0
r4#sh ip ro
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
O IA 193.1.1.0/24 [110/74] via 194.1.1.2, 00:00:17, Serial2/0
O IA 192.1.1.0/24 [110/74] via 194.1.1.2, 00:00:17, Serial2/0
C 194.1.1.0/24 is directly connected, Serial2/0
Vani(config)#do sh ip osp v
Virtual Link OSPF_VL0 to router 3.3.3.3 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, via interface Ethernet0/1, Cost of using 10
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:06
Adjacency State FULL (Hello suppressed)
Index 2/3, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 mse
show ip ospf virtual-links | Displays information about OSPF virtual links. |
可以使用上述命令檢驗virtual-links 配置