EIGRP可以使用通往同一个目的网络的多条路径发送流量,从而增加贷款,这叫做负载均衡。EIGRP支持在相同开销的路径上进行等价负载均衡和在不同开销的路径上进行费等价负载均衡。
EIGRP默认支持最多4条等价负载均衡,此外我们还可以使用命令:maximum-paths 修改IP路由协议支持的最大负载均衡条数。当有多条后继路由(开销最少的路径)开销相同时,EIGRP会自动启动等价负载均衡。
以本拓扑图为例,将网络配置好之后在全网启用EIGRP:
具体配置略,之后直接查看R1路由表:
R1(config)#do 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/435200] via 192.168.2.2, 00:02:27, FastEthernet0/1
[90/435200] via 192.168.1.2, 00:02:27, FastEthernet0/0
D 192.168.4.0/24 [90/307200] via 192.168.2.2, 00:02:27, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
D 192.168.3.0/24 [90/307200] via 192.168.1.2, 00:02:28, FastEthernet0/0
我们可以看见,路由表中,去往目的网络4.4.4.0的下一跳有两个,因为这个网络上下两条链路的度量值相同都是435200,所以自动将这两条链路都写入了路由表并且启用了等价负载均衡。我们通过traceroute查看数据的具体转发:
R1#traceroute 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 192.168.2.2 36 msec
192.168.1.2 20 msec
192.168.2.2 24 msec
2 192.168.3.2 64 msec
192.168.4.2 32 msec
192.168.3.2 44 msec
可见数据包确实是在上下两条链路上实现了负载均衡。
为了确保没有环路,只有可行后继路由器才可以被包含在非等价负载均衡中,EIGRP执行负载均衡的程度是由一个参数variance来决定的,我们通过设置variance值(默认为1)让EIGRP将多条度量不同的无环路由加入到本地的路由表中。
EIGRP会将度量最小的即后继路由直接加到本地路由表中,其他的路由若也想加入到本地路由表中并且参与非等价负载均衡必须满足以下两个条件:
1. 路由必须无环,而当此路由是可行后继路由,即宣告距离小于可行距离时,既满足无环。
2. 路由的度量必须低于后继路由的度量值(即最优度量)和本路由器上配置的variance值的乘积。
下面我们还是通过上面那个拓扑图来进行实验,首先我们略微修改一下上面那条链路的metric值
R1上进行配置:
R1(config)#int f0/0
R1(config-if)#bandwidth 9000
接下来我们再来查看路由表:
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/435200] via 192.168.2.2, 00:03:03, FastEthernet0/1
D 192.168.4.0/24 [90/307200] via 192.168.2.2, 00:03:03, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
D 192.168.3.0/24 [90/332800] via 192.168.2.2, 00:03:02, FastEthernet0/1
我们可以看见只剩下一个下一跳了,因为我们修改了f0/0接口的带宽值(只用与计算,实际没有修改)所以metric值相应改变,这样就造成两条链路的metric值不同,无法继续进行等假负载均衡。
我们再来查看一下两条链路的metric值:
R1#show ip eigrp topology
IP-EIGRP Topology Table for AS(100)/ID(1.1.1.1)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 1.1.1.0/24, 1 successors, FD is 128256
via Connected, Loopback0
P 4.4.4.0/24, 1 successors, FD is 435200
via 192.168.2.2 (435200/409600), FastEthernet0/1
via 192.168.1.2 (463616/409600), FastEthernet0/0
P 192.168.1.0/24, 1 successors, FD is 310016
via Connected, FastEthernet0/0
P 192.168.2.0/24, 1 successors, FD is 281600
via Connected, FastEthernet0/1
P 192.168.3.0/24, 1 successors, FD is 332800
via 192.168.2.2 (332800/307200), FastEthernet0/1
via 192.168.1.2 (335616/281600), FastEthernet0/0
P 192.168.4.0/24, 1 successors, FD is 307200
via 192.168.2.2 (307200/281600), FastEthernet0/1
我们可以看出,两条链路的metric值相差不多(因为我修改的就不是很大,10000改为9000),这样是可以满足可行后继路由器的条件的,接下来我们修改variance值:
R1(config)#router ei 100
R1(config-router)#variance 2’
这样我们就把variance改为了2,很明显463616是小于435200*2的,所以应该满足非等价负载均衡,我们还是查看路由表来验证一下:
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/435200] via 192.168.2.2, 00:00:08, FastEthernet0/1
[90/463616] via 192.168.1.2, 00:00:08, FastEthernet0/0
D 192.168.4.0/24 [90/307200] via 192.168.2.2, 00:00:08, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
D 192.168.3.0/24 [90/332800] via 192.168.2.2, 00:00:08, FastEthernet0/1
[90/335616] via 192.168.1.2, 00:00:10, FastEthernet0/0
很明显,在路由表中两个下一跳以不同的metric值同时出现在路由表中,非等价负载均衡配置成功。
以上就是关于EIGRP 的负载均衡。