ospf虚链路:
虚连接是指在两台ABR之间,穿过一个非骨干区域(转换区域——Transit Area),建立的一条逻辑上的链接通道,可以理解为两台ABR之间存在一个点对点的链接。“逻辑通道”是指两台ABR之间的多台运行OSPF的路由器只是起到一个转发报文的作用(由于协议报文的目的地址不是这些路由器,所以这些报文对于它们是透明的,只是当做普通的IP报文来转发),两台ABR之间直接传递路由信息。这里的路由信息是指由ABR生成的type3的LSA,区域内的路由器同步方式没有因此改变。
建立虚链路的条件:
1)由于网络的拓扑结构比较复杂,无法满足每个区域必须和骨干区域直接连接,所以要在没有与area 0相连的区域做虚链路
2)公司合并,原公司都有自己的骨干区域,但公司规模比较大,重新规划太艰难,所以就在两个area 0做虚链路
虚链路的缺点:
Virtual-link不稳定,一般基本不用,除非迫于没有其他办法,虚链路是最后的办法
虚链路实验:
R10配置:
R10(config-if)#ip address 1.1.1.1
R10(config-if)#ip address 1.1.1.1 255.255.255.255
R10(config-if)#no shutdown
R10(config-if)#exit
R10(config)#interface serial 1/0
R10(config-if)#ip address 192.168.1.1 255.255.255.0
R10(config-if)#no shutdown
R10(config-if)#exit
R10(config)#router ospf 1
R10(config-router)#network 192.168.1.0 0.0.0.255 area 0
R11配置:
R11(config)#interface loopback 1
R11(config-if)#ip address 2.2.2.2 255.255.255.255
R11(config-if)#no shutdown
R11(config)#interface serial 1/0
R11(config-if)#ip address 192.168.1.2 255.255.255.0
R11(config-if)#no shutdown
R11(config-if)#exit
R11(config)#interface serial 1/1
R11(config-if)#ip address 192.168.2.1 255.255.255.0
R11(config-if)#no shutdown
R11(config-if)#exit
R11(config)#router ospf 1
R11(config-router)#network 192.168.1.0 0.0.0.255 area 0
R11(config-router)#network 192.168.2.0 0.0.0.255 area 1
R12配置:
R12(config)#interface loopback 1
R12(config-if)#ip address 3.3.3.3 255.255.255.255
R12(config-if)#no shutdown
R12(config-if)#exit
R12(config)#interface serial 1/1
R12(config-if)#ip address 192.168.2.2 255.255.255.0
R12(config-if)#no shutdown
R12(config-if)#exit
R12(config)#interface serial 1/2
R12(config-if)#ip address 192.168.3.1 255.255.255.0
R12(config-if)#no shutdown
R12(config-if)#exit
R12(config)# router ospf 1
R12(config-router)#network 192.168.2.0 0.0.0.255 area 1
R12(config-router)#network 192.168.3.0 0.0.0.255 area 2
R13配置:
R13(config-if)#ip address 4.4.4.4 255.255.255.255
R13(config-if)#no shutdown
R13(config-if)#exit
R13(config)#interface serial 1/2
R13(config-if)#ip address 192.168.3.2 255.255.255.0
R13(config-if)#no shutdown
R13(config-if)#exit
R13(config)#router ospf 1
R13(config-router)#network 192.168.3.0 0.0.0.255 area 2
在area 1上做虚链路
R12:
R11(config)#router ospf 1
R11(config-router)#area 1 virtual-link 3.3.3.3
R13:
R12(config)#router ospf 1
R12(config-router)#area 1 virtual-link 2.2.2.2
做完虚链路之后各路由的路由表:
R10的路由表:
R10#show 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
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback1
C 192.168.1.0/24 is directly connected, Serial1/0
O IA 192.168.2.0/24 [110/128] via 192.168.1.2, 00:01:48, Serial1/0
O IA 192.168.3.0/24 [110/192] via 192.168.1.2, 00:01:48, Serial1/0(学到了区域2的路由)
R11的路由表:
R11#show 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
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback1
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/1
O IA 192.168.3.0/24 [110/128] via 192.168.2.2, 00:05:51, Serial1/1(学到了区域2的路由)
R12的路由表:
R12#show 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
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback1
O 192.168.1.0/24 [110/128] via 192.168.2.1, 00:06:53, Serial1/1
C 192.168.2.0/24 is directly connected, Serial1/1
C 192.168.3.0/24 is directly connected, Serial1/2(学到了区域2的路由,虽然R12和R13是直连的,但因为两个都不是骨干区域,所以不做虚链路是不会相互学习到路由的)
R13的路由表:
R13#show 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
4.0.0.0/32 is subnetted, 1 subnets
C 4.4.4.4 is directly connected, Loopback1
O IA 192.168.1.0/24 [110/192] via 192.168.3.1, 00:07:26, Serial1/2(学到了区域0的路由)
O IA 192.168.2.0/24 [110/128] via 192.168.3.1, 00:07:46, Serial1/2(学到了区域1的路由)
C 192.168.3.0/24 is directly connected, Serial1/2
查看虚链路的基本信息:
R11#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 3.3.3.3 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 1, 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: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
查看ospf数据库:
R12#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 862 (DNA) 0x80000003 0x0016A6 2
2.2.2.2 2.2.2.2 5 (DNA) 0x80000005 0x00CA20 3
3.3.3.3 3.3.3.3 829 0x80000002 0x00431F 1
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.2.0 2.2.2.2 1034 (DNA) 0x80000002 0x000682
192.168.2.0 3.3.3.3 839 0x80000001 0x00E99B
192.168.3.0 3.3.3.3 839 0x80000001 0x00DEA5
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 830 0x80000006 0x00178F 2
3.3.3.3 3.3.3.3 829 0x80000005 0x00B8E9 2
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 2.2.2.2 1864 0x80000002 0x001178
192.168.3.0 3.3.3.3 841 0x80000001 0x00DEA5
Router Link States (Area 2)
Link ID ADV Router Age Seq# Checksum Link count
3.3.3.3 3.3.3.3 841 0x80000005 0x000598 2
4.4.4.4 4.4.4.4 1637 0x80000003 0x00A5F5 2
Summary Net Link States (Area 2)
Link ID ADV Router Age Seq# Checksum
192.168.1.0 3.3.3.3 816 0x80000001 0x0077CE
192.168.2.0 3.3.3.3 841 0x80000001 0x00E99B
(以上输出表明虚链路的路由被拉进区域0,并带有‘DNA’标记,表示不老化)
转载于:https://blog.51cto.com/tianhaoblog/1260818