配置OSPF的虚链路(详细配置)

实验拓扑图:
 
 
下面是实验的详细配置:
 
LA:

Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname LA
LA(config)#int loopback 0
LA(config-if)#ip address 1.1.1.1 255.255.255.0
LA(config-if)#exit
LA(config)#int s0/0
LA(config-if)#ip address 192.1.1.1 255.255.255.0
LA(config-if)#no shut
LA(config-if)#exit
LA(config)#router ospf 64
LA(config-router)#network 192.1.1.0 0.0.0.255 area 0
LA(config-router)#end
LA#
 
 
LB:
Router>
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#  
Router(config)#hostname LB
LB(config)#int loopback 0
LB(config-if)#ip address 2.2.2.2 255.255.255.0
LB(config-if)#exit
LB(config)#int s0/0
LB(config-if)#ip address 192.1.1.2 255.255.255.0
LB(config-if)#clock rate 64000
LB(config-if)#no shut
LB(config-if)#exit
LB(config)#int s0/1
LB(config-if)#ip address 193.1.1.3 255.255.255.0
LB(config-if)#clock rate 64000
LB(config-if)#no shut
LB(config)#exit
LB#config t
Enter configuration commands, one per line.  End with CNTL/Z.
LB(config)#router ospf 64
LB(config-router)#network 192.1.1.0 0.0.0.255 area 0
LB(config-router)#network 193.1.1.0 0.0.0.255 area 1
LB(config-router)#end
LB#
 
 
LC:
Router>en
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname LC
LC(config)#int loopback 0
LC(config-if)#ip address 3.3.3.3 255.255.255.0
LC(config-if)#exit
LC(config)#int s0/1
LC(config-if)#ip address 193.1.1.1 255.255.255.0
LC(config-if)#clock rate 64000
LC(config-if)#no shut
LC(config-if)#exit
LC(config)#int s0/2
LC(config-if)#ip address 194.1.1.1 255.255.255.0
LC(config-if)#no keepalive  
    //no keepalive能使此接口不监测keepalive(存活)信号,从而在不连接任何设备的情况下,可以激活此接口。这样只是为我们配置和监测路由协议而设,在实际网络环境中是不应该使用该命令的
LC(config-if)#exit
LC(config)#router ospf 64
LC(config-router)#network 193.1.1.0 0.0.0.255 area 1
LC(config-router)#network 194.1.1.0 0.0.0.255 area 2
LC(config-router)#end

下面我们验证一下:
 
LA#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static 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
O IA 193.1.1.0/24 [110/96] via 192.1.1.2, 00:02:27, Serial0/0
C    192.1.1.0/24 is directly connected, Serial0/0
 
LA#ping 194.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 194.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

情况表明,没有路由到194.1.1.1

下面我们在LB和LC之间添加虚链路 看一下情况

LB#config t
Enter configuration commands, one per line.  End with CNTL/Z.
LB(config)#router ospf 64
LB(config-router)#area 1 virtual-link 3.3.3.3   //区域标识是传输区域,在这里是1, RID是虚链路另一头的路由器标识
LB(config-router)#end
LB#

LC
LC#config t
Enter configuration commands, one per line.  End with CNTL/Z.
LC(config)#router ospf 64
LC(config-router)#area 1 virtual-link 2.2.2.2
LC(config-router)#end
LC#
 
在LB与LC形成虚链路
 
验证一下:

LB#show ip ospf virtual-link
Virtual Link OSPF_VL1 to router 3.3.3.3 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Serial0/1, Cost of using 48
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:08
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 1
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 1, maximum is 1
    Last retransmission scan time is 0 msec, maximum is 0 msec
 
LC#show ip ospf virtual-link
Virtual Link OSPF_VL1 to router 2.2.2.2 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Serial0/1, Cost of using 48
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:07
    Adjacency State FULL (Hello suppressed)
    Index 1/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
 
情况表明:LC,LB之间确实形成虚链路

LA#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static 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
O IA 193.1.1.0/24 [110/96] via 192.1.1.2, 00:00:09, Serial0/0
C    192.1.1.0/24 is directly connected, Serial0/0
O IA 194.1.1.0/24 [110/144] via 192.1.1.2, 00:00:09, Serial0/0
LA#ping 194.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 194.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/60/88 ms
LA#
 
情况表明,到194.1.1.1的连通性正常。
 
 
实验有不足之处,请多多指教。

本文出自 “我是一只小小鸟” 博客,转载请与作者联系!

你可能感兴趣的:(Cisco,休闲,ospf,虚链路,路由技术)