一、实验目的:
1、掌握OSPF虚链路的配置
二、实验拓扑:
三、实验步骤
1、如图配置OSPF网络,配置如下:
R1:
R1(config)#int s1/1
R1(config-if)#ip add 172.16.224.1 255.255.255.0
R1(config-if)#no shut
R1(config)#int loop 0
R1(config-if)#ip add 172.16.1.3 255.255.255.0
R1(config)#int loop 1
R1(config-if)#ip add 172.16.0.3 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 172.16.224.0 0.0.0.255 area 51
R1(config-router)#network 172.16.0.0 0.0.0.255 area 0
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0
R1(config-router)#
R2:
R2(config)#int s1/0
R2(config-if)#ip add 172.16.224.2 255.255.255.0
R2(config-if)#no shut
R2(config)#int s1/2
R2(config-if)#ip add 172.16.240.1 255.255.255.0
R2(config-if)#no shut
R2(config)#int loop 0
R2(config-if)#ip add 172.16.3.1 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#network 172.16.224.0 0.0.0.255 area 51
R2(config-router)#network 172.16.3.0 0.0.0.255 area 51
R2(config-router)#network 172.16.240.0 0.0.0.255 area 3
R3:
R3(config)#int s1/1
R3(config-if)#ip add 172.16.240.2 255.255.255.0
R3(config-if)#no shut
R3(config)#int loop 0
R3(config-if)#ip add 172.16.252.1 255.255.255.0
R3(config)#int loop 1
R3(config-if)#ip add 172.16.248.1 255.255.255.0
R3(config)#router ospf 1
R3(config-router)#network 172.16.240.0 0.0.0.255 area 3
2、使用show ip route、show ip ospf nei查看OSPF配置结果。
R1#
R1#sh ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C 172.16.224.0/24 is directly connected, Serial1/1
C 172.16.0.0/24 is directly connected, Loopback1
C 172.16.1.0/24 is directly connected, Loopback0
l 172.16.3.1/32 [110/65] via 172.16.224.2, 00:02:52, Serial1/1
R1#sh ip ospf nei detail
Neighbor 172.16.3.1, interface address 172.16.224.2
In the area 51 via interface Serial1/1
Neighbor priority is 0, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:31
Neighbor is up for 00:04:08
Index 1/1, 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
R2#sh ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 172.16.240.0/24 is directly connected, Serial1/2
C 172.16.224.0/24 is directly connected, Serial1/0
O IA 172.16.1.3/32 [110/65] via 172.16.224.1, 00:01:20, Serial1/0
C 172.16.3.0/24 is directly connected, Loopback0
O IA 172.16.0.3/32 [110/65] via 172.16.224.1, 00:01:20, Serial1/0
R2#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
172.16.252.1 0 FULL/ - 00:00:37 172.16.240.2 Serial1/2
172.16.1.3 0 FULL/ - 00:00:39 172.16.224.1 Serial1/0
R3#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.252.0 is directly connected, Loopback0
C 172.16.248.0 is directly connected, Loopback1
C 172.16.240.0 is directly connected, Serial1/1
R3#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
172.16.3.1 0 FULL/ - 00:00:34 172.16.240.1 Serial1/1
R3无法学习到OSPF的路由,但是和R2又形成了邻接的关系,状态是FULL,为什么?因为R3并没有连接到主干区域area 0。所以必须在Area3和Area0之间建立一条虚链路。
3、在Area3和Area0之间建立一条虚链路。其实就是在R1、R2上进行配置:
R1(config)#router ospf 1
R1(config-router)#area 51 virtual-link 172.16.3.1
R2(config)#router ospf 1
R2(config-router)#area 51 virtual-link 172.16.1.3
配置完后,用命令查看R3的路由表。
R3#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks
C 172.16.252.0/24 is directly connected, Loopback0
C 172.16.248.0/24 is directly connected, Loopback1
C 172.16.240.0/24 is directly connected, Serial1/1
O IA 172.16.224.0/24 [110/128] via 172.16.240.1, 00:00:10, Serial1/1
O IA 172.16.3.1/32 [110/65] via 172.16.240.1, 00:00:10, Serial1/1
O IA 172.16.1.3/32 [110/129] via 172.16.240.1, 00:00:01, Serial1/1
O IA 172.16.0.3/32 [110/129] via 172.16.240.1, 00:00:00, Serial1/1
已经可以看到R3学习到了OSPF的路由进程。
4、用命令sh ip ospf virtual-links查看虚链路。
R1#sh ip ospf virtual-links
Virtual Link OSPF_VL1 to router 172.16.3.1 is up//提示虚链路配置成功
Run as demand circuit
DoNotAge LSA allowed.
Transit area 51, via interface Serial1/1, Cost of using 64
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 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
R1#sh ip ospf nei de
Neighbor 172.16.3.1, interface address 172.16.224.2
In the area 0 via interface OSPF_VL1
Neighbor priority is 0, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options is 0x72
LLS Options is 0x1 (LR)
Neighbor is up for 00:01:27
Index 1/2, 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
Neighbor 172.16.3.1, interface address 172.16.224.2
In the area 51 via interface Serial1/1
Neighbor priority is 0, State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options is 0x52
LLS Options is 0x1 (LR)
Dead timer due in 00:00:35
Neighbor is up for 00:11:54
Index 1/1, 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
可以看到去往邻居172.16.3.1的两条链路,其中第一条是虚链路。
本文转自 独钩寒江雪 51CTO博客,原文链接:http://blog.51cto.com/bennie/430013,如需转载请自行联系原作者