2、掌握OSPF 虚链路配置方法
如图,Area 0 不连续,配置好各设备IP地址信息,和基本的动态路由协议信息,测试好互连地址可达。
查看各路由器路由表:
R1#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
C 172.16.255.0/30 is directly connected, Serial0/0
O IA 172.16.255.4/30 [110/128] via 172.16.255.2, 00:01:14, Serial0/0
C 172.16.1.0/24 is directly connected, Loopback0
R1仅学习到去往Area 2的路由。
R2#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
C 172.16.255.0/30 is directly connected, Serial0/0
C 172.16.255.4/30 is directly connected, Serial0/1
O 172.16.1.1/32 [110/65] via 172.16.255.1, 00:03:02, Serial0/0
R2仅学习到去往R1回环地址的路由。
R3#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
C 172.16.255.4/30 is directly connected, Serial0/0
C 172.16.255.8/30 is directly connected, Serial0/1
O IA 172.16.16.1/32 [110/65] via 172.16.255.10, 00:02:20, Serial0/1
R3仅学习到去往R4回环地址的路由。
R4#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O IA 172.16.255.4/30 [110/128] via 172.16.255.9, 00:02:33, Serial0/0
C 172.16.255.8/30 is directly connected, Serial0/0
C 172.16.16.0/24 is directly connected, Loopback0
R4仅学习到去往Area 2的路由。
结果表明:任何一台路由器都不能完整地学习到网络中的路由信息,产生此问题的原因是:骨干区域被区域2分割,造成整个网络变成两个OSPFR的自治系统,所以相互之间都不能学习到完整的路由信息。
可以通过配置虚链路来解决骨干被分割的问题。
在R2和R3上按如下配置:
R2(config)#router ospf 1
R2(config-router)#area 2 virtual 172.16.255.9
----->area 2指出虚链路存在于区域2中,使用的是router-id
R2(config-router)#exit 配置到R3的路由器虚链路
R3(config)#router ospf 1
R3(config-router)#area 2 virtual 172.16.255.5
----->配置到R2的路由器虚链路
R3(config-router)#exit
再随意选择一台路由器查看路由表:
R1#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 5 subnets, 3 masks
C 172.16.255.0/30 is directly connected, Serial0/0
O IA 172.16.255.4/30 [110/128] via 172.16.255.2, 00:05:50, Serial0/0
O 172.16.255.8/30 [110/192] via 172.16.255.2, 00:05:50, Serial0/0
O IA 172.16.16.1/32 [110/193] via 172.16.255.2, 00:05:50, Serial0/0
C 172.16.1.0/24 is directly connected, Loopback0
路由表已经完整。
测试:
R1#ping 172.16.16.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.16.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/60/92 ms
R1#ping 172.16.255.9
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.255.9, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/53/108 ms
R1#ping 172.16.255.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.255.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/49/60 ms
往返可达。
此时,无法学习完整的路由问题已经被解决。OSPF Virtual Link 不仅可以解决普通区域与骨干区域非直接问题,还可以解决骨干被分割问题。但是,此类问题一般都是由于网络迁移或是本身设计问题所造成的。OSPF 的虚链路仅仅是一种网络过渡的解决方案。