华为交换机基本操作 双 工 链路聚合 STP VLAN Trunk 三层接口路由

掌握目标
一、实验拓扑如下:
二、以太网交换机的基本操作
三、配置手动链路聚合
四、STP 部分
五、Trunk
六、VLAN 配置
七、VLAN 接口配置\

一、实验拓扑如下:

华为交换机基本操作 双 工 链路聚合 STP VLAN Trunk 三层接口路由_第1张图片

二、以太网交换机的基本操作

[S1]display interface GigabitEthernet 0/0/9 ====华为交换机默认为自动协商与双工模式
[S1]int g0/0/9
[S1-GigabitEthernet0/0/9]duplex full
Error: Please undo negotiation auto first
[S1-GigabitEthernet0/0/9]undo negotiation auto ===更改速率与双工必须先关闭自动协商
[S1-GigabitEthernet0/0/9]speed 100
[S1-GigabitEthernet0/0/9]duplex full

[S1]int g0/0/10
[S1-GigabitEthernet0/0/10]undo negotiation auto
[S1-GigabitEthernet0/0/10]speed 100
[S1-GigabitEthernet0/0/10]duplex full

[S2]int g0/0/9
[S2-GigabitEthernet0/0/9]undo negotiation auto
[S2-GigabitEthernet0/0/9]speed 100
[S2-GigabitEthernet0/0/9]duplex full

[S2]int g0/0/10
[S2-GigabitEthernet0/0/10]undo negotiation auto
[S2-GigabitEthernet0/0/10]speed 100
[S2-GigabitEthernet0/0/10]duplex full
[S1]display interface GigabitEthernet 0/0/9
[S1]display interface GigabitEthernet 0/0/10
三、配置手动链路聚合
[S1]interface Eth-Trunk 1 =创建 Eth-Trunk,Eth-Trunk 本地有效
[S1-Eth-Trunk1]quit
[S1]int g0/0/9
[S1-GigabitEthernet0/0/9]eth-trunk 1 =接口加入 Eth-Trunk
[S1]int g0/0/10
[S1-GigabitEthernet0/0/10]eth-trunk 1

[S1-Eth-Trunk1]quit
[S2-GigabitEthernet0/0/9]eth-trunk 1
[S2-GigabitEthernet0/0/10]eth-trunk 1
[S1]display interface Eth 1 =查看 eth-truk 信息


STP配置

华为交换机基本操作 双 工 链路聚合 STP VLAN Trunk 三层接口路由_第2张图片

STP 配置及验证

[S2]display stp brief =查看 STP 状态
如果没开启可以使用以下命令开启:
[S1]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment…done.
[S1]stp root secondary
[S2]stp mode stp
[S2]stp root primary
display stp interface g0/0/9 =查看 STP 接口状态

根桥的选举及验证

[S2]display stp =查看当前根桥信息
-------[CIST Global Info][Mode STP]-------
CIST Bridge :0 .4c1f-cc1f-026d
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc1f-026d / 0 =====CIST Bridge 与 CIST Root/ERPC 相同即为根桥
CIST RegRoot/IRPC :0 .4c1f-cc1f-026d / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
CIST Root Type :Primary root
TC or TCN received :134
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:7m:57s
Number of TC :25
Last TC occurred :GigabitEthernet0/0/13
[Port2(GigabitEthernet0/0/1)][DOWN]
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :0.4c1f-cc1f-026d / 128.2
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-cc99-5548
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc1f-026d / 2 =S2 的 CIST ROOT/ERPC
CIST RegRoot/IRPC :4096 .4c1f-cc99-5548 / 0
CIST RootPortId :128.16
BPDU-Protection :Disabled
CIST Root Type :Secondary root
TC or TCN received :246
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:16m:1s

[S1]undo stp root
[S1]stp priority 4096 ===修改桥优先级,越小越高

[S2]undo stp root
[S2]stp priority 8192
[S1]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-cc99-5548
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc99-5548 / 0
CIST RegRoot/IRPC :4096 .4c1f-cc99-5548 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :247
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:1m:49s
Number of TC :29
Last TC occurred :GigabitEthernet0/0/10
----[Port3(GigabitEthernet0/0/1)][DOWN]----
Port Protocol :Enabled
Port Role :Disabled Port
Port Priority :128
Port Cost(Dot1T ) :Config=auto / Active=200000000
Designated Bridge/Port :4096.4c1f-cc99-5548 / 128.3
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=false
Transit Limit :147 packets/hello-time
Protection Type :None
[S2]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :8192 .4c1f-cc1f-026d
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc99-5548 / 2
CIST RegRoot/IRPC :8192 .4c1f-cc1f-026d / 0
=关闭 9-10 接口后
interface GigabitEthernet0/0/9
shutdown
interface GigabitEthernet0/0/10
shutdown
interface GigabitEthernet0/0/13
shutdown
interface GigabitEthernet0/0/14
shutdown
=S2 成为根桥
==
[S2]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :8192 .4c1f-cc1f-026d
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :8192 .4c1f-cc1f-026d / 0
CIST RegRoot/IRPC :8192 .4c1f-cc1f-026d / 0
===============恢复 9-10 接口后=
interface GigabitEthernet0/0/9
undo shutdown
interface GigabitEthernet0/0/10
undo shutdown
interface GigabitEthernet0/0/13
undo shutdown
interface GigabitEthernet0/0/14
undo shutdown
=S1 重新选举成为根桥

[S1]display stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-cc99-5548
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc99-5548 / 0
CIST RegRoot/IRPC :4096 .4c1f-cc99-5548 / 0
四、根端口选举控制
[S2]display stp brief ===== G0/0/13 为根端口,G0/0/9 为替代端口
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/9 ALTE DISCARDING NONE
0 GigabitEthernet0/0/10 ALTE DISCARDING NONE
0 GigabitEthernet0/0/13 ROOT FORWARDING NONE
0 GigabitEthernet0/0/15 ALTE DISCARDING NONE
[S1]interface g0/0/9
[S1-GigabitEthernet0/0/9]stp port priority 32 ====更改端口优先级,默认为 128,数值越大越优
[S1-GigabitEthernet0/0/10]int g0/0/13
[S1-GigabitEthernet0/0/10]stp port priority 16
display stp int g0/0/9
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-cc99-5548
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc99-5548 / 0
CIST RegRoot/IRPC :4096 .4c1f-cc99-5548 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :249
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:28m:29s
Number of TC :35
Last TC occurred :GigabitEthernet0/0/14
----[Port27(GigabitEthernet0/0/9)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :32
Port Cost(Dot1T ) :Config=auto / Active=200000
Designated Bridge/Port :4096.4c1f-cc99-5548 / 32.27
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :17
TC or TCN received :0
BPDU Sent :811
TCN: 0, Config: 811, RST: 0, MST: 0
BPDU Received :1
TCN: 0, Config: 1, RST: 0, MST: 0
display stp int g0/0/10
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-cc99-5548
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :4096 .4c1f-cc99-5548 / 0
CIST RegRoot/IRPC :4096 .4c1f-cc99-5548 / 0
CIST RootPortId :0.0
BPDU-Protection :Disabled
TC or TCN received :249
TC count per hello :0
STP Converge Mode :Normal
Time since last TC :0 days 0h:29m:37s
Number of TC :35
Last TC occurred :GigabitEthernet0/0/14
----[Port28(GigabitEthernet0/0/10)][FORWARDING]----
Port Protocol :Enabled
Port Role :Designated Port
Port Priority :16
Port Cost(Dot1T ) :Config=auto / Active=200000
Designated Bridge/Port :4096.4c1f-cc99-5548 / 16.28
Port Edged :Config=default / Active=disabled
Point-to-point :Config=auto / Active=true
Transit Limit :147 packets/hello-time
Protection Type :None
Port STP Mode :STP
Port Protocol Type :Config=auto / Active=dot1s
BPDU Encapsulation :Config=stp / Active=stp
PortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20
TC or TCN send :17
TC or TCN received :0
BPDU Sent :837
TCN: 0, Config: 837, RST: 0, MST: 0
BPDU Received :0
TCN: 0, Config: 0, RST: 0, MST: 0
五、边缘端口配置
[S3-Ethernet0/0/13]stp edged-port enable ====无需经历 STP 计算,快速进入转发状态,主要针对于接服务器或主机端口
[S3]display st bri
MSTID Port Role STP State Protection
0 Ethernet0/0/13 ROOT FORWARDING NONE\

VLAN 配置

华为交换机基本操作 双 工 链路聚合 STP VLAN Trunk 三层接口路由_第3张图片
二、配置 Eth-trunk
[S1]interface Eth-Trunk 1
[S1-Eth-Trunk1]quit
[S1]int g0/0/9
[S1-GigabitEthernet0/0/9]eth-trunk 1
[S1]int g0/0/10
[S1-GigabitEthernet0/0/9]eth-trunk 1
[S1-Eth-Trunk1]port link-type trunk ====启用 trunk,默认接口为 Hybird
[S1-Eth-Trunk1]port trunk allow-pass vlan all ====该 trunk 链路上允许所有 VLAN,默认禁用所有 VLAN 穿越
[S2]interface Eth-Trunk 1
[S2-Eth-Trunk1]trunkport g0/0/9
[S2-Eth-Trunk1]trunkport g0/0/10
[S2-Eth-Trunk1]port link-type trunk
[S2-Eth-Trunk1]port trunk allow-pass vlan all
三、配置 VLAN
[S1]interface g0/0/13
[S1-GigabitEthernet0/0/13]port link-type access =====定义接口类型为访问接口
[S1]interface g0/0/1
[S1-GigabitEthernet0/0/1]port link-type access
[S1]vlan 3 ====创建 VLAN
[S1-vlan3]port g0/0/13 ====接口划入 VLAN
[S1-vlan3]vlan 4
[S1-vlan4]port g0/0/1
[S1]display vlan
[S2]vlan batch 3 to 5 ====连续创建三个 VLAN
[S2]int g0/0/3
[S2-GigabitEthernet0/0/3]port link-type access
[S2-GigabitEthernet0/0/3]port default vlan 4
[S2]int g0/0/24
[S2-GigabitEthernet0/0/24]port link-type access
[S2-GigabitEthernet0/0/24]port default vlan 5
四、配置 VLANIF 地址
[S3]interface Vlanif 1
[S3-Vlanif1]ip add 10.0.3.3 24
[S3]display ip int brief
[S4]int Vlanif 1
[S4-Vlanif1]ip add 10.0.5.4 24
[S1]interface Vlanif 3
[S1-Vlanif3]ip add 10.0.3.11 24
[S1]interface Vlanif 4
[S1-Vlanif4]ip add 10.0.4.11 24
[S1]interface Vlanif 5
[S1-Vlanif5]ip add 10.0.5.11 24
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.4.1 24
[R2]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 10.0.4.2 24
测试:
[S1]ping 10.0.3.3

你可能感兴趣的:(华为实验)