观察OSPF虚链路和虚链路的替代办法

一个小实验,观察OSPF虚链路、虚链路的替代办法。

拓扑图:

ScreenCaputure230316225301

如上图所示,右边 AREA 2、3、4 普通区域被 AREA 1 分割。

要求:不改动物理连线的方式配置设备,使得 R1 学习到 R6、R7、R8上的路由。

方式一:R2 – R3 间配置跨 AREA 1 的虚链路

方式二:R2 – R4 间配置 Tunnel 隧道,配置宣告

方式三:R5 上 配置 AREA 4 在另一个 OSPF 进程,配置重分布


方式一

!--- R2 commands.

router ospf 100
 area 1 virtual-link 3.3.3.3
 
!--- R3 commands.

router ospf 100
 area 1 virtual-link 2.2.2.2

方式二

!--- R2 commands.

!
interface Tunnel0
 ip address 100.1.1.1 255.255.255.252
 tunnel source 24.1.1.2
 tunnel destination 24.1.1.4
!
router ospf 100
 # 将Tunnel接口地址宣告进区域0
 network 100.1.1.1 0.0.0.0 area 0
!
 
!--- R4 commands.

interface Tunnel0
 ip address 100.1.1.2 255.255.255.252
 tunnel source 24.1.1.4
 tunnel destination 24.1.1.2
!
router ospf 100
 # 将Tunnel接口地址宣告进区域0
 network 100.1.1.2 0.0.0.0 area 0
!

方式三

R5#sh run | s r o
router ospf 100
 router-id 5.5.5.5
 # 重分布
 redistribute ospf 200 subnets
 network 5.5.5.5 0.0.0.0 area 1
 network 25.1.1.5 0.0.0.0 area 1
 
# 配置 AREA  4 在另一个 OSPF 进程
router ospf 200
 router-id 55.55.55.55
 # 重分布
 redistribute ospf 100 subnets
 network 58.1.1.5 0.0.0.0 area 4
R5#

观察

R1 上查看 OSPF 路由,发现能学习到 R6,R7,R8上的环回口路由;Tunnel接口的地址也被学习到,而且是 O 表项路由属于区域 0 ,R8 的路由因为在R5 上进行了双向重分布显示为 OE2 表项。 R6,R7 则是区域间路由,逻辑上的直连区域0。

R1#sh ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/11] via 12.1.1.2, 00:26:14, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O IA     3.3.3.3 [110/21] via 12.1.1.2, 00:25:54, Ethernet0/0
      4.0.0.0/32 is subnetted, 1 subnets
O IA     4.4.4.4 [110/21] via 12.1.1.2, 00:26:03, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
O IA     5.5.5.5 [110/21] via 12.1.1.2, 00:26:03, Ethernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
O IA     6.6.6.6 [110/31] via 12.1.1.2, 00:25:54, Ethernet0/0
      7.0.0.0/32 is subnetted, 1 subnets
O IA     7.7.7.7 [110/1021] via 12.1.1.2, 00:25:53, Ethernet0/0
      8.0.0.0/32 is subnetted, 1 subnets
O E2     8.8.8.8 [110/11] via 12.1.1.2, 00:25:53, Ethernet0/0
      23.0.0.0/24 is subnetted, 1 subnets
O IA     23.1.1.0 [110/20] via 12.1.1.2, 00:26:14, Ethernet0/0
      24.0.0.0/24 is subnetted, 1 subnets
O IA     24.1.1.0 [110/20] via 12.1.1.2, 00:26:14, Ethernet0/0
      25.0.0.0/24 is subnetted, 1 subnets
O IA     25.1.1.0 [110/20] via 12.1.1.2, 00:26:14, Ethernet0/0
      36.0.0.0/24 is subnetted, 1 subnets
O IA     36.1.1.0 [110/30] via 12.1.1.2, 00:25:54, Ethernet0/0
      47.0.0.0/24 is subnetted, 1 subnets
O IA     47.1.1.0 [110/1020] via 12.1.1.2, 00:26:14, Ethernet0/0
      58.0.0.0/24 is subnetted, 1 subnets
O E2     58.1.1.0 [110/10] via 12.1.1.2, 00:25:54, Ethernet0/0
      100.0.0.0/30 is subnetted, 1 subnets
O        100.1.1.0 [110/1010] via 12.1.1.2, 00:26:14, Ethernet0/0
R1# 

R2上查看 OSPF 邻居,发现除常规的邻居外,还有Tunnel0 的邻居和虚链路的邻居,两种邻居的区别在于虚链路邻居一旦邻居建立处于稳定状态,不发送hello报文,而且Dead Time 永不超时。而Tunnel0 的邻居有Dead Time 默认40秒,debug 查看 hello 会发现*Mar 16 15:24:11.782: OSPF-100 HELLO Tu0: Rcv hello from 4.4.4.4 area 0 100.1.1.2,好像没什么用,好看

R2#sh ip os nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:30    100.1.1.2       Tunnel0
1.1.1.1           1   FULL/BDR        00:00:32    12.1.1.1        Ethernet0/0
3.3.3.3           0   FULL/  -           -        23.1.1.3        OSPF_VL0
5.5.5.5           1   FULL/DR         00:00:33    25.1.1.5        Ethernet0/3
4.4.4.4           1   FULL/DR         00:00:34    24.1.1.4        Ethernet0/2
3.3.3.3           1   FULL/DR         00:00:37    23.1.1.3        Ethernet0/1
R2#

R8上查看路由表,因为在R5上进行了重分布,R5是ASBR。所有看到的OSPF路由表项都是 OE

R8#sh ip rou os
Codes: L - local, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O E2     1.1.1.1 [110/21] via 58.1.1.5, 00:41:42, Ethernet0/0
      2.0.0.0/32 is subnetted, 1 subnets
O E2     2.2.2.2 [110/11] via 58.1.1.5, 00:41:42, Ethernet0/0
      3.0.0.0/32 is subnetted, 1 subnets
O E2     3.3.3.3 [110/21] via 58.1.1.5, 00:41:42, Ethernet0/0
      4.0.0.0/32 is subnetted, 1 subnets
O E2     4.4.4.4 [110/21] via 58.1.1.5, 00:41:42, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
O E2     5.5.5.5 [110/1] via 58.1.1.5, 00:41:42, Ethernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
O E2     6.6.6.6 [110/31] via 58.1.1.5, 00:41:41, Ethernet0/0
      7.0.0.0/32 is subnetted, 1 subnets
O E2     7.7.7.7 [110/31] via 58.1.1.5, 00:01:46, Ethernet0/0
      12.0.0.0/24 is subnetted, 1 subnets
O E2     12.1.1.0 [110/20] via 58.1.1.5, 00:41:42, Ethernet0/0
      23.0.0.0/24 is subnetted, 1 subnets
O E2     23.1.1.0 [110/20] via 58.1.1.5, 00:41:42, Ethernet0/0
      24.0.0.0/24 is subnetted, 1 subnets
O E2     24.1.1.0 [110/20] via 58.1.1.5, 00:41:42, Ethernet0/0
      25.0.0.0/24 is subnetted, 1 subnets
O E2     25.1.1.0 [110/10] via 58.1.1.5, 00:41:42, Ethernet0/0
      36.0.0.0/24 is subnetted, 1 subnets
O E2     36.1.1.0 [110/30] via 58.1.1.5, 00:41:42, Ethernet0/0
      47.0.0.0/24 is subnetted, 1 subnets
O E2     47.1.1.0 [110/30] via 58.1.1.5, 00:01:46, Ethernet0/0
      100.0.0.0/30 is subnetted, 1 subnets
O E2     100.1.1.0 [110/1010] via 58.1.1.5, 00:41:42, Ethernet0/0
R8#
R8# sh ip os border-routers 

            OSPF Router with ID (8.8.8.8) (Process ID 200)


                Base Topology (MTID 0)

Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route

i 55.55.55.55 [10] via 58.1.1.5, Ethernet0/0, ASBR, Area 4, SPF 2
R8#