实验拓扑如图11-7所示:
图11-7 手式模式配置eth-trunk
PC1的配置,在ipv4下选择静态配置,输入对应的ip地址以及子网掩码,然后点击应用。PC2、PC3、PC4同理。PC1的配置如图11-8所示:
图11-8在PC1上手动添加IP地址
PC2的配置如图11-9所示:
图11-9在PC2上手动添加IP地址
PC3的配置如图11-10所示:
图11-10在PC3上手动添加IP地址
PC4的配置如图11-11所示:
图11-11在PC4上手动添加IP地址
[Huawei]undo info-center enable
[Huawei]sysname LSW1
[LSW1]interface Eth-Trunk 1//创建链路聚合组1
[LSW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/3 //将G0/0/1到G0/0/3加入到聚合组1
[LSW1-Eth-Trunk1]quit
[Huawei]undo info-center enable
[Huawei]sysname LSW2
[LSW2]interface Eth-Trunk 1 创建链路聚合组1
[LSW2-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/3 //将G0/0/1到G0/0/3加入到聚合组1
[LSW2-Eth-Trunk1]quit
(3)在LSW1和LSW2上创建VLAN并将接口加入VLAN。
SW1的配置
[LSW1]vlan batch 10 20
[LSW1]interface g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type access
[LSW1-GigabitEthernet0/0/4]port default vlan 10
[LSW1-GigabitEthernet0/0/4]quit
[LSW1]interface g0/0/5
[LSW1-GigabitEthernet0/0/5]port link-type access
[LSW1-GigabitEthernet0/0/5]port default vlan 20
[LSW1-GigabitEthernet0/0/5]quit
SW2的配置
[LSW2]vlan batch 10 20
[LSW2]interface g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type access
[LSW2-GigabitEthernet0/0/4]port default vlan 10
[LSW2-GigabitEthernet0/0/4]quit
[LSW2]interface g0/0/5
[LSW2-GigabitEthernet0/0/5]port link-type access
[LSW2-GigabitEthernet0/0/5]port default vlan 20
[LSW2-GigabitEthernet0/0/5]quit
(4)在LSW1和LSW2上配置Eth-Trunk1接口允许VLAN10和VLAN20通过。
LSW1的配置
[LSW1]interface Eth-Trunk 1
[LSW1-Eth-Trunk1]port link-type trunk
[LSW1-Eth-Trunk1]port trunk allow-pass vlan 10 20
[LSW1-Eth-Trunk1]quit
LSW2的配置
[LSW2]interface Eth-Trunk 1
[LSW2-Eth-Trunk1]port link-type trunk
[LSW2-Eth-Trunk1]port trunk allow-pass vlan 10 20
[LSW2-Eth-Trunk1]quit
【技术要点】
Eth-trunk接口为设备的逻辑接口,交换机LSW1和LSW2的实际接口G0/0/1到G0/0/3都属于该聚合口的成员接口,对于交换机LSW1和LSW2而言,就相当于使用聚合口eth-trunk 1连接在一起,因此交换LSW1和交换机LSW2的链路类型以及相关配置,只需要在聚合口配置即可,无需到实际接口配置。
(5)配置Eth-Trunk1的负载分担方式
LSW1的配置
[LSW1]interface Eth-Trunk 1
[LSW1-Eth-Trunk1]load-balance src-dst-mac //配置负载分担模式为基于源目mac地址进行hash计算选择路径
[LSW1-Eth-Trunk1]quit
LSW2的配置
[LSW2]interface Eth-Trunk 1
[LSW2-Eth-Trunk1]load-balance src-dst-mac
[LSW2-Eth-Trunk1]quit
【技术要点】
1、数据流是指一组具有某个或某些相同属性的数据包。这些属性有源MAC地址、目的MAC地址、源IP地址、目的IP地址、TCP/UDP的源端口号、TCP/UDP的目的端口号等。
2、对于负载分担,可以分为逐包的负载分担和逐流的负载分担。
在使用Eth-Trunk转发数据时,由于聚合组两端设备之间有多条物理链路,就会产生同一数据流的第一个数据帧在一条物理链路上传输,而第二个数据帧在另外一条物理链路上传输的情况。这样一来同一数据流的第二个数据帧就有可能比第一个数据帧先到达对端设备,从而产生接收数据包乱序的情况。
这种机制把数据帧中的地址通过HASH算法生成HASH-KEY值,然后根据这个数值在Eth-Trunk转发表中寻找对应的出接口,不同的MAC或IP地址HASH得出的HASH-KEY值不同,从而出接口也就不同,这样既保证了同一数据流的帧在同一条物理链路转发,又实现了流量在聚合组内各物理链路上的负载分担。逐流负载分担能保证包的顺序,但不能保证带宽利用率。
[LSW1]display eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SA-XOR-DA
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/1 Up 1
GigabitEthernet0/0/2 Up 1
GigabitEthernet0/0/3 Up 1
以上输出表明编号为1的聚合通道已经形成。每个字段代表的含义如下
①Workingmode表示工作模式,normal为手工负载分担模式。
②Hash arithmetic表示负载分担的hash算法,SA-XOR-DA表示基于源目mac地址进行hash计算。
③Least Active-linknumber 表示处于Up状态的成员链路的下限阈值。
④Max Active-linknumber 表示处于Up状态的成员链路的上限阈值。
⑤Operate status表示聚合口的状态,up为正常启动状态,down为物理上出现故障。
⑥Status表示本地成员接口的状态。
⑦Weight表示接口的权重值。
[LSW1]display interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, Hash arithmetic : According to SA-XOR-DA,Maximal BW: 3G, Current BW: 3G, The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cce5-1fa5
Current system time: 2022-04-03 14:29:28-08:00
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
-----------------------------------------------------
PortName Status Weight
-----------------------------------------------------
GigabitEthernet0/0/1 UP 1
GigabitEthernet0/0/2 UP 1
GigabitEthernet0/0/3 UP 1
-----------------------------------------------------
The Number of Ports in Trunk : 3
The Number of UP Ports in Trunk : 3
以上输出表明当前eth-trunk 1口的当前接口状态为up,协议状态也为up,最大能够支持的带宽为3G。
本文出自作者的《HCIA Datacom学习指南》
https://item.jd.com/14032255.html
在文章最后加作者VX:可以免费领取以下资料