Truman Boyes零与一

存档 · 路由

从 EIGRP 迁移到 OSPF

作者:Truman Boyes · · 6 分钟阅读

迟早企业会到达一个阶段,EIGRP不再适合作为内部网关协议(IGP)的首选路由协议。这通常是因为EIGRP本身的漏洞(卡在 active 状态的问题)、缺少流量工程能力,或者因为该协议是 Cisco 的专有协议,而企业希望在供应商选择上拥有更大的灵活性。那么如果不是 EIGRP,该选什么呢?实际上在选择 IGP 时基本只有另外两个选项:OSPF 或 ISIS。

我在尝试用 Dynamips 看看它在 MacBook Pro 上的表现,于是凑了一个小例子,演示如何把一个非常小的 EIGRP 网络迁移到 OSPF。基本思路是先收集拓扑细节,了解 OSPF 能否满足现有 EIGRP 网络的功能。EIGRP 与 OSPF 本质上差别很大,因此一些在 EIGRP 中的概念并不能直接搬到 OSPF,反之亦然。虽然 OSPF 有区域的概念可以形成层次结构,EIGRP 并没有完全相同的概念,尽管可以通过配置让它们看起来相似。换句话说,丰田不完全等同于雷克萨斯,即使它们有很多相同的功能和部件。

本实验的拓扑如下:

[原帖中的图片未被存档。]

仅启用 EIGRP(即保持现状)的相关路由配置如下:
R1:

router eigrp 1
redistribute connected
redistribute static
network 20.20.20.0 0.0.0.255
auto-summary
!
no ip http server
!
ip route 10.10.10.1 255.255.255.255 Null0
ip route 10.10.10.2 255.255.255.255 Null0
ip route 10.10.10.3 255.255.255.255 Null0

R2:

router eigrp 1
redistribute connected
redistribute static
network 20.20.20.0 0.0.0.255
auto-summary
!
no ip http server
!
ip route 10.10.20.1 255.255.255.255 Null0
ip route 10.10.20.2 255.255.255.255 Null0
ip route 10.10.20.3 255.255.255.255 Null0

R3:

router eigrp 1
redistribute connected
redistribute static
network 20.20.20.0 0.0.0.255
network 30.30.30.0 0.0.0.255
no auto-summary
!
no ip http server
!
ip route 10.10.30.1 255.255.255.255 Null0
ip route 10.10.30.2 255.255.255.255 Null0
ip route 10.10.30.3 255.255.255.255 Null0

已连接和静态路由会被重新分配到 EIGRP;它们会显示为外部 EIGRP 路由。下面是一个示例:

R3#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

100.0.0.0/32 is subnetted, 3 subnets
D EX 100.100.100.1 [170/2297856] via 20.20.20.5, 05:15:50, Serial2/0
D EX 100.100.100.2 [170/2297856] via 20.20.20.9, 05:15:59, Serial1/1
C 100.100.100.3 is directly connected, Loopback0
20.0.0.0/30 is subnetted, 3 subnets
C 20.20.20.4 is directly connected, Serial2/0
D 20.20.20.0 [90/2681856] via 20.20.20.9, 05:16:37, Serial1/1
[90/2681856] via 20.20.20.5, 05:16:37, Serial2/0
C 20.20.20.8 is directly connected, Serial1/1
10.0.0.0/32 is subnetted, 9 subnets
D EX 10.10.10.2 [170/2169856] via 20.20.20.5, 05:13:56, Serial2/0
D EX 10.10.10.3 [170/2169856] via 20.20.20.5, 05:13:53, Serial2/0
D EX 10.10.10.1 [170/2169856] via 20.20.20.5, 05:13:59, Serial2/0
D EX 10.10.20.1 [170/2169856] via 20.20.20.9, 05:14:24, Serial1/1
D EX 10.10.20.2 [170/2169856] via 20.20.20.9, 05:14:22, Serial1/1
D EX 10.10.20.3 [170/2169856] via 20.20.20.9, 05:14:19, Serial1/1
S 10.10.30.2 is directly connected, Null0
S 10.10.30.3 is directly connected, Null0
S 10.10.30.1 is directly connected, Null0

如果我们现在在 R1、R2、R3 上打开 OSPF,路由器会有的路由使用 OSPF,有的路由使用 EIGRP。这是为什么?原因在于内部 EIGRP 路由的管理距离为 90,外部 EIGRP 路由的管理距离为 170,而 OSPF 的管理距离为 110。我们的目标是打开 OSPF,但不影响实际的转发或路由表,然后在准备就绪后再切换到 OSPF。

首先在所有接口上以非常简单的单区域配置来设置 OSPF。

router ospf 1
log-adjacency-changes
redistribute connected subnets
redistribute static subnets
network 20.20.20.0 0.0.0.255 area 0
distance 255

注意我们把距离设为‘255’,这是在 IOS 中可以设置的最高管理距离。下面查看 OSPF 数据库,确保其中有我们需要填充路由表的信息:

R3#show ip ospf database

OSPF Router with ID (100.100.100.3) (Process ID 1)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
100.100.100.1 100.100.100.1 87 0×80000003 0×0071DF 4
100.100.100.2 100.100.100.2 106 0×80000002 0×00F750 4
100.100.100.3 100.100.100.3 168 0×80000004 0×00122A 4

Type-5 AS External Link States

Link ID ADV Router Age Seq# Checksum Tag
10.10.10.1 100.100.100.1 76 0×80000001 0×00054E 0
10.10.10.2 100.100.100.1 76 0×80000001 0×00FA57 0
10.10.10.3 100.100.100.1 76 0×80000001 0×00F060 0
10.10.20.1 100.100.100.2 96 0×80000001 0×0090B7 0
10.10.20.2 100.100.100.2 96 0×80000001 0×0086C0 0
10.10.20.3 100.100.100.2 96 0×80000001 0×007CC9 0
10.10.30.1 100.100.100.3 134 0×80000001 0×001C21 0
10.10.30.2 100.100.100.3 134 0×80000001 0×00122A 0
10.10.30.3 100.100.100.3 134 0×80000001 0×000833 0
100.100.100.1 100.100.100.1 86 0×80000001 0×0050F3 0
100.100.100.2 100.100.100.2 106 0×80000001 0×004002 0
100.100.100.3 100.100.100.3 152 0×80000001 0×003010 0

太好了!可以看到我们拥有所有需要的外部 LSA 和路由器 LSA。现在开始在每台路由器上切换到 OSPF,先从 R3 开始。我们会继续保留 EIGRP,以防出现问题,但通过把管理距离降低到‘85’来让 OSPF 路由优先,这个距离比内部和外部的 EIGRP 路由都小。

router ospf 1
log-adjacency-changes
redistribute connected subnets
redistribute static subnets
network 20.20.20.0 0.0.0.255 area 0
distance 85

然后我们检查路由表:

R3#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

    100.0.0.0/32 is subnetted, 3 subnets
O E2 100.100.100.1 [85/20] via 20.20.20.5, 00:00:38, Serial2/0
O E2 100.100.100.2 [85/20] via 20.20.20.9, 00:00:38, Serial1/1
C     100.100.100.3 is directly connected, Loopback0
    20.0.0.0/30 is subnetted, 3 subnets
C     20.20.20.4 is directly connected, Serial2/0
O     20.20.20.0 [85/128] via 20.20.20.9, 00:00:38, Serial1/1
        [85/128] via 20.20.20.5, 00:00:38, Serial2/0
C     20.20.20.8 is directly connected, Serial1/1
    10.0.0.0/32 is subnetted, 9 subnets
O E2   10.10.10.2 [85/20] via 20.20.20.5, 00:00:38, Serial2/0
O E2   10.10.10.3 [85/20] via 20.20.20.5, 00:00:38, Serial2/0
O E2   10.10.10.1 [85/20] via 20.20.20.5, 00:00:38, Serial2/0
O E2   10.10.20.1 [85/20] via 20.20.20.9, 00:00:38, Serial1/1
O E2   10.10.20.2 [85/20] via 20.20.20.9, 00:00:38, Serial1/1
O E2   10.10.20.3 [85/20] via 20.20.20.9, 00:00:38, Serial1/1
S     10.10.30.2 is directly connected, Null0
S     10.10.30.3 is directly connected, Null0
S     10.10.30.1 is directly connected, Null0

太棒了!现在我们只需要到每台路由器上执行相同的修改,然后在一切正常运行 OSPF 后把 EIGRP 删掉。整个网络都跑 OSPF 之后,就可以删除 OSPF 的管理距离,让它恢复到默认值“90”。


Originally published on truman.net. See the archived copy.