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 时,会考虑如下的参数:
带宽:路径上沿途出站接口上的最小带宽,单位为 kbit/s.
时延:路径上沿途出站接口上的时延综合,单位为 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
可靠性:动态的度量参数,描述出错率,最大值为 255,表示 100% 可靠。1 表示 1% 可靠。
负载:基于单位时间内发送的包率,描述占用率。1 表示最小负载。255 表示 100% 负载。
最大传输单元:不参与计算,但会记录。最小 MTU.
计算公式,负载和可靠性,在人工配置后会参与计算:
但由于默认,K1, K3 等于 1,K2, K4, K5 等于 0. 所以公式可简化为:
带宽:路径上沿途出站接口上的最小带宽
时延:时延求和
这里举个例子。求 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 |