一.虚链路的原理
1.概述
在OSPF区域中骨干区域必须连续,并且其他区域要和骨干区域相连,但是在实际网络中由于网络环境合并、网络设计部合理等造成了骨干区域不连续或非骨干区域没有和骨干区域相连的问题。如果更改OSPF区域内的所有路由器的配置,工作量较大,还会造成短时间的断网情况,这时,就需要使用虚链路连接没有连接在一起的而区域。
2.虚链路的目的与作用:
通过一个非骨干区域连接一个区域到骨干区域:
通过一个非骨干区域连接一个分段的骨干区域两边的部分区域:
虚链路实际上就是一个逻辑通道,数据包可以通过选择最优的路由路径从一端到达另一端。
在配置虚链路的时候,需要注意的是:
- 虚链路必须配置在两台ABR路由器之间;
- 虚链路经过的区域必须拥有全部的路由选择信息,这样的区域又称为传送区域;
- 传送区域不能使一个末梢区域(包括NSSA区域)必须是一个标准区域;
- 虚链路的稳定性取决于其经过区域的稳定性;
- 虚链路有助于提供逻辑冗余。
如果在现实工作环境中配置了一条虚链路,管路员应该仅仅把它用来修复无法避免的网络拓补问题的一个临时手段。虚链路可以看做一个表明OSPF区域的某个部分是否需要重新设计的标志。事实上。永久的虚链路的存在是一个设计比较差的OSPF区域的标志。
二.虚链路配置实验
1.网络拓补图
2.实验步骤
R1的接口配置
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
R1的ospf路由协议配置
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config-if)#ex
R1(config)#router os 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.10.0 0.0.0.255 area 2
R1(config-router)#network 192.168.20.0 0.0.0.255 area 2
查看R1的路由表(这是完全配置好的)
R1(config-router)#do show ip route
Codes: C - connected, S - static, 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
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 not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:00:23, FastEthernet0/1
C 192.168.10.0/24 is directly connected, FastEthernet0/0
O IA 192.168.40.0/24 [110/30] via 192.168.20.2, 00:00:07, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/1
O IA 192.168.50.0/24 [110/40] via 192.168.20.2, 00:00:07, FastEthernet0/1
R2的接口配置
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no shut
R2的ospf路由协议配置
R2(config-if)#ex
R2(config)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#router os 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.20.0 0.0.0.255 area 2
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1
配置R2通向R3的虚链路
R2(config-router)#area 1 virtual-link 3.3.3.3
查看R2的路由表
R2(config-router)#do show ip route
Codes: C - connected, S - static, 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
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 not set
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/1
O 192.168.10.0/24 [110/20] via 192.168.20.1, 00:29:10, FastEthernet0/0
O 192.168.40.0/24 [110/20] via 192.168.30.2, 00:28:42, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
O 192.168.50.0/24 [110/30] via 192.168.30.2, 00:28:42, FastEthernet0/1
R3的接口配置
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no shut
R3的ospf路由协议配置
R3(config-if)#ex
R3(config)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#ex
R3(config)#router os 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
R3(config-router)#network 192.168.40.0 0.0.0.255 area 0
配置R3通向R2的虚链路
R3(config-router)#area 1 virtual-link 2.2.2.2
查看R3的路由表
R3(config-router)#do show ip route
Codes: C - connected, S - static, 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
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 not set
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
C 192.168.30.0/24 is directly connected, FastEthernet0/0
O IA 192.168.10.0/24 [110/30] via 192.168.30.1, 00:31:27, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/1
O IA 192.168.20.0/24 [110/20] via 192.168.30.1, 00:31:27, FastEthernet0/0
O 192.168.50.0/24 [110/20] via 192.168.40.2, 00:38:10, FastEthernet0/1
R4
配置R4的接口
R4#conf t
R4(config)#int f0/0
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int f0/1
R4(config-if)#ip add 192.168.50.1 255.255.255.0
R4(config-if)#no shut
配置R4的ospf路由协议
R4(config-if)#ex
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#no shut
R4(config-if)#ex
R4(config)#router os 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#net 192.168.40.0 0.0.0.255 area 0
R4(config-router)#net 192.168.50.0 0.0.0.255 area 0
查看R4的路由表
R4(config-router)#do show ip route
Codes: C - connected, S - static, 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
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 not set
O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:41:36, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback0
O IA 192.168.10.0/24 [110/40] via 192.168.40.1, 00:34:43, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/0
O IA 192.168.20.0/24 [110/30] via 192.168.40.1, 00:34:43, FastEthernet0/0
C 192.168.50.0/24 is directly connected, FastEthernet0/1
配置PC1和PC2的IP地址和网关
PC1> ip 192.168.10.10 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1
PC2> ip 192.168.50.50 192.168.50.1
Checking for duplicate address...
PC1 : 192.168.50.50 255.255.255.0 gateway 192.168.50.1
3.实验结果
pc1和pc2互ping