OSPF的虚链路配置
 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
  
OSPF多区要求普通区域必须和骨干区域(area 0)相连,如果一个区域不能和骨干区域直接相连,可以使用虚链路把该区域逻辑上连接到骨干区域。
 
在这个实验中,我们把区域2连接到骨干区域,虚链路从区域1通过。
 
R1的配置
 Router> en
 Router# config  t
 Router(config)# host  R1
 R1(config)# int  e0/1
 R1(config-if)# ip  add  192.168.1.1  255.255.255.0 
 R1(config-if)# no  shut
 R1(config-if)# int  e0/0
 R1(config-if)# ip  add  192.168.2.1  255.255.255.0
 R1(config-if)# no  shut
 R1(config-if)# exit
 R1(config)# router  ospf  10
 R1(config-router)# net  192.168.1.1  <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0  a  0
 R1(config-router)# net  192.168.2.1  0.0.0.0  a  0
 R1(config-router)# end
 R1#
 
R2的配置
 Router> en
 Router# config  t
 Router(config)# host  R2
 R2(config)# int  e0/0
 R2(config-if)# ip  add  192.168.2.2  255.255.255.0 
 R2(config-if)# no  shut
 R2(config-if)# int  e0/1
 R2(config-if)# ip  add  192.168.3.1  255.255.255.0  
 R2(config-if)# no  shut
 R2(config-if)# exit
 R2(config)# router  ospf  10
 R2(config-router)# net  192.168.2.2  0.0.0.0  a  0
 R2(config-router)# net  192.168.3.1  0.0.0.0  a  1
 R2(config-router)# end
 R2# 
 
R3的配置
 Router> en
 Router# config  t
 Router(config)# host  R3
 R3(config)# int  e0/1
 R3(config-if)# ip  add  192.168.3.2  255.255.255.0
 R3(config-if)# no  shut
 R3(config-if)# int  e0/2
 R3(config-if)# ip  add  192.168.4.1  255.255.255.0
 R3(config-if)# no  shut
 R3(config-if)#exit
 R3(config)# router  ospf  10
 R3(config-router)# net  192.168.3.2  0.0.0.0  a  1
 R3(config-router)# net  192.168.4.1  0.0.0.0  a  1
 R3(config-router)# end
 R3#
 
R4的配置
 
Router> en
 Router# config  t
 Router(config)# host  R4
 R4(config)#i int  e0/2
 R4(config-if)# ip  add  192.168.4.2  255.255.255.0
 R4(config-if)# no  shut
 R4(config-if)# int  e0/3
 R4(config-if)# ip  add  192.168.5.1  255.255.255.0
 R4(config-if)# no  shut
 R4(config-if)# exit
 R4(config)# router  ospf  10
 R4(config-router)# net  192.168.4.2  0.0.0.0  a  1
 R4(config-router)# net  192.168.5.1  0.0.0.0  a  2
 R4(config-router)# end
 R4#
 
R5的配置
 Router> en
 Router# config  t
 Router(config)# host  R5
 R5(config)# int  e0/3
 R5(config-if)# ip  add  192.168.5.2  255.255.255.0
 R5(config-if)# no  shut
 R5(config-if)# int  e0/1
 R5(config-if)# ip  add  192.168.6.1  255.255.255.0
 R5(config-if)# no  shut
 R5(config-if)# exit
 R5(config)# router  ospf  10
 R5(config-router)# net  192.168.5.2  0.0.0.0  a  2
 R5(config-router)# net  192.168.6.1  0.0.0.0  a  2
 R5(config-router)# end
 R5# 
 
配置完成后,在R1、R2、R3、R5上用show  ip  route来查看路由表,路由表都不完整,只有R4的路由表是完整的。下面在R2(ABR)和R4(ABR)上配置虚链路
 
R2# config  t
 R2(config)# router  ospf  10
 R2(config-router)# area  1  virtual-link  192.168.5.1  (è192.168.5.1是R4的路由ID)
 R2(config-router)#end
 R2#
 
R4# config  t
 R4(config)# router  ospf  10
 R4(config-router)# area  1  virtual-link  192.168.3.1  (è192.168.3.1是R2的路由ID)
 R4(config-router)#end
 R4#
 
配置完成后,在R1、R2、R3、R4、R5上用show  ip  route来查看路由表,都能看有6条路由就是成功了!
 
转载于:https://blog.51cto.com/xiangruyimo/331847