有些时候,由于区域包含的路由器过多或区域的地理位置原因等,造成网络中配置的OSPF区域(非area 0)不能够与area 0相连。大家都知道,在OSPF的所有区域内,area 0 是骨干区域,非0区域都要与area0相连,才能够得知其他网络的路由信息。如下图所示情况:


 

拓扑中的网络为192.168.X.0 /24area 2 不能与area 0直接相连,这样R5就不能够学习到area 0区域的路由。

 

基本配置:

R1:

 

 

R2:

 

 

R3:

 

 

R4:

 

 

R5:


进行OSPF协议配置。

R1(config)#router ospf 100
R1(config-router)#net 192.168.1.0 0.0.0.255 a 0
R1(config-router)#net 1.1.1.0 0.0.0.255 a 0
R1(config-router)#exit

R2(config)#router ospf 100
R2(config-router)#net 192.168.1.0 0.0.0.255 a 0
R2(config-router)#net 192.168.2.0 0.0.0.255 a 1
R2(config-router)#net 2.2.2.0 0.0.0.255 a 1
R2(config-router)#exit

R3(config)#router ospf 100
R3(config-router)#net 192.168.2.0 0.0.0.255 a 1
R3(config-router)#net 192.168.3.0 0.0.0.255 a 1
R3(config-router)#net 3.3.3.0 0.0.0.255 a 1
R3(config-router)#exit

R4(config)#router ospf 100
R4(config-router)#net 192.168.3.0 0.0.0.255 a 1
R4(config-router)#net 192.168.4.0 0.0.0.255 a 2
R4(config-router)#net 4.4.4.0 0.0.0.255 a 2
R4(config-router)#exit
R5(config)#router ospf 100
R5(config-router)#net 192.168.4.0 0.0.0.255 a 2
R5(config-router)#net 5.5.5.0 0.0.0.255 a 2
R5(config-router)#exit

查看路由表:


没有Area 2的路由

解决方法1、

在R2和R4之间建立虚链路,使Area 2的type 3类的LSA可以到达Area 0区。

配置方法:

R2(config)#router ospf 100
R2(config-router)#area 1 virtual-link 4.4.4.4
R2(config-router)#exit


R4(config)#router ospf 100
R4(config-router)#area 1 virtual-link 2.2.2.2
R4(config-router)#exit

 

 

在查看路由表:

 

 

成功。

解决方法2、

在R2和R4之间使用隧道技术,在将隧道发布到Area 0中。

配置方法:

R2(config)#interface tunnel 1
R2(config-if)#tunnel source 192.168.2.1
R2(config-if)#tunnel destination 192.168.3.2
R2(config-if)#ip add 192.168.5.1 255.255.255.0
R2(config-if)#exit

R2(config-if)#router ospf 100

R2(config-router)#net 192.168.5.1 0.0.0.0 a 0

R2(config-if)#exit

 

R4(config)#int tunnel 1
R4(config-if)#tunnel source 192.168.3.2
R4(config-if)#tunnel destination 192.168.2.1
R4(config-if)#ip add 192.168.5.2 255.255.255.0
R4(config-if)#exit

R4(config-if)#router ospf 100

R4(config-router)#net 192.168.5.2 0.0.0.0 a 0

R4(config-if)#exit

 

 

查看路由表:

 

 

以经学到全,网路由,实验成功。