介绍EIGRP高级配置前,先介绍一下DUAL算法的相关术语:
Successor(后继):后继就是到目标网络花费最少的路由。
FD(Feasible Distance,可行距离):到目标网络的最小度量值。
RD(Reported Distance,报告距离)又称AD(Advertised Distance,通告距离):下一跳路由器通告的到相同目标网络的距离。
FS(Feasible Successor,可行后继):可行后继就是次优路径。
FC(Feasibility Condition,可行条件):可行条件是报告距离必须小于可行距离,也就是邻路由到目标网络的距离必须小于本路由到目标网络的距离。
能出现在”show ip eigrp topology”中的非可行距离路径,都满足可行条件,都是可行后继。
下面这个例子中列出的拓扑表很好的解释了上面这些概念:
R2#show ip eigrp topology P 1.0.0.0/8, 1 successors, FD is 156160 via 21.1.1.1 (156160/128256), FastEthernet1/0 via 12.1.1.1 (2297856/128256), Serial0/1 /* * 在上面的拓扑表显示中: * R2去往1.0.0.0/8网络有一条后继"1 successors", * 可行距离是"FD is 156160", * 报告距离是"128256", * 可行后继是"via 12.1.1.1 (2297856/128256), Serial0/1" * 能出现在这个命令下的,都满足可行条件。 */
用下面这个实例来讲解EIGRP非等值负载均衡的配置:
R1配置:
R1(config)#interface s0/0 R1(config-if)#ip address 12.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 1.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface f0/1 R1(config-if)#ip address 13.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config)#router eigrp 100 R1(config-router)#no auto-summary R1(config-router)#network 1.1.1.0 0.0.0.255 R1(config-router)#network 12.1.1.0 0.0.0.255 R1(config-router)#network 13.1.1.0 0.0.0.255
R2配置:
R2(config)#interface s1/0 R2(config-if)#ip address 12.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 2.2.2.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface s1/1 R2(config-if)#ip address 23.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config)#router eigrp 100 R2(config-router)#no auto-summary R2(config-router)#network 2.2.2.0 0.0.0.255 R2(config-router)#network 12.1.1.0 0.0.0.255 R2(config-router)#network 23.1.1.0 0.0.0.255
R3配置:
R3(config)#interface s1/1 R3(config-if)#ip address 23.1.1.3 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)#ip address 3.3.3.3 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface f0/1 R3(config-if)#ip address 13.1.1.3 255.255.255.0 R3(config-if)#no shutdown R3(config)#router eigrp 100 R3(config-router)#no auto-summary R3(config-router)#network 3.3.3.0 0.0.0.255 R3(config-router)#network 13.1.1.0 0.0.0.255 R3(config-router)#network 23.1.1.0 0.0.0.255
配置完成后查看R1路由表:
R1#show ip route 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets D 2.2.2.0 [90/2297856] via 12.1.1.2, 00:04:27, Serial0/0 3.0.0.0/24 is subnetted, 1 subnets D 3.3.3.0 [90/156160] via 13.1.1.3, 00:04:29, FastEthernet0/1 23.0.0.0/24 is subnetted, 1 subnets D 23.1.1.0 [90/2172416] via 13.1.1.3, 00:04:29, FastEthernet0/1 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial0/0 13.0.0.0/24 is subnetted, 1 subnets C 13.1.1.0 is directly connected, FastEthernet0/1
/*注意,路由表中去往23.1.1.0/24的路径只显示了一条,而RIP则会显示两条,因为RIP仅仅通过跳数去判断路径的好坏,而EIGRP使用复合度量值,默认和带宽和延时有关,前面已经说明。*/
实际上去往23.1.1.0/24的路径还有一条可行后继,即通过R1,可以通过查看R1上针对23.1.1.0/24的拓扑数据库看到另外一条可行后继:
R1#show ip eigrp topology 23.1.1.0/24 IP-EIGRP (AS 100): Topology entry for 23.1.1.0/24 State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2172416 Routing Descriptor Blocks: ********************************************************* 这是一条后继路由(success) 13.1.1.3 (FastEthernet0/1), from 13.1.1.3, Send flag is 0x0 Composite metric is (2172416/2169856), Route is Internal Vector metric: Minimum bandwidth is 1544 Kbit Total delay is 20100 microseconds Reliability is 255/255 Load is 1/255 Minimum MTU is 1500 Hop count is 1 ********************************************************* /*这一条是可行后继*/(Feasible success) 12.1.1.2 (Serial0/0), from 12.1.1.2, Send flag is 0x0 Composite metric is (2681856/2169856), Route is Internal Vector metric: Minimum bandwidth is 1544 Kbit Total delay is 40000 microseconds Reliability is 255/255 Load is 1/255 Minimum MTU is 1500 Hop count is 1
可以使用下面的方法让去往23.1.1.0/24的数据能够很好的被分配到两条线路上:
我们使用上面拓扑数据中最大的可行后继的度量值(本例只有一个可行后继度量值是2681856)除以后继路径的度量值(2172416
),取不小于结果的整数:
2681856/2172416
≈1.234 , 所以取值等于2作为不等价因子来配置非等值负载均衡
R1(config)#router eigrp 100
R1(config-router)#variance 2 /*配置非等值负载均衡*/
R1(config-router)#end
R1#
/*再次查看R1路由表,发现23.1.1.0/24出现了两条路径*/
R1#show ip route 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 2.0.0.0/24 is subnetted, 1 subnets D 2.2.2.0 [90/2297856] via 12.1.1.2, 00:00:09, Serial0/0/0 3.0.0.0/24 is subnetted, 1 subnets D 3.3.3.0 [90/156160] via 13.1.1.3, 00:00:07, FastEthernet0/1 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial0/0/0 13.0.0.0/24 is subnetted, 1 subnets C 13.1.1.0 is directly connected, FastEthernet0/1 23.0.0.0/24 is subnetted, 1 subnets D 23.1.1.0 [90/2172416] via 13.1.1.3, 00:00:07, FastEthernet0/1 [90/2681856] via 12.1.1.2, 00:00:09, Serial0/0
这里用到的不等价因子2,代表度量值小于“可行距离*2”,报告距离小于可行距离的路径且有两条到达目标网段的路由才可以进入路由表,可以使用下面的命令来验证这一点:
************************************************************* 我们可以看到,2.2.2.0/24,3.3.3.0/24网段只有一条可用的路径,所以更本就不存在负载均衡 ************************************************************* R1#show ip eigrp topology 2.2.2.0 255.255.255.0 IP-EIGRP (AS 100): Topology entry for 2.2.2.0/24 State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2297856 Routing Descriptor Blocks: 12.1.1.2 (Serial0/0/0), from 12.1.1.2, Send flag is 0x0 Composite metric is (2297856/128256), Route is Internal Vector metric: Minimum bandwidth is 1544 Kbit Total delay is 25000 microseconds Reliability is 255/255 Load is 1/255 Minimum MTU is 1500 Hop count is 1 R1#show ip eigrp topology 3.3.3.0 255.255.255.0 IP-EIGRP (AS 100): Topology entry for 3.3.3.0/24 State is Passive, Query origin flag is 1, 1 Successor(s), FD is 156160 Routing Descriptor Blocks: 13.1.1.3 (FastEthernet0/1), from 13.1.1.3, Send flag is 0x0 Composite metric is (156160/128256), Route is Internal Vector metric: Minimum bandwidth is 100000 Kbit Total delay is 5100 microseconds Reliability is 255/255 Load is 1/255 Minimum MTU is 1500 Hop count is 1
EIGRP和RIP一样,默认在主类网络的边界自动汇总,我们来看下面这个实例:
手动汇总特点: 1.减少路由条目。 2.减少正常数据的延时, 3.占用内存和CPU资源的减少。 4.减少带宽的占用。
R1配置:
R1(config)#interface s1/0 R1(config-if)#ip add 12.1.1.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#int loo 0 R1(config-if)#ip add 12.1.2.1 255.255.255.128 R1(config-if)#no shutdown R1(config)#router eigrp 100 R1(config-router)#network 12.1.2.0 0.0.0.127 R1(config-router)#network 12.1.1.0 0.0.0.255
R2配置:
R2(config)#interface s1/3 R2(config-if)#ip address 12.1.1.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#int loo 0 R2(config-if)#ip add 2.2.0.1 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#int loo 1 R2(config-if)#ip add 2.2.1.1 255.255.255.0 R2(config-if)#no shutdown R2(config)#router eigrp 100 R2(config-router)#network 12.1.1.0 0.0.0.255 R2(config-router)#network 2.2.0.0 0.0.0.255 R2(config-router)#network 2.2.1.0 0.0.0.255
配置完成后分别查看R1和R2的路由表:
/* * 可以看到R1的路由表中2.0.0.0/8是R2汇总后发送过来的条目 * R2在将自己的Lo0和Lo1从s1/3向外发送的时候, * 发现发送的接口s1/3的IP是12.1.1.2,默认的主类网络是12.0.0.0/8, * 这和Lo0和Lo1的默认主类网络(2.0.0.0/8)不同, * 所以R2在自己的s1/3自动汇总这两条路由成2.0.0.0/8发送给R1。 */ R1#show ip route D 2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:00:19, Serial1/0 12.0.0.0/8 is variably subnetted, 4 subnets, 3 masks C 12.1.1.0/24 is directly connected, Serial1/0 L 12.1.1.1/32 is directly connected, Serial1/0 C 12.1.2.0/25 is directly connected, Loopback0 L 12.1.2.1/32 is directly connected, Loopback0 /* * 与RIP不同的是,EIGRP自动汇总后,会在本地产生一条指向空接口的汇总路由 * * "2.0.0.0/8 is a summary, 00:02:59, Null0", * 是Lo0和Lo1在本地s1/3汇总时产生的。 * * "12.0.0.0/8 is a summary, 00:02:59, Null0", * 是R2将自己的s1/3接口路由和从R1接收到的12.1.2.0/25, * 从Lo0和Lo1发送出去时的汇总路由。 * D 12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:22:06, Serial1/3 [90/2297856] via 12.1.1.1, 00:22:06, Serial1/3 * 这一条从R1发过来的路由没有被汇总的原因是, * R1的发送接口s1/0(12.1.1.1)的默认主类网络地址12.0.0.0/8, * 和这条被发送的路由条目(12.1.2.0/25)的默认主类网络地址相同,所以就不会被汇总 * 自动汇总只发生在主类网络边界。并且从这里可以看出EIGRP支持VLSM。 */ R2#show ip route 2.0.0.0/8 is variably subnetted, 5 subnets, 3 masks D 2.0.0.0/8 is a summary, 00:03:14, Null0 C 2.2.0.0/24 is directly connected, Loopback0 L 2.2.0.1/32 is directly connected, Loopback0 C 2.2.1.0/24 is directly connected, Loopback1 L 2.2.1.1/32 is directly connected, Loopback1 12.0.0.0/8 is variably subnetted, 4 subnets, 4 masks D 12.0.0.0/8 is a summary, 00:03:14, Null0 C 12.1.1.0/24 is directly connected, Serial1/3 L 12.1.1.2/32 is directly connected, Serial1/3 D 12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:22:06, Serial1/3
关于上面的R2的路由表中“12.0.0.0/8 is a summary, 00:02:59, Null0”这条汇总条目是没有必要的,因为是R2向自己的回环接口发送EIGEP分组的时候产生的汇总路由,可以使用下面的命令将回环接口设置成被动接口,即不发送分组,来减小路由表大小:
/*将回环接口设置成被动接口*/ R2(config)#router eigrp 100 R2(config-router)#passive-interface loopback 0 R2(config-router)#passive-interface loopback 1 R2(config-router)#end /*再次查看R2的路由表,就看不到12.0.0.0/8的汇总路由了*/ R2#show ip route 2.0.0.0/8 is variably subnetted, 5 subnets, 3 masks D 2.0.0.0/8 is a summary, 00:09:34, Null0 C 2.2.0.0/24 is directly connected, Loopback0 L 2.2.0.1/32 is directly connected, Loopback0 C 2.2.1.0/24 is directly connected, Loopback1 L 2.2.1.1/32 is directly connected, Loopback1 12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks C 12.1.1.0/24 is directly connected, Serial1/3 L 12.1.1.2/32 is directly connected, Serial1/3 D 12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:28:26, Serial1/3
接下来,关闭EIGRP的自动汇总,使用手动汇总:
*关闭R1的自动汇总*/ R1(config)#router eigrp 100 R1(config-router)#no auto-summary /*关闭R2的自动汇总*/ R2(config)#router eigrp 100 R2(config-router)#no auto-summary /* * 关闭汇总后查看R1和R2的路由表 * R1上的2.0.0.0/8汇总路由变成了两条明细路由, * 所有的指向空接口的条目消失了 */ R1#show ip route 2.0.0.0/24 is subnetted, 2 subnets D 2.2.0.0 [90/2297856] via 12.1.1.2, 00:01:00, Serial1/0 D 2.2.1.0 [90/2297856] via 12.1.1.2, 00:01:00, Serial1/0 12.0.0.0/8 is variably subnetted, 4 subnets, 3 masks C 12.1.1.0/24 is directly connected, Serial1/0 L 12.1.1.1/32 is directly connected, Serial1/0 C 12.1.2.0/25 is directly connected, Loopback0 L 12.1.2.1/32 is directly connected, Loopback0 R2#show ip route 2.0.0.0/8 is variably subnetted, 4 subnets, 2 masks C 2.2.0.0/24 is directly connected, Loopback0 L 2.2.0.1/32 is directly connected, Loopback0 C 2.2.1.0/24 is directly connected, Loopback1 L 2.2.1.1/32 is directly connected, Loopback1 12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks C 12.1.1.0/24 is directly connected, Serial1/3 L 12.1.1.2/32 is directly connected, Serial1/3 D 12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:35:46, Serial1/3
/*在R2上使用手动汇总将Lo0和Lo1汇总成一条*/
/*手动汇总是在主类网络的边界接口上配置的*/ R2(config)#interface s1/3 R2(config-if)#ip summary-address eigrp 100 2.2.0.0 255.255.254.0 /*再次查看R1和R2的路由表*/ R1#show ip route 2.0.0.0/23 is subnetted, 1 subnets D 2.2.0.0 [90/2297856] via 12.1.1.2, 00:01:46, Serial1/0 12.0.0.0/8 is variably subnetted, 4 subnets, 3 masks ///////////////如上就是汇总的路由 R2#show ip route ******************汇总成指向自己的路由Null0 D 2.2.0.0/23 is a summary, 00:03:00, Null0
EIGRP配置验证的模式和RIPv2协议一样,在全局配置模式下创建密钥链,在接口中调用密钥链并且制定验证模式,接着上面的实验,在R1和R2之间,使用MD5验证:
R1配置: R1(config)#key chain ccna //密钥链标识,只具有本地作用 R1(config-keychain)#key 1 //密码ID R1(config-keychain-key)#key-string ccna //密码 R1(config-keychain-key)#exit R1(config-keychain)#exit /**在接口s1/0下开启密码认证,md5加密密码*/ R1(config)#interface s1/0 R1(config-if)#ip authentication key-chain eigrp 100 ccna R1(config-if)#ip authentication mode eigrp 100 md5 R2配置: R2(config)#key chain ccna2 R2(config-keychain)#key 1 R2(config-keychain-key)#key-string ccna R2(config-keychain-key)#exit R2(config-keychain)#exit R2(config)#interface s1/3 R2(config-if)#ip authentication key-chain eigrp 100 ccna2 R2(config-if)#ip authentication mode eigrp 100 md5
如果,R1和R2的对端接口密码不一样的时候,是否可以认证成功呢?
我们发现当我们R1和R2的密码不一样的时候,不能完成认证,认证失败,所以两端的密码一定要一样 R2(config)#key chain ccna2 R2(config-keychain)#key 1 R2(config-keychain-key)#key-string ccnp *Nov 12 10:32:24.063: %DUAL-5-NBRCHANGE: EIGRP-IPv4 100: Neighbor 12.1.1.1 (Serial1/3) is down: Auth failure
默认情况下EIGRP使用接口50%的带宽来传递EIGRP信息,可以使用下面的命令来更改EIGRP默认的接口带宽占用率:
1 |
/*将R1的s0/0接口的EIGRP带宽占用率调整成5%*/ |
2 |
R1(config)#int s 0/0 |
3 |
R1(config-if)#ip bandwidth-percent eigrp 100 5 |