// //
//

Loading

动态路由 - EIGRP

EIGRP 特性

EIGRP(增强内部网关路由协议)是思科的私有协议,属于距离矢量路由协议,但又具有链路状态的特性。并且支持 VLSM(可变长子网和无类路由协议)。但在本质上说还是传送路由条目。

具有如下的特性:

  • EIGRP 收敛速度快,依靠 DUAL 算法,无环路。EIGRP 能够做到比链路状态路由协议还要迅速的收敛,快速的响应拓扑变更。
  • 支持多种网络层协议,如 IP,IPX,Apple Talk. 协议报文直接封装在 IP 报文中,Protocol = 88,表示 ERGRP
  • 使⽤AS的概念,AS基于接⼝定义,⼀台EIGRP路由器可与属于多个AS. 但在实际场景中,一般一台设备只属于一个 AS.
  • 支持组播和单播,组播地址 244.0.0.10
  • 支持大型的网络,最大支持 255 跳,默认 100 跳。
  • 支持等价和非等级负载分摊, 目前只有 EIGRP 能够支持非等价的负载均衡。
  • 带宽占用不超过本地链路的 50%
  • 触发更新,部分更新,边界更新。只在邻居刚刚建立时发送一次完整更新,之后只发送更新的内容。
  • 支持认证

EIGRP 可靠传输的机制

EIGRP 可以实现可靠传输的机制:

通过思科私有算法 RTP,来实现数据包的可靠发送,该算法又称“可靠组播”。使用组播地址 224.0.0.10,每一个接受到可靠组播的数据包的邻居都会发送单播的数据包进行确认。

并且在组播发送时,每个数据包都是有序列号。

进而通过序列号和ACK来保证可靠性。

EIGRP 报文及通信过程

Hello 报文:不可靠传输,就是不用确认。发现邻居,建立邻居,维护(周期性发送)组播发送。

  • 高速链路(大于 1.544 Mbps)每 5s 发送一次,Hold 时间为 15 s.
  • 低速链路(小于 1.544 Mbps):60s,180s

Update 报文:传递路由更新,单播或组播发送,需要确认

  • 单播:当路由器收到某个邻居的第一个 HELLO 报文,以单播发送自己已知路由信息的 Update

  • 组播:当路由信息变化(路由增加或减少),以组播方式发送只包含变化信息的 Update

Query 报文:当路由失效后,且拓扑表没有 FS 时。向邻居发送查询,查询可行后继路由器。组播发送。当没有应答时,会触发 SIA-Query 查询。

Reply 报文:应答报文,单播发送。对 Query 报文的应答。

ACK 报文:确认报文。用来确认 Update,Query,Reply 报文,单播发送。

SIA-Query 报文:⽤于避免 SIA 超时导致邻居关系重置⽽发送的查询报⽂,单播发送

SIA-Reply:⽤于避免SIA超时导致邻居关系重置⽽发送的响应报⽂,单播发送

当路由器发送 Query 报文后,当 Active Timer 超过一半,会向邻居发送⼀个SIA Query报⽂。
如果邻居正在进⾏DUAL计算,则会回复⼀个SIA Reply报⽂,此时Active Timer置0,重新计时。
当计时器到⼀半时间后再次发送SIA Query,如果反复7次仍没有计算成功,则在
第8次180秒到期后,重置邻居关系。

总结一下通信过程:

  1. 周期性的发送组播 Hello 报文,建立邻居关系。
  2. 建立邻居后,发送 Update 报文传递路由(注意单播和组播)
  3. 邻居收到 Update 后,回复 ACK 确认,并将最优路由加入到路由表。
  4. 当路由失效后,重新进行路由计算。
    1. 有 FS,直接使用 FS 的路由
    2. 没有FS,发送 Query 报文给邻居,查询可行后继路由。

数据结构

邻居表:和路由器建⽴邻居关系的路由器

参数 解释
Address 邻居路由器的地址
H 路由器所建⽴的邻居的顺序号
Interface 本地到邻居的接⼝
Hold time 等待从邻居收到消息的时间
SRTT 平均回程时间(Smooth Round-Trip Time),⼀个EIGRP报⽂发送给邻居后到本地路由器从邻居收到确认报⽂所花费的时间。单位 ms。
RTO 重传超时(Retransmission Timeout,RTO),⼤概是SRTT的6倍,重新传输报⽂之前等待确认的时间,单位是ms
Q cnt 队列计数,等待发送的EIGRP报⽂数,如果这个数值持续⾼于0,说明⽹络发⽣了拥塞
Seq Num 从邻居收到的最新的更新、查询或应答数据包的序列号

在通过组播发送数据包时,如果没有从邻居收到 Ack 确认,那么这个数据包就会以单播⽅式被重新发送给那个没有响应的邻
居,如果重传16次还没得到确认,这个邻居就被宣布⽆效。

从组播⽅式切换到单播⽅式之前等待⼀个 Ack 时间由组播流计时器指定,后
续的单播之间的时间由重传超时 RTO 指定。

组播流计时器和重传超时都通过SRTT来计算。

Router#show ip eigrp neighbor
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface              Hold Uptime   SRTT   RTO  Q                                     Seq
                                                   (sec)         (ms)       Cnt                                    Num
2   14.1.1.2                Et0/2                    11 00:30:16    9   100  0                                     5
1   13.1.1.2                Et0/1                    11 00:31:13    9   100  0                                     15
0   12.1.1.2                Et0/0                    11 00:32:08    6   100  0                                     8

拓扑表:包含路由器学习到达⽬的地的所有路由条⽬

参数 描述
P:Passive 表示⽹络处于稳定状态。是⼀种⽬前有正确的路由到达⽬的地的状态。
当路由器失去了 S ⽽有⼀个 FS 时,或者再找到⼀个 FS 时,
该路由进⼊被动状态,表明是⼀条可⽤路由。
A:Active 表示当前⽹络不可⽤,正处于发送查询状态。
是⼀种正在搜索 FS 的状态,当路由器丢失了S,并且没有FS可⽤时,
该路由进⼊活动状态,是⼀条不可⽤的路由。当⼀条路由处于活动状态时,
路由器向所有邻居发送查询来寻找另外⼀条到达该⽬的地的路由。
U:Update 表示⽹络处于等待 Update 包确认的状态
Q:Query 表示⽹络处于等待 Query 包确认的状态
Reply Status 送了Query,收到了Ack,等待 Reply
SIA:Stuck-In-Active 表示⽹络持续处于 Active 状态,说明 EIGRP ⽹络收敛发⽣了问题
Router#show ip eigrp neighbor
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface              Hold Uptime   SRTT   RTO  Q  Seq
                                                   (sec)         (ms)       Cnt Num
2   14.1.1.2                Et0/2                    11 00:30:58    9   100  0  5
1   13.1.1.2                Et0/1                    12 00:31:55    9   100  0  15
0   12.1.1.2                Et0/0                    12 00:32:50    6   100  0  8

路由表:最佳路径的路由表

参数 描述
D 本⾃治系统⾥学到的路由
D EX 通过自治系统外的路由引入到 EIGRP 中,但因为有可能出现环路,所以 AD 较低
Router#show ip route
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

      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.1.1.0/24 is directly connected, Ethernet0/0
L        12.1.1.1/32 is directly connected, Ethernet0/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.1.1.0/24 is directly connected, Ethernet0/1
L        13.1.1.1/32 is directly connected, Ethernet0/1
      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        14.1.1.0/24 is directly connected, Ethernet0/2
L        14.1.1.1/32 is directly connected, Ethernet0/2
      25.0.0.0/24 is subnetted, 1 subnets
D        25.1.1.0 [90/332800] via 13.1.1.2, 00:15:43, Ethernet0/1
      35.0.0.0/24 is subnetted, 1 subnets
D        35.1.1.0 [90/307200] via 13.1.1.2, 00:26:24, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
D        45.1.1.0 [90/307200] via 14.1.1.2, 00:15:29, Ethernet0/2

相关术语

FD:可⾏距离,到达⼀个⽬的地的最⼩度量值

AD/RD:通告距离/报告距离,邻居路由器所通告的它⾃⼰到达某个⽬的地的最⼩度量值

FC:可⾏性条件,AD<FD,邻居路由器到达⽬的地的度量值必须⼩于本地路由器达到⽬的地的度量值

Successor:后继路由器,是⼀个直连的邻居路由器,它满⾜FC,通过它具有到达⽬的地的最⼩度量值,是去往⽬的地的下⼀跳

Feasible Successor:可⾏后继路由器,是⼀个邻居路由器,它满⾜FC,当主路由不可⽤时,FS⽤来代替主路由,当做备⽤路由。

S:后继路由器
满足 FC,且 CD 最小的路由

FS:可行后继路由器
满足 FC,但 CD 比 S 要大的路由

AD(RD):通告距离/报告距离
上游路由器通告给本地路由器,到达一个目标网络的距离

FD:可行距离
进入被动状态后,路由曾经拥有过的最小距离

CD:计算距离
本地路由器到达一个上游邻居的距离加上该上游邻居的 AD

FC(可行性条件)
FC 是 EIGRP 防止环路的重要参数,该条件为如果一条路由想要成为 FS,它的 AD 必须小于当前 FD。由于产生环路时,数据一定是经过了一定的路由器后又回到了某台路由器,这时,该路由累加的开销,一定会大于当前从这台路由器到达目的网络的开销。

路由选择过程

假设默认 metric 为图中的固定值,并且路由器刚启动 FD 默认为无穷大

以 R1 为视角,从 1.0 到 2.0 网络选择路由的过程:

router AD(RD):自己到目标网络的距离 CD: R1 到通告路由的距离
R2 30 60 = 30 + 30 (R1 到 R2 )
--- --- ---
R3 20 60 = 20 + 40
--- --- ---
R4 15 35 = 20 + 15
  1. 首先由于 CD 最小的是 R4 ,故 S 为 R4.

  2. 由于 FD 无穷大 ,故 FS 为 R2,R3

  3. 此时 FD 为 35,同时发现 R3 的 RD 为 40,大于 FD 所以将 R3 到 2.0 网络的这条路删除

通过这里可以看到,其实并没构成环路,所以 EIGRP 在消除环路时,也错误的隔离了一些正确的路径

如之前所提到的,一旦 S 出现问题,FS 就会马上替代

特殊情况一旦 FS 也变空,会将 FD 设为无限大

EIGRP 配置

# R1 开启 EIGRP 进程1(注意,这个 1 是AS号,与 OSPF 不同,如果AS号不一致,EIGRP无法建立邻居关系)
R1(config)# router eigrp 100
R1(config-router)# no au
R1(config-router)# network 14.1.1.1 0.0.0.0
R1(config-router)# network 15.1.1.1 0.0.0.0
R1(config-router)# network 13.1.1.1 0.0.0.0

# R2 , R3 ,R4 ,R5 同理
# 排错命令
R1# show ip route

# 查看有没有建立邻居关系
R1# show ip eigrp neighbor
R1# show ip protocol

# 查看 EIGRP 拓扑表的摘要信息
R1# show ip eigrp topology

Metric 计算

在路由器收到路由后,可能到达同一目的,有多条路由可以选择。这时就需要将最优的路由条目更新到路由表中,而 Metric 越低则表明该路由更优秀。

在这里,以 R1 的视角查看下路由表的信息:

Router#show ip route
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.1.1.0/24 is directly connected, Ethernet0/0
L        12.1.1.1/32 is directly connected, Ethernet0/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.1.1.0/24 is directly connected, Ethernet0/1
L        13.1.1.1/32 is directly connected, Ethernet0/1
      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        14.1.1.0/24 is directly connected, Serial1/0
L        14.1.1.1/32 is directly connected, Serial1/0
      25.0.0.0/24 is subnetted, 1 subnets
D        25.1.1.0 [90/307200] via 12.1.1.2, 00:00:11, Ethernet0/0
      35.0.0.0/24 is subnetted, 1 subnets
D        35.1.1.0 [90/307200] via 13.1.1.2, 00:00:11, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
D        45.1.1.0 [90/2221056] via 13.1.1.2, 00:00:11, Ethernet0/1
                  [90/2221056] via 12.1.1.2, 00:00:11, Ethernet0/0

可以发现去往 45 网络的下一跳接口为 R3 的 Ethernet0/0,并不是在距离看见来更短 R4 的 S1/0. 原因就在与经过计算后,走 R4 的 Metric 更大,因为所用接口为串行链路,相对于以太网链路带宽更小。那么 EIGRP 在计算机时会考虑哪些参数呢?

ERGRP 在计算 Metric 时,会考虑如下的参数:

  1. 带宽:路径上沿途出站接口上的最小带宽,单位为 kbit/s.

  2. 时延:路径上沿途出站接口上的时延综合,单位为 10 微秒。1000000μs = 1s,1000μs = 1ms。

Router#show interface e 0/0
Ethernet0/0 is up, line protocol is up
  Hardware is AmdP2, address is aabb.cc00.5000 (bia aabb.cc00.5000)
  Internet address is 25.1.1.2/24
  MTU 1500 bytes, BW 10000 Kbit/sec, DLY 1000 usec, => 带宽为 10000 kbit/sec

Router#show interface s 1/0
Serial1/0 is up, line protocol is up
  Hardware is M4T
  Internet address is 45.1.1.2/24
  MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec => 带宽为 1544 kbit/sec

可手动修改带宽和时延, 仅在计算 Metric 时有意义,并无法真正改变物理带宽:

# modify bandwidth
Router(config-if)#bandwidth 10000

# modify delay,unit is 10 microseconds
Router(config-if)#delay 10 # actually delay is 100
  1. 可靠性:动态的度量参数,描述出错率,最大值为 255,表示 100% 可靠。1 表示 1% 可靠。

  2. 负载:基于单位时间内发送的包率,描述占用率。1 表示最小负载。255 表示 100% 负载。

  3. 最大传输单元:不参与计算,但会记录。最小 MTU.

计算公式,负载和可靠性,在人工配置后会参与计算:

FIGURE 2-7

但由于默认,K1, K3 等于 1,K2, K4, K5 等于 0. 所以公式可简化为:

FIGURE 2-8

带宽:路径上沿途出站接口上的最小带宽

时延:时延求和

这里举个例子。求 R1 通过 R4 到 R5 的 45 网络的 metric 值,途经两个接口:

(10^7 / 1544 + 20000 * 2 / 10) * 256 = 2681856

# 可以看到计算的没有问题
Router#show ip eigrp topology
P 45.1.1.0/24, 1 successors, FD is 2221056
        P 45.1.1.0/24, 2 successors, FD is 2221056
        via 12.1.1.2 (2221056/2195456), Ethernet0/0
        via 13.1.1.2 (2221056/2195456), Ethernet0/1
        via 14.1.1.2 (2681856/2169856), Serial1/0

负载均衡

等价负载:到达同一目的有多条路径,且 Metric 一样

# EIGRP中默认为4条,可通过命令修改,最⼤数量根据IOS版本不同⽽不同。
R1(config)#router eigrp 100
R1(config-router)#maximum-paths 32

非等价负载:到达同一目的有多条路径,且 Metric 不同

# 通过设置 variance (差异变量)来进行非等价负载分担,默认为 1,最大为 128
# 如果某条路由的 Metric 小于 FD * variance 的值,表示该路由可用。
R1(config)# router eigrp 100
R1(config-router)# variance 6

比如这里如果想让 R4 两端接口的串行链路,可以作为非等价负载分摊的路由:

  1. 首先修改带宽和时延,让其计算出的值 AD 小于 FD 称为后继路由器
  2. 修改 variance 值,使其 metric 小于 FD * variance 的值

Traffic Share:

由于 Metric 值小的路由表示链路状态更好,所以在负载均衡时希望 Metric 值小的路由传输更多的流量。

# 默认开启
R1(config)#router eigrp 100
R1(config-router)#traffic-share balanced

当配置 traffic-share min across-interfaces 命令时,表示路由表中有多条路径,流量也只通过最低成本的路径发送。

R1(config)#router eigrp 100
R1(config-router)#traffic-share min across-interfaces

Auto Summary

当路由器存在多个网络时,如果希望在传输路由时,将其汇总成一个大网段进行发送,可以设置汇总。

有两种方式:

  • 自动汇总

    • 只能将本地路由汇总,不会汇总邻居的路由, 路由将被汇总为主类⽹络,为防⽌路由递归,进⾏汇总的设备会
      ⾃动产⽣⼀条指向 Null0 接⼝的路由。
  • 手动汇总

    • ⽀持本地以及邻居传递过来的路由汇总。为防⽌路由递归,进⾏汇总的设备会⾃动产⽣⼀条指向Null0接⼝的路由。

      • R2(config)#interface e0/1
        R2(config-if)#ip summary-address eigrp 100 10.1.0.0 255.255.252.0

  • 同时配置⾃动汇总和⼿⼯汇总,优先发送⾃动汇总的路由。

开启汇总后的设备会自动产生一个 NULL 开头的接口,用于防止环路。

看这样一个场景,一般在公司内部都有一台路由器和 ISP 连接,用于通过外网进行通信,这里以 R5 表示。

通常会在这台路由器上配置一条默认路由将无法识别的报文,扔给 ISP 的接口。假设区域内的路由器运行 EIGRP 协议,则该默认路由会自动分发给其他的路由器进行学习。

此时假设 R1 的某个接口出现问题,丢失了一个网段。而此时路由器中是汇总后的网络段,依然会正常传递数据。

假设 R2 给 R1 传输数据,但原来 R1 网段已经 down,所以它也无法处理,正常来说该数据包就会被丢弃了。

但由于默认路由的存在,又会将该数据包扔给 R2,此时 R2 收到又会将数据包传给 R1,形成环路。

为了解决这个问题,会增加一个网段是汇总网段 NULL0 接口,在匹配默认路由前,会先匹配 NULL0,匹配成功后把该数据包丢弃。

配置

在 R1 路由器上增加多个网络,开启汇总:

自动汇总

# R1 增加四个网络,并宣告
Router#show ip route
      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C        10.1.0.0/24 is directly connected, Loopback0
L        10.1.0.1/32 is directly connected, Loopback0
C        10.2.0.0/24 is directly connected, Loopback1
L        10.2.0.1/32 is directly connected, Loopback1
C        10.3.0.0/24 is directly connected, Loopback2
L        10.3.0.1/32 is directly connected, Loopback2
C        10.4.0.0/24 is directly connected, Loopback3
L        10.4.0.1/32 is directly connected, Loopback3
Router(config)#router eigrp 100
Router(config-router)#network 10.0.0.0 0.255.255.255

# 在 R5 查看,增加对应的网段
Router5#show ip route
      10.0.0.0/8 is variably subnetted, 9 subnets, 3 masks
D        10.0.0.0/8 is a summary, 00:03:30, Null0
C        10.1.0.0/24 is directly connected, Loopback0
L        10.1.0.1/32 is directly connected, Loopback0
C        10.2.0.0/24 is directly connected, Loopback1
L        10.2.0.1/32 is directly connected, Loopback1
C        10.3.0.0/24 is directly connected, Loopback2
L        10.3.0.1/32 is directly connected, Loopback2
C        10.4.0.0/24 is directly connected, Loopback3
L        10.4.0.1/32 is directly connected, Loopback3
      12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
D        12.0.0.0/8 is a summary, 00:03:30, Null0
C        12.1.1.0/24 is directly connected, Ethernet0/0
L        12.1.1.1/32 is directly connected, Ethernet0/0
      13.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
D        13.0.0.0/8 is a summary, 00:03:30, Null0
C        13.1.1.0/24 is directly connected, Ethernet0/1
L        13.1.1.1/32 is directly connected, Ethernet0/1
      14.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
D        14.0.0.0/8 is a summary, 00:03:30, Null0
C        14.1.1.0/24 is directly connected, Serial1/0
L        14.1.1.1/32 is directly connected, Serial1/0
      25.0.0.0/24 is subnetted, 1 subnets
D        25.1.1.0 [90/307200] via 12.1.1.2, 03:46:59, Ethernet0/0
      35.0.0.0/24 is subnetted, 1 subnets
D        35.1.1.0 [90/307200] via 13.1.1.2, 03:46:59, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
D        45.1.1.0 [90/2221056] via 13.1.1.2, 03:46:59, Ethernet0/1
                  [90/2221056] via 12.1.1.2, 03:46:59, Ethernet0/0

# 在 R1 打开自动汇总
R1(config)#router eigrp 100
R1(config-router)# auto-summary

# 在 R5 上再次查看,可以看到汇总成 10.0.0.0/8 的大网络
Router#show ip route
      10.0.0.0/8 is subnetted, 1 subnets
D        10.0.0.0 [90/435200] via 35.1.1.1, 00:00:25, Ethernet0/1
                  [90/435200] via 25.1.1.1, 00:00:25, Ethernet0/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

手动汇总:

Router(config-router)#no auto-summary
# 手动汇总支持本地和邻居的路由
# 在 R2 上手动汇总
Router(config-if)#ip summary-address eigrp 1 10.1.0.0 255.252.0.0

# 在 R5 上查看
      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D        10.0.0.0/14 [90/486400] via 35.1.1.1, 00:00:34, Ethernet0/1
D        10.1.0.0/24 [90/435200] via 35.1.1.1, 00:06:32, Ethernet0/1
                     [90/435200] via 25.1.1.1, 00:06:32, Ethernet0/0
D        10.2.0.0/24 [90/435200] via 35.1.1.1, 00:06:32, Ethernet0/1
                     [90/435200] via 25.1.1.1, 00:06:32, Ethernet0/0
D        10.3.0.0/24 [90/435200] via 35.1.1.1, 00:06:32, Ethernet0/1
                     [90/435200] via 25.1.1.1, 00:06:32, Ethernet0/0
D        10.4.0.0/24 [90/435200] via 35.1.1.1, 00:06:32, Ethernet0/1
                     [90/435200] via 25.1.1.1, 00:06:32, Ethernet0/0

被动接口

路由器的某个接口会与交换机建立连接,而交换机通过会下挂多台 PC. 由于在路由器上运行如 EIGRP 类似的协议,会周期性的发送 Hello 报文,这些报文会通过交换机发送给 PC,但这些报文对于交换机和 PC 来说,并没有意义,反而会占用带宽,所以可将和交换机连接的端口设置成被动接口。

当不希望从某个接⼝向外发送路由更新时,可以将该接⼝配置为被动接⼝,配置以后,被动接⼝将不接收、不发送任何EIGRP报⽂。

R1(config)#router eigrp 100
R1(config-router)#passive-interface e0/0

缺省路由注入

如之前的 R5 所示,通常和 ISP 相连,用于将自己不知道的网段发送给 ISP 在外网上传输。所以就需要将 R5 配置的默认路由引入到其他路由器中。

路由重分布

# 在AS的边界路由器上配置缺省路由,再将此缺省路由重分布到EIGRP域内。
R5(config)#ip route 0.0.0.0 0.0.0.0 56.1.1.6
R5(config)#router eigrp 100
R5(config-router)#redistribute static

手动汇总进行下发

在AS的边界路由器连接内⽹的接⼝,通过⼿⼯路由汇总实现缺省路由下放。

R5(config)#interface e0/0
R5(config-if)#ip summary-address eigrp 100 0.0.0.0 0.0.0.0

认证

EIGRP协议能够配置认证来验证邻居/消息的合法性,EIGRP 仅⽀持 MD5 加密认证,也是 EIGRP 协议唯⼀⽀持的认证⽅式。

区分加密和认证:

加密:通过如 DES,3DES 等算法加密后生成一段密文

认证:对数据完整性进行检查有没有被篡改

配置:

# 创建钥匙链
R1(config)#key chain test
R1(config-keychain)#key 1
R1(config-keychain-key)#key-string cisco

# 接⼝下开启认证并调⽤钥匙链
R1(config)#interface e0/0
R1(config-if)#ip authentication mode eigrp 100 md5
R1(config-if)#ip authentication key-chain eigrp 100 test

EIGRP Stub

为了减少⽹络不稳定的⻛险,抑制某些设备查询报⽂过多,引起“卡在活动状态”的情形发⽣,可以将某些设备配置为Stub路由器

看如下的场景:

这里假设在 R1,R3 和 R5 之间已经建立了 EIGRP 的邻居关系后,突然 R1 到 R3 的网络不可用,而此时没有 FS (后继路由器),所以 R3 就会给 R5 发送 Query 消息,获取后继路由器。

但这时 R5 并没给出回复,R3 一直等待,但 R1 和 R3 之间的网络突然有恢复了,但此时 R3 到 R1 的拓扑表中依然是 Active 状态。也是是说,即使⽹络恢复了,也依然不 Passive 稳定的状态。

为了解决这样的问题,通常会在末节路由器(即边缘设备)配置成 Stub 设备。

Stub 的特性:

  1. ⼀台具有EIGRP Stub邻居的路由器,将不会向它的 Stub 邻居发送查询。
    • 查询也没有意义,因为在边缘
  2. 配置为Stub的路由器与⾮Stub路由器邻居关系不受影响,只影响路由的传递。
    • 配置为Stub路由器后,默认只发送本地路由和汇总路由。

配置:

R1(config)#router eigrp 100
# 隐含了connected summary, 也就是说默认发送 connected 和 summary 路由 
R1(config-router)#eigrp stub
Router#show running-config | s  router
router eigrp 1
 network 12.1.1.0 0.0.0.255
 network 13.1.1.0 0.0.0.255
 network 14.1.1.0 0.0.0.255
 eigrp stub connected summary

# 如果想要开启 stub 的设备传递静态路由
Router(config-router)#eigrp stub redistributed

# 如果想要开启直连,汇总,重分布需要一起
Router(config-router)#eigrp stub summary connected redistributed

# 查看 stub 邻居
R3# show ip eigrp neighbor detail
Router#show ip eigrp neighbor detail
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface              Hold Uptime   SRTT   RTO  Q  Seq
                                                   (sec)         (ms)       Cnt Num
1   13.1.1.1                Et0/0                    13 00:02:07   15   100  0  32
   Version 23.0/2.0, Retrans: 0, Retries: 0, Prefixes: 2
   Topology-ids from peer - 0
   Topologies advertised to peer:   base

   Stub Peer Advertising (CONNECTED SUMMARY ) Routes
   Suppressing queries
0   35.1.1.2                Et0/1                    12 02:15:20  272  1632  0  33
   Version 23.0/2.0, Retrans: 1, Retries: 0, Prefixes: 3
   Topology-ids from peer - 0
   Topologies advertised to peer:   base

命名 EIGRP

在某些较新的IOS版本⽀持命名EIGRP配置,名字区分⼤⼩写。

相⽐较传统EIGPR配置,命名版有以下优点:

  • 所有配置在⼀个地⽅完成
  • IPv4、IPv6版本的 EIGRP 配置统⼀,向后兼容
  • ⽀持⾼速链路(更宽范围的Metric)

新的 Metric 计算方式

(K1 × Bandwidth + K2 × Bandwidth / (256 - load) + K3 × delay + K6 × Extended Attributes) × K5 / (Reliability+K4) × 65536

系数 K1-K6 是可配置的加权值,缺省值为:K1=K3=1,K2=K4=K5=K6=0

公式简化:

(K1 × Bandwidth + K2 × Bandwidth / (256 - load) + K3 × delay) × 65536  = 
(Bandwidth + delay) × 65536 EIGRP_Bandwidth = 10^7 / min_Bandwidth

EIGRP_Dealy = Sum(Link_Delay / 10000000)

命名EIGRP延迟单位为⽪秒(Picosecond),1000000ps=1μ

配置

地址族下配置, 为了适应多个 IP 版本:

R1(config)#router eigrp cisco
R1(config-router)#address-family ipv4 unicast autonomous-system 100
R1(config-router-af)#network 12.1.1.1 0.0.0.0
R1(config-router-af)#network 13.1.1.1 0.0.0.0
R1(config-router-af)#network 14.1.1.1 0.0.0.0
R1(config-router-af)#eigrp stub connected summary

地址族接⼝配置模式:

R1(config-router-af)#af-interface e0/0
R1(config-router-af-interface)#summary-address 10.1.0.0 255.255.252.0
R1(config-router-af-interface)#authentication mode md5
R1(config-router-af-interface)#authentication key-chain cisco
R1(config-router-af-interface)#exit
R1(config-router-af)#af-interface loopback 0
R1(config-router-af-interface)#passive-interface
R1(config-router-af-interface)#exit

地址族拓扑库配置模式:

R1(config-router-af)#topology base
R1(config-router-af-topology)#variance 6
R1(config-router-af-topology)#exit

可以发现由之前的分开配置,变成现在的全在 #address-family ipv4 unicast autonomous-system 100 下进行配置。

IPV6 EIGRP 配置

EIGRP for IPv6和IPv4在原理上没有区别:

同样使⽤DUAL算法,有邻居的机制,⽀持认证,⽀持汇总,采⽤组播更新、触发更新、部分更新。

配置区别

  1. EIGRP for IPv6 需要⼀个Router ID(如果没有IPv4地址,需要⼿⼯配置RID),用来唯一标识路由器
    • 在 IPv4 没有配置,会自动生成
    • 有环回接口,则使用最大 IP
    • 没有换回接口,使用物理接口最大 IP
  2. EIGRP for IPv6的进程是关闭的,需要⼿⼯开启(no shutdown)
  3. EIGRP可直接在接⼝上配置,接⼝上可以没有 IPv6 全局单播地址,依靠 Link-Local 地址建⽴邻居,称为Eigrp for IPv6⽆⽹络状态

配置

配置⽅法⼀:进程及接⼝下配置

# 开启 IPV6 功能
R5(config)#ipv6 unicast-routing

R5(config)#interface e0/2
# 开启 IPV6 功能
R5(config-if)#ipv6 enable
R5(config-if)#ipv6 address 2000::5/64
R5(config-if)#no shutdown

# IPV6 EIGRP 配置
R5(config)#ipv6 router eigrp 100
R5(config-rtr)#eigrp router-id 5.5.5.5
# 打开 eigrp 进程,默认关闭,手动开启
R5(config-rtr)#no shutdown

# 应用 ERGRP 配置到接口上
R5(config)#interface e0/2
R5(config-if)#ipv6 eigrp 100
R5(config-if)#exit

# 应用 ERGRP 配置到接口上
R5(config)#interface loopback 10
# 开启 IPV6 功能
R5(config-if)#ipv6 enable
R5(config-if)#ipv6 address 3005::5/64
R5(config-if)#ipv6 eigrp 100

配置⽅法⼆:命名EIGRP配置

R5(config)# router eigrp cisco
R5(config-router)#address-family ipv6 unicast autonomous-system 100
# 如果没有环回接口,则需要指定一个 router-id
R5(config-rtr)#eigrp router-id 5.5.5.5
# 默认所有接⼝开启EIGRP,不需要则⼿⼯关闭。只要接口下开启 IPV6 enable,就会自动学习邻居地址
R5(config-router-af)#af-interface e0/0
R5(config-router-af-interface)#shutdown 

EIGRP 排错

  1. 测试直连连通性(ping)

  2. 查看邻居表是否有邻居(show ip eigrp neighbors)

    • 接⼝是正常双 up(show ip interface brief)
    • AS 号码是否匹配(show ip protocols)
    • 是否配置了被动接⼝(show ip protocols)
    • K 值是否匹配(show ip protocols)
    • 认证密钥是否相同(show run interface x)(show key chain)
  3. 查看是否有需要的路由(show ip route)

    • 对应⽹络的接⼝是否通告(show run | s eigrp)
    • 是否配置了ACL(show ip access-lists)(show ip interface x)
    • 是否有⽹络不连续问题(show run | s eigrp)

EIGRP 和 GRE 的联合应用

其中 Site A 使用命令 EIGRP 配置,名为 cisco,Site B 使用正常 EIGRP 配置,AS 号为 100

  1. 将 R1 和 R6 配置为 Stub,因为是末节路由器,节省带宽
  2. R2 和 R3,R5 和 R6 开启认证,key chain 为 test,密码为 666. 因为 R3 和 R5 为 ISP 路由器。
  3. Site A 和 Site B 使用 IPV6 协议,ISP 内部使用 IPV4 协议。通过 GRE 实现 R1 和 R5 回环口,V4 和 V6 间互访。
    1. IPV4 网络:通过隧道地址建立 EIGRP 邻居
    2. IPV6 网络:配置静态路由,并重分布到 EIGRP 中

SIte A 和 Site B IPV4 通信配置:

# R1, 通过 EIGRP 命名声明本地网络
!
hostname R1
!
!
interface Loopback0
 ip address 192.168.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 12.1.1.1 255.255.255.0
 duplex auto
!
!
router eigrp cisco
 !
 address-family ipv4 unicast autonomous-system 100
  !
  topology base
  exit-af-topology
  network 12.1.1.0 0.0.0.255
  network 192.168.1.0
  eigrp stub connected summary
 exit-address-family
!

# R2 - 声明网络,加认证
!
hostname R2
!
key chain test
 key 1
  key-string 666
!
!
interface Ethernet0/0
 ip address 12.1.1.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 23.1.1.1 255.255.255.0
 duplex auto
!
router eigrp cisco
 !
 address-family ipv4 unicast autonomous-system 100
  !
  af-interface Ethernet0/1
   authentication mode md5
   authentication key-chain test
  exit-af-interface
  !
  topology base
  exit-af-topology
  network 12.1.1.0 0.0.0.255
  network 23.1.1.0 0.0.0.255
 exit-address-family
!

# R3 - 配置静态路由,模拟 ISP 内部通信。配置认证,建立隧道
!
hostname R3
!
key chain test
 key 1
  key-string 666
!
interface Tunnel0
 ip address 35.1.1.1 255.255.255.0
 tunnel source 34.1.1.1
 tunnel destination 45.1.1.2
!
interface Ethernet0/0
 ip address 23.1.1.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 34.1.1.1 255.255.255.0
 duplex auto
!
router eigrp cisco
 !
 address-family ipv4 unicast autonomous-system 100
  !
  af-interface Ethernet0/0
   authentication mode md5
   authentication key-chain test
  exit-af-interface
  !
  topology base
  exit-af-topology
  network 23.1.1.0 0.0.0.255
  network 35.1.1.0 0.0.0.255
 exit-address-family
!
ip route 0.0.0.0 0.0.0.0 34.1.1.2
!

# R4
!
hostname R4
!
interface Ethernet0/0
 ip address 34.1.1.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 45.1.1.1 255.255.255.0
 duplex auto
!

# R5
!
hostname R5
!
key chain test
 key 1
  key-string 123
!
interface Tunnel0
 ip address 35.1.1.2 255.255.255.0
 tunnel source 45.1.1.2
 tunnel destination 34.1.1.1
!
interface Ethernet0/0
 ip address 45.1.1.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 ip address 56.1.1.1 255.255.255.0
 ip authentication mode eigrp 100 md5
 ip authentication key-chain eigrp 100 test
 duplex auto
!
router eigrp 100
 network 35.1.1.0 0.0.0.255
 network 56.1.1.0 0.0.0.255
!
ip route 0.0.0.0 0.0.0.0 45.1.1.1
!

# R6
!
hostname R6
!
key chain test
 key 1
  key-string 123
!
interface Loopback0
 ip address 192.168.6.1 255.255.255.0
!
interface Ethernet0/0
 ip address 56.1.1.2 255.255.255.0
 ip authentication mode eigrp 100 md5
 ip authentication key-chain eigrp 100 test
 duplex auto
!
router eigrp 100
 network 56.1.1.0 0.0.0.255
 network 192.168.6.0
 eigrp stub connected summary
!

IPV6 通信配置

# R1
ipv6 unicast-routing
interface Loopback0
ipv6 address 3001::1/64
ipv6 enable

interface Ethernet0/0
ipv6 address 2012::1/64
ipv6 enable

!
router eigrp cisco
 address-family ipv6 unicast autonomous-system 100
  !
  topology base
  exit-af-topology
 exit-address-family
!


# R2
ipv6 unicast-routing
interface Ethernet0/0
ipv6 address 2012::2/64
ipv6 enable

interface Ethernet0/1
ipv6 address 2023::1/64
ipv6 enable
!
router eigrp cisco
address-family ipv6 unicast autonomous-system 100
  topology base
  exit-af-topology
 exit-address-family
!

# R3
ipv6 unicast-routing
interface Tunnel0
 ipv6 enable
interface Ethernet0/0
 ipv6 address 2023::2/64
 ipv6 enable
!
router eigrp cisco
 address-family ipv6 unicast autonomous-system 100
  topology base
   redistribute static
  exit-af-topology
 exit-address-family
 !
 ipv6 route 3006::/64 Tunnel0
 !
 
# R5
ipv6 unicast-routing
interface Tunnel0
 ipv6 enable
interface Ethernet0/1
 ipv6 address 2056::1/64
 ipv6 address address 2056::1/64
 ipv6 enable
 ipv6 eigrp 100
!
ipv6 route 3001::/64 Tunnel0
ipv6 router eigrp 100
 redistribute static
!

#R6
ipv6 unicast-routing
interface Loopback0
 ipv6 address 3006::1/64
 ipv6 enable
 ipv6 eigrp 100
!
interface Ethernet0/0
 ipv6 address 2056::2/64
 ipv6 address address 2056::2/64
 ipv6 enable
 ipv6 eigrp 100
!
ipv6 router eigrp 100
!
posted @ 2020-08-09 21:20  来份锅包肉  阅读(1595)  评论(0编辑  收藏  举报