wKiom1ZYU52D5vxjAAD-9Ow8cic029.png

1.配置各台路由器的IP地址,并且使用ping命令确认各路由器的直连口的互通性

2.首先配置R2R3R4ospf协议,配置过程中注意区域号

3.完成配置后,查看R1 的路由表

R1#sho ip route

Gateway of lastresort is not set

      172.16.0.0/16 is variably subnetted, 6subnets, 3 masks

C        172.16.1.0/24 is directly connected,Loopback0

L        172.16.1.1/32 is directly connected,Loopback0

C        172.16.255.0/30 is directly connected,Serial1/0

L        172.16.255.1/32 is directly connected,Serial1/0

O IA     172.16.255.4/30 [110/128] via172.16.255.2, 00:00:49, Serial1/0  R1仅学到area2的路由


4.查看R2的路由

R2#sho ip route

Gateway of lastresort is not set

      172.16.0.0/16 is variably subnetted, 6subnets, 3 masks

O        172.16.1.1/32 [110/65] via172.16.255.1, 00:02:08, Serial1/0 R2仅学到R1所在area 0的路由

C        172.16.255.0/30 is directly connected,Serial1/0

L        172.16.255.2/32 is directly connected,Serial1/0

C        172.16.255.4/30 is directly connected,Serial1/1

L        172.16.255.5/32 is directly connected,Serial1/1

5.查看R3的路由

R3#sho ip route

Gateway of lastresort is not set

      172.16.0.0/16 is variably subnetted, 5subnets, 3 masks

O IA     172.16.16.1/32 [110/65] via 172.16.255.10,00:04:49, Serial1/1 R3仅学到area 1的路由

C        172.16.255.0/24 is directly connected,Serial1/1

                         is directly connected,Serial1/0

L        172.16.255.6/32 is directly connected,Serial1/0

L        172.16.255.9/32 is directly connected,Serial1/1


6.查看R4的路由

R4#sho ip route

Gateway of lastresort is not set

      172.16.0.0/16 is variably subnetted, 5subnets, 3 masks

C        172.16.16.0/24 is directly connected,Loopback0

L        172.16.16.1/32 is directly connected,Loopback0

C        172.16.255.0/24 is directly connected,Serial1/0

O IA     172.16.255.4/30 [110/192] via 172.16.255.9,00:02:59, Serial1/0  R4仅学到area 2 的路由

L        172.16.255.10/32 is directly connected,Serial1/0


7.通过以上查看,发现任何一台路由器都无法学习到完整的网络路由。产生此问题的主要原因是:骨干区域被area2分割,造成整个网络变成两个ospf的自治系统,所以相互之间都无法学习完整的路由


8.这种情况下,可以通过配置虚电路来解决骨干区域被分割的问题,在R2 R3的路由上实施如下配置:

R2(config)#routerospf 1

R2(config-router)#area2 virtual-link 172.16.255.9   创建虚电路,命令中的area 2 指出一条虚电路存在于area 2中,Vritual-link 172.16.255.9指出创建虚电路的对端R3 的路由器的router id

 

R3(config)#routerospf 1

R3(config-router)#area2 virtual-link 172.16.255.5  配置到R2 路由器的虚电路

9,查看任意一台路由器,确认路由学习情况,

R1#sho iproute   

    Gateway of last resort is not set

      172.16.0.0/16 is variably subnetted, 6subnets, 3 masks

C        172.16.1.0/24 is directly connected,Loopback0

L        172.16.1.1/32 is directly connected,Loopback0

O IA     172.16.255.0/24 [110/192] via172.16.255.2, 00:30:21, Serial1/0

O        172.16.255.8/30 [110/128] via172.16.255.2, 00:14:19, Serial1/0 

C        172.16.255.0/30 is directly connected,Serial1/0

L        172.16.255.1/32 is directly connected,Serial1/0

O IA     172.16.16.1/32 [110/193] via 172.16.255.2,00:30:21, Serial1/0 此时R1 已经学习到完整的网络路由。


10.此时,无法学习完整的路由问题已经被解决。Ospf Vritual-link 不仅可以解决普通区域与骨干区域非直连问题,还可以解决骨干被分割的问题,但是,此类问题一般是由网络迁移或是本身设计问题所造成的,ospf的虚电路仅仅是一种 网络过渡的解决方案。