上次说到OSPF建立虚链路解决跨区域的问题。但是虚链路解决这个问题是有局限的。我们先讨论一下它的局限性,与使用GRE建立遂道来解决这个问题。

还是用那个拓扑:

 

如果我们作了以下这个设置:

 

 
  
  1. R0(config-router)#area  1 stub  
  2.  
  3.  
  4. R1(config-router)#area  1 stub  

再想做虚链路时发生下面这种情况:

 
  
  1. R0(config-router)#area  1 virtual-link  2.2.2.2 
  2. % OSPF: Area 1 is a stub or nssa so virtual links are not allowed 

具体原理我不明白是为什么?但是我做 了一下猜想,STUB区域是不允许连接有外部网络的,通常情况下,STUB区域只能连接有一个区域,不知道这是不是它不能做为虚链路的原因。呵呵,这是乱猜的,应该是错误的。如果有人知道这个问题的话,请留下言告诉我一声,谢谢。

解决这个问题的方法就是使用GRE建立遂道了。配置如下:

R0:

 

 
  
  1. interface Tunnel0 
  2.  ip address 192.168.1.3 255.255.255.0 
  3.  tunnel source 12.1.1.1 
  4.  tunnel destination 12.1.1.2 
  5.  
  6.  
  7. router ospf 100 
  8.  router-id 1.1.1.1 
  9.   area 1 stub 
  10.   network 192.168.1.0 0.0.0.255 area 0 
  11. !          

R1:

 

 
  
  1. interface Tunnel0 
  2.  ip address 192.168.1.1 255.255.255.0 
  3.  tunnel source 12.1.1.2 
  4.  tunnel destination 12.1.1.1 
  5. !          
  6.  
  7. router ospf 100 
  8.   network 192.168.1.0 0.0.0.255 area 0 
  9. !          

 

这样便建立起遂道了。