实验目的:
1、理解OSPF虚链路原理及何时需要使用虚链路。
2、掌握OSPF虚链路配置方法
实验拓扑:
步骤1:接口ip配置
R1(config)#interface f0/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R2(config)#interface f0/0
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface f0/1
R2(config-if)#ip address 23.23.23.2 255.255.255.0
R2(config-if)#no shutdown
R3(config)#interface f0/1
R3(config-if)#ip address 23.23.23.3 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface f0/0
R3(config-if)#ip address 34.34.34.3 255.255.255.0
R3(config-if)#no shutdown
R4(config)#interface f0/0
R4(config-if)#ip address 34.34.34.4 255.255.255.0
R4(config-if)#no shutdown
R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
步骤2:路由协议基本配置
R1(config)#router ospf 1
R1(config-router)#network 12.12.12.0 0.0.0.255 area 3
R1(config-router)#network 1.1.1.0 0.0.0.255 area 3
R2(config)#router ospf 1
R2(config-router)#network 12.12.12.0 0.0.0.255 area 3
R2(config-router)#network 23.23.23.0 0.0.0.255 area 2
R3(config)#router ospf 1
R3(config-router)#network 23.23.23.0 0.0.0.255 area 2
R3(config-router)#network 34.34.34.0 0.0.0.255 area 0
R4(config)#router ospf 1
R4(config-router)#network 34.34.34.0 0.0.0.255 area 0
R4(config-router)#network 4.4.4.0 0.0.0.255 area 1
查看R1、R2的ospf邻居表确认邻接关系建立情况:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
23.23.23.2 1 FULL/BDR 00:00:31 12.12.12.2 FastEthernet0/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
34.34.34.3 1 FULL/DR 00:00:34 23.23.23.3 FastEthernet0/1
1.1.1.1 1 FULL/DR 00:00:36 12.12.12.1 FastEthernet0/0
查看R1路由表:
R1#show ip route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, FastEthernet0/0
通过观察R1的路由表,R1的路由器无法学习到骨干区域、area 1和area 2区域的路由。造成这个问题的主要原因是:
area 3
区域与骨干区域area 0被分割
。
OSPF
的区域配置规则是:普通区域必须与骨干区域直连。
步骤3:当有这种问题出现时,可以使用虚链路的配置方案解决。使用虚链路可以确保非直连区域能够逻辑认为自己与骨干区域直连。在R2和R3上进行如下虚拟路的配置。
R2(config)#router ospf 1
R2(config-router)#area 2 virtual-link 34.34.34.3
//指出创建虚链路的对端R3路由器的router id
R3(config)#router ospf 1
R3(config-router)#area 2 virtual-link 23.23.23.2
查看R2邻居表
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
34.34.34.3 0 FULL/ - - 23.23.23.3 OSPF_VL2
34.34.34.3 1 FULL/DR 00:00:33 23.23.23.3 FastEthernet0/1
1.1.1.1 1 FULL/DR 00:00:34 12.12.12.1 FastEthernet0/0
查看R2的路由表,确认R2路由器已经学习其它区域的路由
R2#show ip route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
O 34.34.34.0 [110/2] via 23.23.23.3, 00:02:50, FastEthernet0/1
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 12.12.12.1, 00:03:06, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/3] via 23.23.23.3, 00:02:50, FastEthernet0/1
// R1路由器已经正确的学习到其它区域的路由。
23.0.0.0/24 is subnetted, 1 subnets
C 23.23.23.0 is directly connected, FastEthernet0/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.12.12.0 is directly connected, FastEthernet0/0
测试网络联通性
R1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/45/84 ms
本实验中出现的普通区域与骨干区域被分割。如果骨干区域被分割,也可以采用虚拟路的配置方法进行解决,其配置与本例本似
版权声明:本文为qq_43210022原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。