一、MSTP
测试环境:
为每一个交换机创建vlan,端口配置为trunk:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy s1
<s1>sy
Enter system view, return user view with Ctrl+Z.
[s1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[s1]port-group 1
[s1-port-group-1]group-member g0/0/5 g0/0/6
[s1-port-group-1]port link-type trunk
[s1-GigabitEthernet0/0/5]port link-type trunk
[s1-GigabitEthernet0/0/6]port link-type trunk
[s1-port-group-1]port trunk allow-pass vlan all
[s1-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[s1-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[s1-port-group-1] User interface con0 is available
配置mstp的区域并激活
<s1>sy
Enter system view, return user view with Ctrl+Z.
[s1]stp mode mstp
[s1]stp region-configuration
[s1-mst-region]region-name ntd
[s1-mst-region]instance 1 vlan 10
[s1-mst-region]instance 2 vlan 20
[s1-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
配置s1为vlan10的根网桥并查看
<s1>system-view
Enter system view, return user view with Ctrl+Z.
[s1]stp instance 1 priority 4096
[s1]
<s1>display stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/5 ALTE DISCARDING NONE
0 GigabitEthernet0/0/6 ROOT FORWARDING NONE
1 GigabitEthernet0/0/5 ROOT FORWARDING NONE
1 GigabitEthernet0/0/6 DESI FORWARDING NONE
2 GigabitEthernet0/0/5 ALTE DISCARDING NONE
2 GigabitEthernet0/0/6 ROOT FORWARDING NONE
<s1> User interface con0 is available
为路由器配置IP地址,并且将交换机端口加入vlan:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.10.254 24
Jun 19 2023 14:43:12-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[2]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.20.254 24
Jun 19 2023 14:44:11-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[3]:The line protocol
IP on the interface GigabitEthernet0/0/2 has entered the UP state.
[Huawei-GigabitEthernet0/0/2]
<Huawei>
加入vlan
<s2>sy
Enter system view, return user view with Ctrl+Z.
[s2]int g 0/0/1
[s2-GigabitEthernet0/0/1]port link-type access
[s2-GigabitEthernet0/0/1]port default vlan 20
[s2-GigabitEthernet0/0/1]
三、配置路由
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.10.254 24
二.ETH-TRUNK链路
1.测试
配置pc机ip网关:
pc5:192.168.10.1
pc6:192.168.20.1
pc7:192.168.10.2
pc8:192.168.20.2
手动模式
交换机上创建vlan10以及vlan20并将PC机端口加入vlan
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sy S1
[S1]vlan b
[S1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]port g
[S1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]port link-type access
^
Error:Ambiguous command found at '^' position.
[S1]port default vlan 10
^
Error:Ambiguous command found at '^' position.
[S1]int g 0/0/1
[S1-GigabitEthernet0/0/1]p
[S1-GigabitEthernet0/0/1]port l
[S1-GigabitEthernet0/0/1]port link-t
[S1-GigabitEthernet0/0/1]port link-type a
[S1-GigabitEthernet0/0/1]port link-type access
[S1-GigabitEthernet0/0/1]p
[S1-GigabitEthernet0/0/1]port de
[S1-GigabitEthernet0/0/1]port default vlan 10
[S1-GigabitEthernet0/0/1]q
[S1]int g 0/0/2
[S1-GigabitEthernet0/0/2]p
[S1-GigabitEthernet0/0/2]port l
[S1-GigabitEthernet0/0/2]port link-
[S1-GigabitEthernet0/0/2]port link-t
[S1-GigabitEthernet0/0/2]port link-type a
[S1-GigabitEthernet0/0/2]port link-type access
[S1-GigabitEthernet0/0/2]po
[S1-GigabitEthernet0/0/2]port de
[S1-GigabitEthernet0/0/2]port default vlan 20
[S1-GigabitEthernet0/0/2]q
[S1]
<S1>disp
<S1>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/3(D) GE0/0/4(D) GE0/0/5(U) GE0/0/6(U)
GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D)
GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D)
GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D)
GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D)
GE0/0/23(D) GE0/0/24(D)
10 common UT:GE0/0/1(U)
20 common UT:GE0/0/2(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
<S1>sys
<S1>system-view
Enter system view, return user view with Ctrl+Z.
[S1]int e
[S1]int Eth-Trunk 1
[S1-Eth-Trunk1]mode man
[S1-Eth-Trunk1]mode manual lo
[S1-Eth-Trunk1]mode manual load-balance
[S1-Eth-Trunk1]tr
[S1-Eth-Trunk1]trunkport g0/0/5
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1-Eth-Trunk1]tr
[S1-Eth-Trunk1]trunkport g0/0/6
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1-Eth-Trunk1]port l
[S1-Eth-Trunk1]port link-type t
[S1-Eth-Trunk1]port link-type trunk
[S1-Eth-Trunk1]port t
[S1-Eth-Trunk1]port trunk a
[S1-Eth-Trunk1]port trunk allow-pass
^
Error:Incomplete command found at '^' position.
[S1-Eth-Trunk1]port t
[S1-Eth-Trunk1]port trunk a
[S1-Eth-Trunk1]port trunk allow-pass vlan all
[S1-Eth-Trunk1]
<S1>
配置LACP模式 ETH-TRUNK
设置SW1为LACP主动端,优先级设置为100
<S1>sys
<S1>system-view
Enter system view, return user view with Ctrl+Z.
[S1]la
[S1]lacp p
[S1]lacp priority 100
[S1]int e
^
Error:Incomplete command found at '^' position.
[S1]int
[S1]interface eth-t
[S1]interface Eth-Trunk 1
[S1-Eth-Trunk1]mode l
[S1-Eth-Trunk1]mode lacp-static
[S1-Eth-Trunk1]tr
[S1-Eth-Trunk1]trunkport g0/0/5 to 0/0/7
^
Error:Too many parameters found at '^' position.
[S1-Eth-Trunk1]tr
[S1-Eth-Trunk1]trunkport g0/0/5 to 0/0/7
^
Error:Too many parameters found at '^' position.
[S1-Eth-Trunk1]port t
[S1-Eth-Trunk1]port l
[S1-Eth-Trunk1]port link-type t
[S1-Eth-Trunk1]port link-type trunk
[S1-Eth-Trunk1]port t
[S1-Eth-Trunk1]port trunk allow-pass vlan all
[S1-Eth-Trunk1]max ac
[S1-Eth-Trunk1]max active-linknumber 2
[S1-Eth-Trunk1]
<S1>
<S2>sys
<S2>system-view
Enter system view, return user view with Ctrl+Z.
[S2]int
[S2]interface eth-t
[S2]interface Eth-Trunk 1
[S2-Eth-Trunk1]mode l
[S2-Eth-Trunk1]mode lacp-static
[S2-Eth-Trunk1]tr
[S2-Eth-Trunk1]trunkport g0/0/5 to 0/0/7
^
Error:Too many parameters found at '^' position.
[S2-Eth-Trunk1]port l
[S2-Eth-Trunk1]port link-type t
[S2-Eth-Trunk1]port link-type trunk
[S2-Eth-Trunk1]port t
[S2-Eth-Trunk1]port trunk allow-pass vlan all
[S2-Eth-Trunk1]
[S2-Eth-Trunk1]q
[S2]