EIGRP基本实验与度量计算<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><?XML:NAMESPACE PREFIX = O />
<?:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><?XML:NAMESPACE PREFIX = V />
R1:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line con 0
Router(config-line)#logg sy
Router(config-line)#exec-t 0 0
Router(config-line)#exi
Router(config)#no ip domain-lo
Router(config)#host R1
R1(config)#int s 1
R1(config-if)#ip add <?:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><?XML:NAMESPACE PREFIX = ST1 />10.10.10.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#clo ra 64000
R1(config-if)#exi
R1(config)#
*Mar 1 00:23:29.347: %LINK-3-UPDOWN: Interface Serial1, changed state to up
R1(config)#
*Mar 1 00:23:30.351: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1, changed state to up
R1(config)#
R2:
R2#en
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int s 1
R2(config-if)#ip add 10.10.10.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#int s 0
R2(config-if)#ip add 20.20.20.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#clo ra 64000
R2(config-if)#exi
R2(config)#
R3:
R3>en
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int s 1
R3(config-if)#ip add 20.20.20.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exi
R3(config)#
以上的配置已经可以完成由R2分别与R1和R3的通信,测试结果如下:
R2#ping 10.10.10.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/34/36 ms
R2#ping 20.20.20.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/34/36 ms
R2#
回R1启动EIGRP协议。
R1(config)#router eigrp ?
<1-65535> Autonomous system number ←实则为EIGRP的进程号,也可被用来用自治系统号进行分配。
R1(config)#router eigrp 1
R1(config-router)#net 10.10.10.0 ? ←宣告网络
A.B.C.D EIGRP wild card bits ←EIGRP支持VLSM,可以在这里输入通配符掩码进行精确匹配。
<cr> ←直接确定
R2、R3同时都需要运行EIGRP使R1可以与R3相互交换信息,R2、R3的配置如下:
R2:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router eigrp 1
R2(config-router)#net 10.10.10.0
*Mar 1 01:10:21.591: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 10.10.10.1 (Serial1) is up: new adjacency ←与邻居10.10.10.1建立邻接关系成功,如何建立的细节请参阅IT傻博士课程。
R2(config-router)#net 20.20.20.0
R2(config-router)#exi
R2(config)#
*Mar 1 01:10:37.699: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 20.20.20.2 (Serial0) is up: new adjacency ←与邻居20.20.20.2建立邻接关系。
R2(config)#
R3:
R3(config)#
R3(config)#router eigrp 1
R3(config-router)#net 20.20.20.0
R3(config-router)#exi
R3(config)#
*Mar 1 01:09:13.887: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 20.20.20.1 (Serial1) is up: new adjacency ←与邻居20.20.20.1建立邻接关系。
R3(config)#
我们接着在R3上查看路由表可以看见到达R1的路由已经出现,如下。
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
20.0.0.0/24 is subnetted, 1 subnets
C 20.20.20.0 is directly connected, Serial1
D 10.0.0.0/8 [90/2681856] via 20.20.20.1, 00:39:05, Serial1
R3#
首先我们来分解看一下本条通过EIGRP学习到的路由条目。
D 10.0.0.0/8 [90/2681856] via 20.20.20.1, 00:39:05, Serial1
D: 代表EIGRP。
0.0.0.0/8: 为我们宣告的网络,在此的形式为主类,因为EIGRP在通过边界路由的时候将进行自动汇总。
[90/2681856]: 括号内的90表明EIGRP的管理距离为90,2681856为到达10.0.0.0/8这条链路的开销值。
via 20.20.20.1: 下一跳邻居接口。
01:07:51: 时间标记。
Serial1: 本地接口。
在[90/2681856]一项内管理距离的值各协议不同,并且随厂家的不同也有不同,定义管理距离值除了各企业以外IETF工程小组也有相关定义。
2681856为到达目的地的Metric值(度量)其计算公式如下:
BW igrp metric = 10000000/带宽(kbit/s)
DLY igrp metric = 延迟总和(微秒microseconds)/10
BW eigrp metric = 10000000/带宽(kbit/s)* 256
DLY eigrp metric = 延迟总和(微秒microseconds)/10 * 256
通过show ip route 10.10.10.0 可查看相关路由的详细参数。
R3#show ip route 10.10.10.0
Routing entry for 10.0.0.0/8
Known via "eigrp 1", distance 90, metric 2681856, type internal
Redistributing via eigrp 1
Last update from 20.20.20.1 on Serial1, 01:17:54 ago
Routing Descriptor Blocks:
* 20.20.20.1, from 20.20.20.1, 01:17:54 ago, via Serial1
Route metric is 2681856, traffic share count is 1
Total delay is 40000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
R3#
从以上R3#show ip route 10.10.10.0命令输入的相关信息可以看到到达目的地10.10.10.0的延迟总和为4000微秒,而Eigrp的带宽用整个链路的最小带宽为1544Kbit/s,经过计算,算出来的metric的值为2681856,而直接套用如上公式进行计算,计算的结果有一定的偏差,实际的链路带宽应为1544.163063619518221124Kb通过此值进行运算即可得到metric为2681856。图示如下:
接下来我们看一下Eigrp的Topology Table(称数据库表或拓扑表)
R3#show ip eigrp topo
IP-EIGRP Topology Table for AS(1)/ID(20.20.20.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 10.0.0.0/8, 1 successors, FD is 2681856
via 20.20.20.1 (2681856/2169856), Serial1
P 20.20.20.0/24, 1 successors, FD is 2169856
via Connected, Serial1
R3#
从上面摘取的条目可以看出P 10.0.0.0/8, 1 successors, FD is 2681856 其FD(可行距离)的值为2681856,可行距离即为从源到达目的的最小Metirc值,通过Metric的公式即可计算出,但是第二条P 20.20.20.0/24, 1 successors, FD is 2169856本条的FD为2169856,差别即在于20.20.20.0的网段与R3直接相连到达本路径的最小带宽为1544Kb,延迟总和为20000微秒,通过计算即可得。
带宽和延迟是Eigrp进行度量运算的默认参数,除此以外负载和可靠性也可以与带宽和延迟共同参与度量的运算,但是需要人为手动开启此选项,另外MTU(最大传输单元)并不参与Metric的运算,但是Eigrp和Igrp也会跟踪每条路由上最小MTU的大小。
通过以下方式可以查看每接口的相关参数
R3#show interface s 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 20.20.20.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, ←用于Metric运算的相关参数。
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:02, output 00:00:02, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 1158 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
916 packets input, 59374 bytes, 0 no buffer
Received 319 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
922 packets output, 60362 bytes, 0 underruns
0 output errors, 0 collisions, 4 interface resets
0 output buffer failures, 0 output buffers swapped out
1 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
R3#
另外以上BW(带宽)值并非本链路的传输速度为1544Kbit/s,而仅用来作为串口默认的度量值,不会动态改变,即便你的实际传输速率仅为64Kbit/s,路由器仍然会把这条链路当作1544Kbit/s来进行度量运算。这个缺省的度量值我们可以通过bandwidth命令来更改。
此命令需要在接口下进行,通过以下的命令我们可以修改相应接口的带宽值。
R3(config)#int s 1
R3(config-if)#bandwidth 64
Eigrp对Metric中带宽的运算是基于路由器的出接口带宽的最小值而计算的,发出去到目的地的数据包和由目的地发回的数据包链路的Metric可能不一样。我们把带宽的设置修改成如下图。
我们分别从R1上查看到达20.20.20.0(R2-R3)链路的Metric值和从R3上查看到达10.10.10.0(R1-R2)链路的Metric值。
R3#show ip route 10.10.10.0
Routing entry for 10.0.0.0/8
Known via "eigrp 1", distance 90, metric 41024000, type internal
Redistributing via eigrp 1
Last update from 20.20.20.1 on Serial1, 00:34:49 ago
Routing Descriptor Blocks:
* 20.20.20.1, from 20.20.20.1, 00:34:49 ago, via Serial1
Route metric is 41024000, traffic share count is 1
Total delay is 40000 microseconds, minimum bandwidth is 64 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
R3#
从以上命令查看的内容可以得知Metric的值发生了改变,并且运算的最小带宽为64Kbit,我们再回到R1来查看到达20.20.20.0(R2-R3)的链路Metric值。
R1#show ip route 20.20.20.0
Routing entry for 20.0.0.0/8
Known via "eigrp 1", distance 90, metric 2681856, type internal
Redistributing via eigrp 1
Last update from 10.10.10.2 on Serial1, 00:39:52 ago
Routing Descriptor Blocks:
* 10.10.10.2, from 10.10.10.2, 00:39:52 ago, via Serial1
Route metric is 2681856, traffic share count is 1
Total delay is 40000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
R1#
可见从R1到达R3的Metric和从R3回到R1的Metric并不相同。
我们除了可以通过修改带宽来更改Metric的运算以外还可以通过修改延迟来影响Metric的运算,由于OSPF也通过带宽来计算Metric,当一个网络总同时运行OSPF和EIGRP时,为了不影响OSPF的选路,我们可以通过修改delay来影响IGRP和EIGRP的度量值(Metric)。
首先我们先看一下如何修改延迟值(delay).
R2(config)#int s 1
R2(config-if)#delay 100(注意单位)
R2(config-if)#exi
R2(config)#
下面我们来看一下通过修改delay来计算Metric是否与带宽的规律相同。
按照图上的表识来修改各接口的delay(延迟)并回到R1,由R1得知到达20.20.20.0(R2-R3)的开销发生了改变,并且delay(延迟)为
R1#show ip route 20.20.20.0
Routing entry for 20.0.0.0/8
Known via "eigrp 1", distance 90, metric 2221056, type internal
Redistributing via eigrp 1
Last update from 10.10.10.2 on Serial1, 00:00:17 ago
Routing Descriptor Blocks:
* 10.10.10.2, from 10.10.10.2, 00:00:17 ago, via Serial1
Route metric is 2221056, traffic share count is 1
Total delay is 22000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
R1#
R3#show ip route 10.10.10.0
Routing entry for 10.0.0.0/8
Known via "eigrp 1", distance 90, metric 40537600, type internal
Redistributing via eigrp 1
Last update from 20.20.20.1 on Serial1, 00:01:02 ago
Routing Descriptor Blocks:
* 20.20.20.1, from 20.20.20.1, 00:01:02 ago, via Serial1
Route metric is 40537600, traffic share count is 1
Total delay is 21000 microseconds, minimum bandwidth is 64 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
R3#
从R1和R3的输出可以得知,延迟和带宽的规律相同都是计算路由器到达目的地的逃出接口的相关参数。
以上两个度量(带宽、延迟)属于静态度量,而可靠性和负载属于动态度量参数。
对于可靠性参数255代表最高可靠性为100%,而1表示最低可靠性,用show interface可以查看到相关接口的可靠性参数,如下所示。
R3#show interface s 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 20.20.20.2/24
MTU 1500 bytes, BW 64000 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:00, output 00:00:04, output hang never
Last clearing of "show interface" counters never
Input queue: 1/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 48000 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
4161 packets input, 269672 bytes, 0 no buffer
Received 1447 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
4164 packets output, 270104 bytes, 0 underruns
0 output errors, 0 collisions, 4 interface resets
0 output buffer failures, 0 output buffers swapped out
1 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
R3#
因为可靠性和负载是动态的度量,这种算法不允许链路上有突然的大的流量变化和出错率,这样会造成整个网络结构的不稳定,如流量的突然降低可能会导致路由器触发一个更新,为了防止度量的频繁改变,采用5秒种更新一次的方式。
大流量通过路由器的接口将会导致路由器的负载加大,如下所示,当CPU的利用上升超过70%以上的时候不同种类的路由器会相续选择丢包处理,当一直处了90%或者更高的时候,路由器将无法正常转发或导致死机。
R2#show int s 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 10.10.10.2/24
MTU 1500 bytes, BW 64 Kbit, DLY 1000 usec,
reliability 255/255, txload 63/255, rxload 59/255 ←有流量通过时,负载增大。
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:03, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 1/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 48 kilobits/sec
5 minute input rate 15000 bits/sec, 2 packets/sec
5 minute output rate 16000 bits/sec, 2 packets/sec
4678 packets input, 494690 bytes, 0 no buffer
Received 1555 broadcasts, 0 runts, 0 giants, 0 throttles
1 input errors, 1 CRC, 0 frame, 0 overrun, 0 ignored, 1 abort
4670 packets output, 494456 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 output buffer failures, 0 output buffers swapped out
8 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
R2#
因链路错误和波动导致可靠性下降,如下所示。
R2#show int s 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 10.10.10.2/24
MTU 1500 bytes, BW 64 Kbit, DLY 1000 usec,
reliability 254/255, txload 15/255, rxload 19/255 ←链路可靠性下降
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
Last input 00:00:02, output 00:00:02, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 48 kilobits/sec
5 minute input rate 5000 bits/sec, 0 packets/sec
5 minute output rate 4000 bits/sec, 0 packets/sec
6265 packets input, 1847204 bytes, 0 no buffer
Received 1653 broadcasts, 0 runts, 0 giants, 0 throttles
5 input errors, 5 CRC, 0 frame, 0 overrun, 0 ignored, 5 abort
6251 packets output, 1845964 bytes, 0 underruns
0 output errors, 0 collisions, 3 interface resets
0 output buffer failures, 0 output buffers swapped out
15 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
R2#
在默认情况下IGRP和EIGRP采用带宽和延迟进行度量运算,我们可以用以下的命令来开启其他度量值。
在缺省情况下K1=K3=1 K2=K4=K5=0,K1和K3分别表示带宽和延迟。
其具体的计算公式和步骤请查阅IT傻博士学习手册,以下所列为权重各K值。
R1(config-router)#metric weights ? ←配置选用的参考值
<0-8> Type Of Service (Only TOS 0 supported)
R1(config-router)#metric weights 0 ?
<0-255> K1
R1(config-router)#metric weights 0 1 ?
<0-255> K2
R1(config-router)#metric weights 0 1 0 ?
<0-255> K3
R1(config-router)#metric weights 0 1 0 5 ?
<0-255> K4
R1(config-router)#metric weights 0 1 0 5 1 ?
<0-255> K5
R1(config-router)#metric weights 0 1 0 5 1 0
如果我们想查看运行EIGRP协议的邻居路由器可以通过show ip eigrp neighbors来实现,显示如下。
R1#show ip eigrp neighbors
IP-EIGRP neighbors for process 1
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 10.10.10.2 Se1 10 00:19:12 32 200 0 48
R1#
若查看EIGRP的拓扑表可通过show ip eigrp topology来实现,其显示如下。
R1#show ip eigrp topo
IP-EIGRP Topology Table for AS(1)/ID(0.0.0.0)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 10.10.10.0/24, 1 successors, FD is 1709056
via Connected, Serial1
P 20.0.0.0/8, 1 successors, FD is 2221056
via 10.10.10.2 (2221056/2169856), Serial1
R1#
以上加粗的内容逐一解释如下。
P 20.0.0.0/8, 1 successors, FD is 2221056
via 10.10.10.2 (2221056/2169856), Serial1
P 20.0.0.0/8:目的网络的网络号和掩码长度。
1 successors, FD is 2221056:表示有一个后继路由器,并且从源点到达目的地的开销为2169856
via 10.10.10.2:标识出经过下一跳路由器的接口地址。
(2221056/2169856):前一个值2221056表示从源路由器到达目的地的开销值,后一个值2169856为下一跳路由器到达目的地的开销值。
Serial1:为本地出站接口。
在拓扑表中到达目的地最优的路径将成为后继,并被放入路由表中,现在我们查看一下路由表。
R1#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
D 20.0.0.0/8 [90/2221056] via 10.10.10.2, 00:43:22, Serial1
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Serial1
R1#
从中可以看出最优路径已经被放入路由表中。
转裁请保留作者信息 并注明IT傻博士和汤姆一通ITAA网络技术训练中心