以下图配置为例:
各PC配置如下
配置LSW1
#划分vlan10 30 <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname LSW1 [LSW1]di Sep 16 2023 14:23:44-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2 5.191.3.1 configurations have been changed. The current change number is 4, the change loop count is 0, and the maximum number of records is 4095.s ^ Error:Incomplete command found at '^' position. [LSW1]undo info-center enable Info: Information center is disabled. [LSW1]display vlan The total number of vlans is : 1 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(U) GE0/0/13(U) GE0/0/14(D) GE0/0/15(D) GE0/0/16(U) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(U) GE0/0/23(U) GE0/0/24(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 [LSW1]vlan 30 [LSW1-vlan30]qu [LSW1]port-group pvlan30 [LSW1-port-group-pvlan30]port link-type access [LSW1-GigabitEthernet0/0/13]port link-type access [LSW1-GigabitEthernet0/0/14]port link-type access [LSW1-GigabitEthernet0/0/15]port link-type access [LSW1-GigabitEthernet0/0/16]port link-type access [LSW1-port-group-pvlan30]port default vlan 30 [LSW1-GigabitEthernet0/0/13]port default vlan 30 [LSW1-GigabitEthernet0/0/14]port default vlan 30 [LSW1-GigabitEthernet0/0/15]port default vlan 30 [LSW1-GigabitEthernet0/0/16]port default vlan 30 [LSW1-port-group-pvlan30]qu [LSW1]display vlan The total number of vlans is : 2 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(U) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(U) GE0/0/23(U) GE0/0/24(U) 30 common UT:GE0/0/13(U) GE0/0/14(D) GE0/0/15(D) GE0/0/16(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 30 enable default enable disable VLAN 0030 [LSW1]vlan 10 [LSW1-vlan10]qu [LSW1]port-group pvlan10 [LSW1-port-group-pvlan10]port link-type access [LSW1-GigabitEthernet0/0/9]port link-type access [LSW1-GigabitEthernet0/0/10]port link-type access [LSW1-GigabitEthernet0/0/11]port link-type access [LSW1-GigabitEthernet0/0/12]port link-type access [LSW1-port-group-pvlan10]port default vlan 10 [LSW1-GigabitEthernet0/0/9]port default vlan 10 [LSW1-GigabitEthernet0/0/10]port default vlan 10 [LSW1-GigabitEthernet0/0/11]port default vlan 10 [LSW1-GigabitEthernet0/0/12]port default vlan 10 [LSW1-port-group-pvlan10]qu [LSW1]display vlan The total number of vlans is : 3 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(U) GE0/0/23(U) GE0/0/24(U) 10 common UT:GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(U) 30 common UT:GE0/0/13(U) GE0/0/14(D) GE0/0/15(D) GE0/0/16(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 10 enable default enable disable VLAN 0010 30 enable default enable disable VLAN 0030 [LSW1] #数值可以随意 [LSW1]interface eth-trunk 1 #加入成员端口 #一定要全写gigabitehernet [LSW1-Eth-Trunk1]trunkport g0/0/22 to 0/0/24 ^ Error:Too many parameters found at '^' position. [LSW1-Eth-Trunk1]trunkport gigabitethernet 0/0/22 to 0/0/24 Info: This operation may take a few seconds. Please wait for a moment...done. [LSW1-Eth-Trunk1]port link-type trunk [LSW1-Eth-Trunk1]port trunk allow-pass vlan 10 30 #也可以允许所有vlan帧 #[LSW1-Eth-Trunk1]port trunk allow-pass vlan all #配置eth-trunk1的负担分担方式 #网络负载均衡的配置 [LSW1-Eth-Trunk1]load-balance src-dst-mac [LSW1-Eth-Trunk1]qu #查看eth-trunk1是否创建成功,成员端口是否正确加入 [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/22 Up 1 GigabitEthernet0/0/23 Up 1 GigabitEthernet0/0/24 Up 1 #检查成员信息 [LSW1]display trunkmembership eth-trunk 1 Trunk ID: 1 Used status: VALID TYPE: ethernet Working Mode : Normal Number Of Ports in Trunk = 3 Number Of Up Ports in Trunk = 3 Operate status: up Interface GigabitEthernet0/0/22, valid, operate up, weight=1 Interface GigabitEthernet0/0/23, valid, operate up, weight=1 Interface GigabitEthernet0/0/24, valid, operate up, weight=1 #将端口22,23和24配置为Trunk [LSW1]clear configuration interface g0/0/22 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW1]interface g0/0/22 [LSW1-GigabitEthernet0/0/22]undo shutdown [LSW1-GigabitEthernet0/0/22]port link-type trunk [LSW1-GigabitEthernet0/0/22]port trunk allow-pass vlan 10 30 #[LSW1-GigabitEthernet0/0/22]port trunk allow-pass vlan all [LSW1-GigabitEthernet0/0/22]qu [LSW1]clear configuration interface g0/0/23 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] : Error: Please choose 'YES' or 'NO' first before pressing 'Enter'. [Y/N]:y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW1] [LSW1]int g0/0/23 [LSW1-GigabitEthernet0/0/23]undo shutdown [LSW1-GigabitEthernet0/0/23]port link-type trunk [LSW1-GigabitEthernet0/0/23]port trunk allow-pass vlan 10 30 [LSW1-GigabitEthernet0/0/23]qu [LSW1]clear configuration interface g0/0/24 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW1] [LSW1]interface g0/0/24 [LSW1-GigabitEthernet0/0/24]undo shutdown [LSW1-GigabitEthernet0/0/24]port link-type trunk. [LSW1-GigabitEthernet0/0/24]port trunk allow-pass vlan 10 30 #[LSW1-GigabitEthernet0/0/24]port trunk allow-pass vlan all [LSW1-GigabitEthernet0/0/24]q #查看所有Eth-Trunk的端口信息 [LSW1]display eth-trunk 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: down Number Of Up Port In Trunk: 0 -------------------------------------------------------------------------------- PortName Status Weight #查看所有Eth-Trunk端口的带宽 [LSW1]display interface eth-trunk Eth-Trunk1 current state : DOWN Line protocol current state : DOWN Description: Switch Port, PVID : 1, Hash arithmetic : According to SA-XOR-DA,The Maximum F rame Length is 9216 IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc7b-4cdb Current system time: 2023-09-16 14:56:32-08:00 Input bandwidth utilization : 0% Output bandwidth utilization : 0% ----------------------------------------------------- PortName Status Weight ----------------------------------------------------- ----------------------------------------------------- The Number of Ports in Trunk : 0 The Number of UP Ports in Trunk : 0 #查看eth-trunk1端口的带宽 [LSW1]display interface eth-trunk 1 Eth-Trunk1 current state : DOWN Line protocol current state : DOWN Description: Switch Port, PVID : 1, Hash arithmetic : According to SA-XOR-DA,The Maximum F rame Length is 9216 IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc7b-4cdb Current system time: 2023-09-16 14:56:47-08:00 Input bandwidth utilization : 0% Output bandwidth utilization : 0% ----------------------------------------------------- PortName Status Weight ----------------------------------------------------- ----------------------------------------------------- The Number of Ports in Trunk : 0 The Number of UP Ports in Trunk : 0
LSW2和LSW1的配置相同
[Huawei]sysname LSW2 [LSW2]displa Sep 16 2023 15:02:54-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2 5.191.3.1 configurations have been changed. The current change number is 4, the change loop count is 0, and the maximum number of records is 4095.y ^ Error:Incomplete command found at '^' position. [LSW2]undo info-center enable Info: Information center is disabled. [LSW2]display vlan The total number of vlans is : 1 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(U) GE0/0/13(U) GE0/0/14(D) GE0/0/15(D) GE0/0/16(U) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(U) GE0/0/23(U) GE0/0/24(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 [LSW2]vlan 10 [LSW2-vlan10]qu [LSW2]port-group pvlan10 [LSW2-port-group-pvlan10]group-member g0/0/9 to g0/0/12 [LSW2-port-group-pvlan10]port link-type access [LSW2-GigabitEthernet0/0/9]port link-type access [LSW2-GigabitEthernet0/0/10]port link-type access [LSW2-GigabitEthernet0/0/11]port link-type access [LSW2-GigabitEthernet0/0/12]port link-type access [LSW2-port-group-pvlan10]port default vlan 10 [LSW2-GigabitEthernet0/0/9]port default vlan 10 [LSW2-GigabitEthernet0/0/10]port default vlan 10 [LSW2-GigabitEthernet0/0/11]port default vlan 10 [LSW2-GigabitEthernet0/0/12]port default vlan 10 [LSW2-port-group-pvlan10]qu [LSW2]vlan 30 [LSW2-vlan30]qu [LSW2]port-group pvlan30 [LSW2-port-group-pvlan30]group-member g0/0/13 to g0/0/16 [LSW2-port-group-pvlan30]port link-type access [LSW2-GigabitEthernet0/0/13]port link-type access [LSW2-GigabitEthernet0/0/14]port link-type access [LSW2-GigabitEthernet0/0/15]port link-type access [LSW2-GigabitEthernet0/0/16]port link-type access [LSW2-port-group-pvlan30]port default vlan 30 [LSW2-GigabitEthernet0/0/13]port default vlan 30 [LSW2-GigabitEthernet0/0/14]port default vlan 30 [LSW2-GigabitEthernet0/0/15]port default vlan 30 [LSW2-GigabitEthernet0/0/16]port default vlan 30 [LSW2-port-group-pvlan30]qu [LSW2]display vlan The total number of vlans is : 3 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/1(D) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(U) GE0/0/23(U) GE0/0/24(U) 10 common UT:GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(U) 30 common UT:GE0/0/13(U) GE0/0/14(D) GE0/0/15(D) GE0/0/16(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 10 enable default enable disable VLAN 0010 30 enable default enable disable VLAN 0030 [LSW2]interface eth-trunk 1 [LSW2-Eth-Trunk1]trunkport gigabitethernet 0/0/22 to 0/0/24 Info: This operation may take a few seconds. Please wait for a moment...done. [LSW2-Eth-Trunk1]port link-type trunk [LSW2-Eth-Trunk1]port trunk allow-pass vlan 10 30 [LSW2-Eth-Trunk1]load-balance src-dst-mac [LSW2-Eth-Trunk1]qu [LSW2]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/22 Up 1 GigabitEthernet0/0/23 Up 1 GigabitEthernet0/0/24 Up 1 [LSW2]display trunkmember eth-trunk 1 Trunk ID: 1 Used status: VALID TYPE: ethernet Working Mode : Normal Number Of Ports in Trunk = 3 Number Of Up Ports in Trunk = 3 Operate status: up Interface GigabitEthernet0/0/22, valid, operate up, weight=1 Interface GigabitEthernet0/0/23, valid, operate up, weight=1 Interface GigabitEthernet0/0/24, valid, operate up, weight=1 [LSW2]clear configuration interface g0/0/22 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW2]interface g0/0/22 [LSW2-GigabitEthernet0/0/22]undo shutdown [LSW2-GigabitEthernet0/0/22]port link-type trunk [LSW2-GigabitEthernet0/0/22]port trunk allow-pass vlan all [LSW2-GigabitEthernet0/0/22]qu [LSW2]clear configuration int g0/0/23 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW2]interface g0/0/23 [LSW2-GigabitEthernet0/0/23]undo shutdown [LSW2-GigabitEthernet0/0/23]port link-type trunk [LSW2-GigabitEthernet0/0/23]port trunk allow-pass vlan 10 30 [LSW2-GigabitEthernet0/0/23]qu [LSW2]clear configuration int g0/0/24 Warning: All configurations of the interface will be cleared, and its state will be shutdown. Continue? [Y/N] :y Info: Total execute 1 command(s), 1 successful, 0 failed. [LSW2]interface g0/0/24 [LSW2-GigabitEthernet0/0/24]undo shutdown [LSW2-GigabitEthernet0/0/24]port link-type trunk [LSW2-GigabitEthernet0/0/24]port trunk allow-pass vlan 10 30 [LSW2-GigabitEthernet0/0/24]qu [LSW2]display eth-trunk 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: down Number Of Up Port In Trunk: 0 -------------------------------------------------------------------------------- PortName Status Weight [LSW2]
我们对各PC进行数据抓包可以发现只有在GE 0/0/22才能进行通信
这是因为在手工模式创建的聚合组中,端口可能处于两种状态:Selected或 Standby。处于Selected状态且端口号最小的端口为聚合组的主端口, 其他处于Selected状态的端口为聚合组的成员端口。成员端口之间的通信是通过主端口进行的。主端口负责处理聚合组的控制信息和转发数据,它与对等设备交换状态信息,并协调成员端口的操作。成员端口将所有传入和传出的数据帧发送到主端口,由主端口处理后再进行转发。
这一案例中主端口是22端口,所以数据通过主端口(g0/0/22端口)进行转发
补充:LACP模式
在LACP模式下,部分链路是活动链路,所有活动链路均参与数据转发。如果某条活动链路故障,则链路聚合组自动在非活动链路中选择 一条链路作为活动链路,参与数据转发的链路数目不变。
将手动链路聚合改为LACP模式
[SW1]interface Eth-Trunk 1 [SW1-Eth-Trunk1]undo trunkport GigabitEthernet 0/0/22 to 0/0/24 [SW1-Eth-Trunk1]mode lacp-static [SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/22 to 0/0/24 [LSW1-Eth-Trunk1]display eth-trunk 1 Eth-Trunk1's state information is: Local: LAG ID: 1 WorkingMode: STATIC Preempt Delay: Disabled Hash arithmetic: According to SA-XOR-DA System Priority: 32768 System ID: 4c1f-cc7b-4cdb Least Active-linknumber: 1 Max Active-linknumber: 8 Operate status: down Number Of Up Port In Trunk: 0 -------------------------------------------------------------------------------- ActorPortName Status PortType PortPri PortNo PortKey PortState Weight GigabitEthernet0/0/22 Unselect 1GE 32768 23 305 10100010 1 GigabitEthernet0/0/23 Unselect 1GE 32768 24 305 10100010 1 GigabitEthernet0/0/24 Unselect 1GE 32768 25 305 10100010 1 Partner: -------------------------------------------------------------------------------- ActorPortName SysPri SystemID PortPri PortNo PortKey PortState GigabitEthernet0/0/22 0 0000-0000-0000 0 0 0 10100011 GigabitEthernet0/0/23 0 0000-0000-0000 0 0 0 10100011 GigabitEthernet0/0/24 0 0000-0000-0000 0 0 0 10100011 [LSW1-Eth-Trunk1]
LSW2配置同理,具体配置可以看http://t.csdn.cn/OCRj5