配置IP报文转发的全局非等价负载分担示例
本举例介绍IP报文转发的全局非等价负载分担的配置过程。
组网需求
如图10-2所示,DeviceA和DeviceC之间通过两条链路连接。
DeviceA的GE0/2/0到DeviceB的GE0/2/0是一条实际物理链路。
DeviceA上Eth-Trunk1接口的成员口是GE0/3/0和GE0/4/0;DeviceB上Eth-Trunk1接口的成员口是GE0/3/0和GE0/4/0。
因为Eth-Trunk1接口包含了两个GE接口,所以其带宽是两条物理成员链路的带宽之和。现在要在DeviceA到DeviceC的这两条链路上实现全局非等价负载分担。
设备名称 |
接口名称 |
IP地址 |
---|---|---|
DeviceA |
GE0/2/0 |
10.30.1.1/24 |
Eth-Trunk1 |
10.40.1.1/24 |
|
DeviceB |
GE0/2/0 |
10.30.1.2/24 |
Eth-Trunk1 |
10.40.1.2/24 |
|
GE0/1/0 |
10.50.1.1/24 |
|
DeviceC |
GE0/2/0 |
10.50.1.2/24 |
本示例中DeviceA和DeviceB的GE0/2/0接口带宽为1G,GE0/3/0接口带宽为2G,GE0/4/0接口带宽为3G。
操作步骤
- 配置各物理接口和Eth-Trunk接口的IP地址(略)
- 配置静态路由
# 配置DeviceA。
[~DeviceA] ip route-static 10.20.1.0 255.255.255.0 gigabitethernet0/2/0 10.30.1.2
[*DeviceA] ip route-static 10.20.1.0 255.255.255.0 eth-trunk1 10.40.1.2
[*DeviceA] ip route-static 10.50.1.0 255.255.255.0 gigabitethernet0/2/0 10.30.1.2
[*DeviceA] ip route-static 10.50.1.0 255.255.255.0 eth-trunk1 10.40.1.2
[*DeviceA] commit
# 配置DeviceB。
[~DeviceB] ip route-static 10.1.1.0 255.255.255.0 gigabitethernet0/2/0 10.30.1.1
[*DeviceB] ip route-static 10.1.1.0 255.255.255.0 eth-trunk1 10.40.1.1
[*DeviceB] ip route-static 10.20.1.0 255.255.255.0 gigabitethernet0/2/2 10.50.1.2
[*DeviceB] commit
# 配置DeviceC。
[~DeviceC] ip route-static 10.1.1.0 255.255.255.0 gigabitethernet0/2/0 10.50.1.1
[*DeviceC] ip route-static 10.30.1.0 255.255.255.0 gigabitethernet0/2/0 10.50.1.1
[*DeviceC] ip route-static 10.40.1.0 255.255.255.0 GigabitEthernet0/2/0 10.50.1.1
[*DeviceC] commit
- 在DeviceA上使能全局非等价路由负载分担功能
[~DeviceA] load-balance unequal-cost enable
[*DeviceA] commit
- 检查配置结果
# 此时在DeviceC上可以ping通10.1.1.1。执行命令display interface brief,查看出接口的带宽占用率信息。可以看到Eth-Trunk1接口上的带宽占用率与GE0/2/0接口上的带宽占用率基本相同,说明非等价负载分担功能已经使能,出接口的流量已经按照带宽比例均匀分配到各出接口。
[~DeviceC] ping -c 100 -t 10 -m 10 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=254 time=3 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms ... --- 10.1.1.1 ping statistics --- 100 packet(s) transmitted 99 packet(s) received 1.00% packet loss round-trip min/avg/max = 1/1/6 ms
[~DeviceB] display interface brief
PHY: Physical *down: administratively down
^down: standby
(l):loopback
(s):spoofing
(b): BFD down
(e): EFM down
(d):Dampening Suppressed
InUti/OutUti: input utility/output utility
Interface PHY Protocol InUti OutUti inErrors outErrors
Eth-Trunk1 up up 20% 30% 35 210
GigabitEthernet0/1/0 up up 15% 20% 22 120
GigabitEthernet0/2/0 up up 20% 30% 23 125
GigabitEthernet0/2/1 *down down 0% 0% 0 0
GigabitEthernet0/2/3 *down down 0% 0% 0 0
GigabitEthernet0/2/4 *down down 0% 0% 0 0
GigabitEthernet0/2/5 *down down 0% 0% 0 0
GigabitEthernet0/2/6 *down down 0% 0% 0 0
GigabitEthernet0/2/7 *down down 0% 0% 0 0
Ip-Trunk1 down down 0% 0% 0 0
LoopBack0 down up(s) 0% 0% 0 0
NULL0 up up 0% 0% 0 0
配置文件
DeviceA的配置文件
# sysname DeviceA # load-balance unequal-cost enable # interface Eth-Trunk1 ip address 10.40.1.1 255.255.255.0 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.30.1.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown eth-trunk 1 # interface GigabitEthernet0/4/0 undo shutdown eth-trunk 1 # ip route-static 10.20.1.0 255.255.255.0 GigabitEthernet0/2/0 10.30.1.2 ip route-static 10.20.1.0 255.255.255.0 Eth-Trunk1 10.40.1.2 ip route-static 10.50.1.0 255.255.255.0 GigabitEthernet0/2/0 10.30.1.2 ip route-static 10.50.1.0 255.255.255.0 Eth-Trunk1 10.40.1.2 #
DeviceB的配置文件
# sysname DeviceB # interface Eth-Trunk1 ip address 10.40.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.30.1.2 255.255.255.0 # interface GigabitEthernet0/2/2 undo shutdown ip address 10.50.1.1 255.255.255.0 # interface GigabitEthernet0/3/0 undo shutdown eth-trunk 1 # interface GigabitEthernet0/4/0 undo shutdown eth-trunk 1 # ip route-static 10.1.1.0 255.255.255.0 GigabitEthernet0/2/0 10.30.1.1 ip route-static 10.1.1.0 255.255.255.0 Eth-Trunk1 10.40.1.1 ip route-static 10.20.1.0 255.255.255.0 GigabitEthernet0/2/2 10.50.1.2 # return
DeviceC的配置文件
# sysname DeviceC # ip route-static 10.1.1.0 255.255.255.0 GigabitEthernet0/2/2 10.50.1.1 ip route-static 10.30.1.0 255.255.255.0 GigabitEthernet0/2/2 10.50.1.1 ip route-static 10.40.1.0 255.255.255.0 GigabitEthernet0/2/2 10.50.1.1 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.20.1.1 255.255.255.0 # interface GigabitEthernet0/2/2 undo shutdown ip address 10.50.1.2 255.255.255.0 # return