OSPF虛鏈路 配置實例 + 詳細驗證過程
這個配置將驗證一個OSPF虛電路(Virtual-Link)的過程,重點在觀察虛鏈路連接的臨時網路與正常區域間路由
有何區別。上圖中區域4 (area 4)沒有和area 0直接相連。在R2與R3之間配置了一條虛鏈路。
// R1 //
int lo0
ip ad 1.1.1.1 255.255.255.0
int e0
ip ad 192.1.1.1 255.255.255.0
router os 1
network 192.1.1.0 0.0.0.255 area 0
// R2 //
int lo0
ip ad 2.2.2.2 255.255.255.0
int e0
ip ad 192.1.1.2 255.255.255.0
int e1
ip ad 193.1.1.2 255.255.255.0
router os 1
network 192.1.1.0 0.0.0.255 area 0
network 193.1.1.0 0.0.0.255 area 1
// R3 //
int lo0
ip ad 3.3.3.3 255.255.255.0
int e1
ip ad 193.1.1.3 255.255.255.0
int e0
ip ad 194.1.1.3 255.255.255.0
router os 1
network 193.1.1.0 0.0.0.255 area 1
network 194.1.1.0 0.0.0.255 area 4
// R4 //
int lo0
ip ad 4.4.4.4 255.255.255.0
int e0
ip ad 194.1.1.4 255.255.255.0
router os 1 network 194.1.1.0 0.0.0.255 area 4基本配置完成後,我們在每台路由器上分別來驗證一下:
r1#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:33 192.1.1.2 Ethernet0/0
r1#
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:19, Ethernet0/0
C 192.1.1.0/24 is directly connected, Ethernet0/0
//注意R1上有關於193.1.1.0的路由條目,是屬於IA類型(域間路由)
r2#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:35 192.1.1.1 Ethernet0/0
3.3.3.3 1 FULL/BDR 00:00:35 193.1.1.3 Ethernet1/0
r2#
r2#
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
r3#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:32 193.1.1.2 Ethernet1/0
4.4.4.4 1 FULL/DR 00:00:34 194.1.1.4 Ethernet0/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:02:49, Ethernet1/0
C 194.1.1.0/24 is directly connected, Ethernet0/0
//注意R3中有關於192.1.1.0的路由是屬於IA類型(域間路由)
r4#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/BDR 00:00:33 194.1.1.3 Ethernet0/0
r4#sh ip ro 4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
C 194.1.1.0/24 is directly connected, Ethernet0/0
//R4上沒有關於AREA 0內的任何路由資訊我們下面在R2、R3上添加Virtual-link的配置:
R2: router os 1
area 1 virtual-link 3.3.3.3
R3:
router os 1
area 1 virtual-link 2.2.2.2
對比之前的路由資訊,看有何區別: 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:01, Ethernet0/0 C 192.1.1.0/24 is directly connected, Ethernet0/0
O IA 194.1.1.0/24 [110/30] via 192.1.1.2, 00:00:01, Ethernet0/0
//多了一條194網段的路由,類型IA(區域間)
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
O IA 194.1.1.0/24 [110/20] via 193.1.1.3, 00:00:06, Ethernet1/0
//多了一條194網段路由,類型為IA(區域間)
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 192.1.1.0/24 [110/20] via 193.1.1.2, 00:02:56, Ethernet1/0
C 194.1.1.0/24 is directly connected, Ethernet0/0
//R3的192路由原本為IA類型(區域間),現在轉為O類型(區域內),說明R3認為自已與192網段是直連的。虛鏈路相當於將R3直接連接了AREA 0 與 AREA 4區域
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/20] via 194.1.1.3, 00:03:40, Ethernet0/0 O IA 192.1.1.0/24 [110/30] via 194.1.1.3, 00:03:25, Ethernet0/0
C 194.1.1.0/24 is directly connected, Ethernet0/0
//R4上192路由類型IA(區域間)
最後我們將虛鏈路效果再與正常連接方式進行一下比對,如下圖:
驗證如下: 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:41, Ethernet0/0 C 192.1.1.0/24 is directly connected, Ethernet0/0 C 192.2.2.0/24 is directly connected, Ethernet1/0
O IA 194.1.1.0/24 [110/20] via 192.2.2.4, 00:00:39, Ethernet1/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 O 192.2.2.0/24 [110/20] via 192.1.1.1, 00:01:04, Ethernet0/0
O IA 194.1.1.0/24 [110/30] via 192.1.1.1, 00:00:03, Ethernet0/0
r2#
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:31, Ethernet1/0 O IA 192.2.2.0/24 [110/30] via 193.1.1.2, 00:01:15, Ethernet1/0
O IA 194.1.1.0/24 [110/40] via 193.1.1.2, 00:00:15, 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/30] via 192.2.2.1, 00:00:39, Ethernet1/0 O 192.1.1.0/24 [110/20] via 192.2.2.1, 00:01:37, Ethernet1/0 C 192.2.2.0/24 is directly connected, Ethernet1/0
C 194.1.1.0/24 is directly connected, Ethernet0/0
r5#sh ip ro 5.0.0.0/24 is subnetted, 1 subnets C 5.5.5.0 is directly connected, Loopback0 O IA 193.1.1.0/24 [110/40] via 194.1.1.4, 00:00:52, Ethernet0/0 O IA 192.1.1.0/24 [110/30] via 194.1.1.4, 00:00:52, Ethernet0/0 O IA 192.2.2.0/24 [110/20] via 194.1.1.4, 00:00:52, Ethernet0/0
C 194.1.1.0/24 is directly connected, Ethernet0/0 如果上述方式還不容易理解,你也可以將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
.msgcontent .wsharing ul li { text-indent: 0; }
分享
Facebook
Plurk
YAHOO!