华为交换机经典组网配置案例

目录

  1. 小型企业网络组网
  2. 中型园区网络组网
  3. 大型数据中心网络组网
  4. MSTP+VRRP 高可用组网
  5. 堆叠组网配置
  6. 无线 AC+AP 组网
  7. QinQ 组网配置

1. 小型企业网络组网

1.1 组网拓扑

1
2
3
4
5
6
7
8
9
10
11
             Internet
|
[防火墙]
|
[核心交换机]
/ \
/ \
[接入交换机 1] [接入交换机 2]
/ \ / \
PC1 PC2 PC3 PC4
VLAN10 VLAN20 VLAN10 VLAN20

1.2 需求分析

  • 2 个部门:行政部(VLAN10)、技术部(VLAN20)
  • 核心交换机提供 VLAN 间路由
  • 接入交换机二层接入
  • 统一出口上网

1.3 核心交换机配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 设备名称
<Huawei> system-view
[Huawei] sysname Core-SW

# 创建 VLAN
[Core-SW] vlan batch 10 20 100

# 配置连接接入交换机的接口
[Core-SW] interface GigabitEthernet 0/0/1
[Core-SW-GigabitEthernet0/0/1] description To_Access_SW1
[Core-SW-GigabitEthernet0/0/1] port link-type trunk
[Core-SW-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20
[Core-SW-GigabitEthernet0/0/1] quit

[Core-SW] interface GigabitEthernet 0/0/2
[Core-SW-GigabitEthernet0/0/2] description To_Access_SW2
[Core-SW-GigabitEthernet0/0/2] port link-type trunk
[Core-SW-GigabitEthernet0/0/2] port trunk allow-pass vlan 10 20
[Core-SW-GigabitEthernet0/0/2] quit

# 配置连接防火墙的接口
[Core-SW] interface GigabitEthernet 0/0/24
[Core-SW-GigabitEthernet0/0/24] description To_Firewall
[Core-SW-GigabitEthernet0/0/24] port link-type access
[Core-SW-GigabitEthernet0/0/24] port default vlan 100
[Core-SW-GigabitEthernet0/0/24] quit

# 配置 VLANIF 接口(VLAN 间路由)
[Core-SW] interface Vlanif 10
[Core-SW-Vlanif10] description HR_Department
[Core-SW-Vlanif10] ip address 192.168.10.1 255.255.255.0
[Core-SW-Vlanif10] quit

[Core-SW] interface Vlanif 20
[Core-SW-Vlanif20] description IT_Department
[Core-SW-Vlanif20] ip address 192.168.20.1 255.255.255.0
[Core-SW-Vlanif20] quit

[Core-SW] interface Vlanif 100
[Core-SW-Vlanif100] description To_Internet
[Core-SW-Vlanif100] ip address 192.168.100.2 255.255.255.0
[Core-SW-Vlanif100] quit

# 启用 IP 路由
[Core-SW] ip routing

# 配置默认路由指向防火墙
[Core-SW] ip route-static 0.0.0.0 0.0.0.0 192.168.100.1

# 配置 DHCP 服务
[Core-SW] dhcp enable
[Core-SW] ip pool vlan10
[Core-SW-ip-pool-vlan10] network 192.168.10.0 mask 255.255.255.0
[Core-SW-ip-pool-vlan10] gateway-list 192.168.10.1
[Core-SW-ip-pool-vlan10] dns-list 114.114.114.114 8.8.8.8
[Core-SW-ip-pool-vlan10] quit

[Core-SW] ip pool vlan20
[Core-SW-ip-pool-vlan20] network 192.168.20.0 mask 255.255.255.0
[Core-SW-ip-pool-vlan20] gateway-list 192.168.20.1
[Core-SW-ip-pool-vlan20] dns-list 114.114.114.114 8.8.8.8
[Core-SW-ip-pool-vlan20] quit

[Core-SW] interface Vlanif 10
[Core-SW-Vlanif10] dhcp select global
[Core-SW-Vlanif10] quit

[Core-SW] interface Vlanif 20
[Core-SW-Vlanif20] dhcp select global
[Core-SW-Vlanif20] quit

# 保存配置
<Core-SW> save

1.4 接入交换机配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 接入交换机 1 配置
<Huawei> system-view
[Huawei] sysname Access-SW1

# 创建 VLAN
[Access-SW1] vlan batch 10 20

# 配置连接 PC 的接口
[Access-SW1] interface GigabitEthernet 0/0/1
[Access-SW1-GigabitEthernet0/0/1] description To_PC1_HR
[Access-SW1-GigabitEthernet0/0/1] port link-type access
[Access-SW1-GigabitEthernet0/0/1] port default vlan 10
[Access-SW1-GigabitEthernet0/0/1] quit

[Access-SW1] interface GigabitEthernet 0/0/2
[Access-SW1-GigabitEthernet0/0/2] description To_PC2_IT
[Access-SW1-GigabitEthernet0/0/2] port link-type access
[Access-SW1-GigabitEthernet0/0/2] port default vlan 20
[Access-SW1-GigabitEthernet0/0/2] quit

# 配置上行接口
[Access-SW1] interface GigabitEthernet 0/0/24
[Access-SW1-GigabitEthernet0/0/24] description To_Core_SW
[Access-SW1-GigabitEthernet0/0/24] port link-type trunk
[Access-SW1-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20
[Access-SW1-GigabitEthernet0/0/24] quit

# 保存配置
<Access-SW1> save

# 接入交换机 2 配置(类似)
<Huawei> system-view
[Huawei] sysname Access-SW2
[Access-SW2] vlan batch 10 20
[Access-SW2] interface GigabitEthernet 0/0/1
[Access-SW2-GigabitEthernet0/0/1] port link-type access
[Access-SW2-GigabitEthernet0/0/1] port default vlan 10
[Access-SW2] interface GigabitEthernet 0/0/2
[Access-SW2-GigabitEthernet0/0/2] port link-type access
[Access-SW2-GigabitEthernet0/0/2] port default vlan 20
[Access-SW2] interface GigabitEthernet 0/0/24
[Access-SW2-GigabitEthernet0/0/24] port link-type trunk
[Access-SW2-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20
<Access-SW2> save

2. 中型园区网络组网

2.1 组网拓扑

1
2
3
4
5
6
7
8
9
10
             Internet
|
[防火墙]
|
[核心交换机 1] <====> [核心交换机 2]
/ | \ / | \
/ | \ / | \
[汇聚 1] [汇聚 2] [汇聚 3] [汇聚 1] [汇聚 2] [汇聚 3]
/ \ / \ / \ / \ / \ / \
接入 接入 接入 接入 接入 接入 接入 接入 接入 接入 接入

2.2 需求分析

  • 核心层双机冗余
  • 汇聚层链路聚合
  • 多 VLAN 隔离
  • 生成树防环
  • 无线覆盖

2.3 核心交换机配置(MSTP+VRRP)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 核心交换机 1
<Huawei> system-view
[Huawei] sysname Core-SW1

# 创建 VLAN
[Core-SW1] vlan batch 10 20 30 40 100

# 配置 MSTP
[Core-SW1] stp mode mstp
[Core-SW1] stp region-configuration
[Core-SW1-mst-region] region-name CAMPUS
[Core-SW1-mst-region] instance 1 vlan 10 20
[Core-SW1-mst-region] instance 2 vlan 30 40
[Core-SW1-mst-region] revision-level 1
[Core-SW1-mst-region] active region-configuration
[Core-SW1-mst-region] quit

# 配置 MSTP 实例优先级(Core-SW1 为实例 1 的主根)
[Core-SW1] stp instance 1 priority 0
[Core-SW1] stp instance 2 priority 4096

# 配置 VRRP
[Core-SW1] interface Vlanif 10
[Core-SW1-Vlanif10] ip address 192.168.10.2 255.255.255.0
[Core-SW1-Vlanif10] vrrp vrid 1 virtual-ip 192.168.10.1
[Core-SW1-Vlanif10] vrrp vrid 1 priority 120
[Core-SW1-Vlanif10] vrrp vrid 1 preempt-mode timer delay 20
[Core-SW1-Vlanif10] quit

[Core-SW1] interface Vlanif 20
[Core-SW1-Vlanif20] ip address 192.168.20.2 255.255.255.0
[Core-SW1-Vlanif20] vrrp vrid 2 virtual-ip 192.168.20.1
[Core-SW1-Vlanif20] vrrp vrid 2 priority 120
[Core-SW1-Vlanif20] quit

[Core-SW1] interface Vlanif 30
[Core-SW1-Vlanif30] ip address 192.168.30.2 255.255.255.0
[Core-SW1-Vlanif30] vrrp vrid 3 virtual-ip 192.168.30.1
[Core-SW1-Vlanif30] vrrp vrid 3 priority 100
[Core-SW1-Vlanif30] quit

[Core-SW1] interface Vlanif 40
[Core-SW1-Vlanif40] ip address 192.168.40.2 255.255.255.0
[Core-SW1-Vlanif40] vrrp vrid 4 virtual-ip 192.168.40.1
[Core-SW1-Vlanif40] vrrp vrid 4 priority 100
[Core-SW1-Vlanif40] quit

# 配置与 Core-SW2 的互联
[Core-SW1] interface Eth-Trunk 1
[Core-SW1-Eth-Trunk1] description To_Core-SW2
[Core-SW1-Eth-Trunk1] port link-type trunk
[Core-SW1-Eth-Trunk1] port trunk allow-pass vlan 10 20 30 40 100
[Core-SW1-Eth-Trunk1] mode lacp
[Core-SW1-Eth-Trunk1] quit

[Core-SW1] interface GigabitEthernet 1/0/1
[Core-SW1-GigabitEthernet1/0/1] eth-trunk 1
[Core-SW1] interface GigabitEthernet 1/0/2
[Core-SW1-GigabitEthernet1/0/2] eth-trunk 1

# 配置与汇聚交换机互联
[Core-SW1] interface Eth-Trunk 10
[Core-SW1-Eth-Trunk10] description To_Aggregation-SW1
[Core-SW1-Eth-Trunk10] port link-type trunk
[Core-SW1-Eth-Trunk10] port trunk allow-pass vlan 10 20 30 40
[Core-SW1-Eth-Trunk10] quit

[Core-SW1] interface GigabitEthernet 1/0/10
[Core-SW1-GigabitEthernet1/0/10] eth-trunk 10

# 配置 OSPF
[Core-SW1] ospf 1 router-id 1.1.1.1
[Core-SW1-ospf-1] area 0
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.10.0 0.0.0.255
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.20.0 0.0.0.255
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.30.0 0.0.0.255
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.40.0 0.0.0.255
[Core-SW1-ospf-1-area-0.0.0.0] network 192.168.100.0 0.0.0.255

# 配置默认路由
[Core-SW1] ip route-static 0.0.0.0 0.0.0.0 192.168.100.254

<Core-SW1> save

2.4 核心交换机 2 配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<Huawei> system-view
[Huawei] sysname Core-SW2

# VLAN 和 MSTP 配置与 Core-SW1 相同
[Core-SW2] vlan batch 10 20 30 40 100
[Core-SW2] stp mode mstp
[Core-SW2] stp region-configuration
[Core-SW2-mst-region] region-name CAMPUS
[Core-SW2-mst-region] instance 1 vlan 10 20
[Core-SW2-mst-region] instance 2 vlan 30 40
[Core-SW2-mst-region] revision-level 1
[Core-SW2-mst-region] active region-configuration

# MSTP 实例优先级(Core-SW2 为实例 2 的主根)
[Core-SW2] stp instance 1 priority 4096
[Core-SW2] stp instance 2 priority 0

# VRRP 配置(优先级相反)
[Core-SW2] interface Vlanif 10
[Core-SW2-Vlanif10] ip address 192.168.10.3 255.255.255.0
[Core-SW2-Vlanif10] vrrp vrid 1 virtual-ip 192.168.10.1
[Core-SW2-Vlanif10] vrrp vrid 1 priority 100
[Core-SW2-Vlanif10] quit

[Core-SW2] interface Vlanif 20
[Core-SW2-Vlanif20] ip address 192.168.20.3 255.255.255.0
[Core-SW2-Vlanif20] vrrp vrid 2 virtual-ip 192.168.20.1
[Core-SW2-Vlanif20] vrrp vrid 2 priority 100
[Core-SW2-Vlanif20] quit

[Core-SW2] interface Vlanif 30
[Core-SW2-Vlanif30] ip address 192.168.30.3 255.255.255.0
[Core-SW2-Vlanif30] vrrp vrid 3 virtual-ip 192.168.30.1
[Core-SW2-Vlanif30] vrrp vrid 3 priority 120
[Core-SW2-Vlanif30] quit

[Core-SW2] interface Vlanif 40
[Core-SW2-Vlanif40] ip address 192.168.40.3 255.255.255.0
[Core-SW2-Vlanif40] vrrp vrid 4 virtual-ip 192.168.40.1
[Core-SW2-Vlanif40] vrrp vrid 4 priority 120
[Core-SW2-Vlanif40] quit

# 其他配置与 Core-SW1 类似...
<Core-SW2> save

3. 大型数据中心网络组网

3.1 组网拓扑(Spine-Leaf 架构)

1
2
3
4
5
6
7
8
      [核心路由器]
|
[Spine 1] <====> [Spine 2]
/ \ / \
/ \ / \
[Leaf 1] [Leaf 2] [Leaf 3] [Leaf 4]
/ \ / \ / \ / \
[服务器集群] [服务器集群] [服务器集群] [服务器集群]

3.2 需求分析

  • 高带宽、低延迟
  • 无阻塞转发
  • 横向扩展能力
  • VXLAN overlay 网络

3.3 Spine 交换机配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<Huawei> system-view
[Huawei] sysname Spine-1

# 基础配置
[Spine-1] vlan batch 100
[Spine-1] interface Eth-Trunk 1
[Spine-1-Eth-Trunk1] description To_Spine-2
[Spine-1-Eth-Trunk1] port link-type trunk
[Spine-1-Eth-Trunk1] port trunk allow-pass vlan 100
[Spine-1-Eth-Trunk1] mode lacp

# 配置与 Leaf 的互联
[Spine-1] interface 100GE 1/0/1
[Spine-1-100GE1/0/1] description To_Leaf-1
[Spine-1-100GE1/0/1] port link-type trunk
[Spine-1-100GE1/0/1] port trunk allow-pass vlan 100

[Spine-1] interface 100GE 1/0/2
[Spine-1-100GE1/0/2] description To_Leaf-2
[Spine-1-100GE1/0/2] port link-type trunk
[Spine-1-100GE1/0/2] port trunk allow-pass vlan 100

# 配置 OSPF(Underlay)
[Spine-1] ospf 1 router-id 1.1.1.1
[Spine-1-ospf-1] area 0
[Spine-1-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.255

# 配置 BGP(Overlay)
[Spine-1] bgp 65001
[Spine-1-bgp] router-id 1.1.1.1
[Spine-1-bgp] peer 10.0.0.2 as-number 65001
[Spine-1-bgp] peer 10.0.0.4 as-number 65001
[Spine-1-bgp] peer 10.0.0.6 as-number 65001
[Spine-1-bgp] peer 10.0.0.8 as-number 65001
[Spine-1-bgp] ipv4-family unicast
[Spine-1-bgp-af-ipv4] peer 10.0.0.2 enable
[Spine-1-bgp-af-ipv4] peer 10.0.0.4 enable
[Spine-1-bgp-af-ipv4] peer 10.0.0.6 enable
[Spine-1-bgp-af-ipv4] peer 10.0.0.8 enable

<Spine-1> save

3.4 Leaf 交换机配置(VXLAN)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<Huawei> system-view
[Huawei] sysname Leaf-1

# 启用 VXLAN
[Leaf-1] vxlan

# 创建 VNI
[Leaf-1] vxlan 10
[Leaf-1-vxlan-10] vni 5010
[Leaf-1-vxlan-10] quit

[Leaf-1] vxlan 20
[Leaf-1-vxlan-20] vni 5020
[Leaf-1-vxlan-20] quit

# 配置 VBDIF 接口
[Leaf-1] interface Vbdif 10
[Leaf-1-Vbdif10] ip address 192.168.10.1 255.255.255.0
[Leaf-1-Vbdif10] arp collect host enable
[Leaf-1-Vbdif10] quit

[Leaf-1] interface Vbdif 20
[Leaf-1-Vbdif20] ip address 192.168.20.1 255.255.255.0
[Leaf-1-Vbdif20] arp collect host enable
[Leaf-1-Vbdif20] quit

# 配置 VXLAN 隧道
[Leaf-1] interface Nve 1
[Leaf-1-Nve1] source 10.0.0.1
[Leaf-1-Nve1] vni 5010 head-end peer-list 10.0.0.2
[Leaf-1-Nve1] vni 5020 head-end peer-list 10.0.0.2
[Leaf-1-Nve1] quit

# 配置与服务器连接
[Leaf-1] interface 10GE 1/0/1
[Leaf-1-10GE1/0/1] port link-type access
[Leaf-1-10GE1/0/1] port default vlan 10
[Leaf-1-10GE1/0/1] quit

[Leaf-1] interface 10GE 1/0/2
[Leaf-1-10GE1/0/2] port link-type access
[Leaf-1-10GE1/0/2] port default vlan 20
[Leaf-1-10GE1/0/2] quit

# 配置与 Spine 连接
[Leaf-1] interface 100GE 1/0/49
[Leaf-1-100GE1/0/49] port link-type trunk
[Leaf-1-100GE1/0/49] port trunk allow-pass vlan 100
[Leaf-1-100GE1/0/49] quit

[Leaf-1] interface 100GE 1/0/50
[Leaf-1-100GE1/0/50] port link-type trunk
[Leaf-1-100GE1/0/50] port trunk allow-pass vlan 100
[Leaf-1-100GE1/0/50] quit

# 配置 OSPF
[Leaf-1] ospf 1 router-id 10.0.0.1
[Leaf-1-ospf-1] area 0
[Leaf-1-ospf-1-area-0.0.0.0] network 10.0.0.0 0.255.255.255

# 配置 BGP EVPN
[Leaf-1] bgp 65001
[Leaf-1-bgp] router-id 10.0.0.1
[Leaf-1-bgp] peer 10.0.0.100 as-number 65001
[Leaf-1-bgp] ipv4-family unicast
[Leaf-1-bgp-af-ipv4] peer 10.0.0.100 enable
[Leaf-1-bgp] l2vpn-family evpn
[Leaf-1-bgp-af-evpn] peer 10.0.0.100 enable
[Leaf-1-bgp-af-evpn] peer 10.0.0.100 advertise-all-vni

<Leaf-1> save

4. MSTP+VRRP 高可用组网

4.1 组网拓扑

1
2
3
4
5
6
7
  [核心交换机 A] <====> [核心交换机 B]
|| ||
|| ||
[汇聚交换机 A] <====> [汇聚交换机 B]
/ \ / \
/ \ / \
[接入 A1] [接入 A2] [接入 B1] [接入 B2]

4.2 配置要点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 核心交换机 A - MSTP 配置
[Core-A] stp mode mstp
[Core-A] stp region-configuration
[Core-A-mst-region] region-name DC
[Core-A-mst-region] instance 1 vlan 10 30
[Core-A-mst-region] instance 2 vlan 20 40
[Core-A-mst-region] active region-configuration

# 核心交换机 A 为实例 1 的主根,实例 2 的备根
[Core-A] stp instance 1 priority 0
[Core-A] stp instance 2 priority 4096

# 核心交换机 A - VRRP 配置
[Core-A] interface Vlanif 10
[Core-A-Vlanif10] ip address 192.168.10.2 24
[Core-A-Vlanif10] vrrp vrid 1 virtual-ip 192.168.10.1
[Core-A-Vlanif10] vrrp vrid 1 priority 120
[Core-A-Vlanif10] vrrp vrid 1 preempt-mode timer delay 20

[Core-A] interface Vlanif 20
[Core-A-Vlanif20] ip address 192.168.20.2 24
[Core-A-Vlanif20] vrrp vrid 2 virtual-ip 192.168.20.1
[Core-A-Vlanif20] vrrp vrid 2 priority 100

# 核心交换机 B - MSTP 配置
[Core-B] stp mode mstp
[Core-B] stp region-configuration
[Core-B-mst-region] region-name DC
[Core-B-mst-region] instance 1 vlan 10 30
[Core-B-mst-region] instance 2 vlan 20 40
[Core-B-mst-region] active region-configuration

# 核心交换机 B 为实例 2 的主根,实例 1 的备根
[Core-B] stp instance 1 priority 4096
[Core-B] stp instance 2 priority 0

# 核心交换机 B - VRRP 配置
[Core-B] interface Vlanif 10
[Core-B-Vlanif10] ip address 192.168.10.3 24
[Core-B-Vlanif10] vrrp vrid 1 virtual-ip 192.168.10.1
[Core-B-Vlanif10] vrrp vrid 1 priority 100

[Core-B] interface Vlanif 20
[Core-B-Vlanif20] ip address 192.168.20.3 24
[Core-B-Vlanif20] vrrp vrid 2 virtual-ip 192.168.20.1
[Core-B-Vlanif20] vrrp vrid 2 priority 120
[Core-B-Vlanif20] vrrp vrid 2 preempt-mode timer delay 20

4.3 配置验证

1
2
3
4
5
6
7
8
9
10
11
12
13
# 验证 MSTP
display stp brief
display stp instance 1
display stp instance 2

# 验证 VRRP
display vrrp brief
display vrrp

# 预期结果:
# - VLAN10/30: Core-A 为 Master,Core-B 为 Backup
# - VLAN20/40: Core-B 为 Master,Core-A 为 Backup
# - 流量负载分担在两条路径上

5. 堆叠组网配置

5.1 组网拓扑

1
2
3
4
[堆叠交换机 1] <==== 堆叠电缆 ====> [堆叠交换机 2]
/ \ / \
/ \ / \
[服务器] [服务器] [服务器] [服务器]

5.2 堆叠配置(以 S5700 为例)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 交换机 1 配置(主交换机)
<Huawei> system-view
[Huawei] sysname Stack-Member1

# 配置堆叠 ID 和优先级
[Stack-Member1] stack
[Stack-Member1-stack] stack member 1 priority 150
[Stack-Member1-stack] stack member 1 renumber 1
[Stack-Member1-stack] quit

# 配置堆叠端口
[Stack-Member1] interface 10GE 1/0/25
[Stack-Member1-10GE1/0/25] stack port 1
[Stack-Member1] interface 10GE 1/0/26
[Stack-Member1-10GE1/0/26] stack port 1

# 保存并重启
<Stack-Member1> save
<Stack-Member1> reboot

# 交换机 2 配置(备交换机)
<Huawei> system-view
[Huawei] sysname Stack-Member2

# 配置堆叠 ID 和优先级
[Stack-Member2] stack
[Stack-Member2-stack] stack member 1 priority 100
[Stack-Member2-stack] stack member 1 renumber 2
[Stack-Member2-stack] quit

# 配置堆叠端口
[Stack-Member2] interface 10GE 1/0/25
[Stack-Member2-10GE1/0/25] stack port 1
[Stack-Member2] interface 10GE 1/0/26
[Stack-Member2-10GE1/0/26] stack port 1

# 保存并重启
<Stack-Member2> save
<Stack-Member2> reboot

# 使用堆叠电缆连接两台交换机的堆叠端口
# 先启动主交换机,再启动备交换机

5.3 堆叠验证

1
2
3
4
5
6
7
8
9
10
11
12
# 查看堆叠状态
<Stack> display stack
<Stack> display stack topology
<Stack> display stack configuration

# 查看成员交换机
<Stack> display device

# 预期输出:
# Slot Sub Type Online Register Status
# 1 1 S5720-28X Present Registered Master
# 2 2 S5720-28X Present Registered Standby

5.4 堆叠分裂检测(MAD)

1
2
3
4
5
6
7
8
9
10
11
# 配置直连检测
[Stack] mad enable
[Stack] interface Eth-Trunk 10
[Stack-Eth-Trunk10] mad detect mode direct

# 配置代理检测
[Stack] interface GigabitEthernet 1/0/1
[Stack-GigabitEthernet1/0/1] mad detect mode agent

# 查看 MAD 状态
<Stack> display mad

6. 无线 AC+AP 组网

6.1 组网拓扑

1
2
3
4
5
6
7
8
     [核心交换机]
|
[AC 控制器]
|
[PoE 交换机]
/ | \
/ | \
[AP1] [AP2] [AP3]

6.2 核心交换机配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<Huawei> system-view
[Huawei] sysname Core-SW

# 创建 VLAN
[Core-SW] vlan batch 10 100 200

# 配置管理 VLAN
[Core-SW] interface Vlanif 100
[Core-SW-Vlanif100] ip address 192.168.100.1 255.255.255.0
[Core-SW-Vlanif100] quit

# 配置业务 VLAN
[Core-SW] interface Vlanif 200
[Core-SW-Vlanif200] ip address 192.168.200.1 255.255.255.0
[Core-SW-Vlanif200] quit

# 配置 DHCP
[Core-SW] dhcp enable
[Core-SW] ip pool ap-management
[Core-SW-ip-pool-ap-management] network 192.168.100.0 mask 255.255.255.0
[Core-SW-ip-pool-ap-management] gateway-list 192.168.100.1
[Core-SW-ip-pool-ap-management] option 43 sub-option 3 ascii 192.168.100.254
[Core-SW-ip-pool-ap-management] quit

[Core-SW] ip pool station
[Core-SW-ip-pool-station] network 192.168.200.0 mask 255.255.255.0
[Core-SW-ip-pool-station] gateway-list 192.168.200.1
[Core-SW-ip-pool-station] dns-list 114.114.114.114
[Core-SW-ip-pool-station] quit

[Core-SW] interface Vlanif 100
[Core-SW-Vlanif100] dhcp select global
[Core-SW-Vlanif100] quit

# 配置连接 AC 的接口
[Core-SW] interface GigabitEthernet 0/0/24
[Core-SW-GigabitEthernet0/0/24] port link-type trunk
[Core-SW-GigabitEthernet0/0/24] port trunk allow-pass vlan 100 200
[Core-SW-GigabitEthernet0/0/24] port trunk pvid vlan 100

6.3 AC 控制器配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<Huawei> system-view
[Huawei] sysname AC

# 配置 WLAN 基本参数
[AC] wlan
[AC-wlan-view] ap auth-mode no-auth # 或 mac-auth / sn-auth

# 配置 AP 组
[AC-wlan-view] ap-group name default
[AC-wlan-ap-group-default] quit

# 配置射频模板
[AC-wlan-view] radio-2g-profile name default
[AC-wlan-radio-2g-prof-default] channel 20mhz
[AC-wlan-radio-2g-prof-default] eirp 27
[AC-wlan-radio-2g-prof-default] quit

[AC-wlan-view] radio-5g-profile name default
[AC-wlan-radio-5g-prof-default] channel 80mhz
[AC-wlan-radio-5g-prof-default] eirp 30
[AC-wlan-radio-5g-prof-default] quit

# 配置 VAP 模板
[AC-wlan-view] vap-profile name default
[AC-wlan-vap-prof-default] forward-mode tunnel
[AC-wlan-vap-prof-default] service-vlan vlan 200
[AC-wlan-vap-prof-default] ssid-profile name default
[AC-wlan-vap-prof-default] security-profile name default
[AC-wlan-vap-prof-default] quit

# 配置 SSID 模板
[AC-wlan-view] ssid-profile name default
[AC-wlan-ssid-prof-default] ssid Huawei-WLAN
[AC-wlan-ssid-prof-default] quit

# 配置安全模板
[AC-wlan-view] security-profile name default
[AC-wlan-sec-prof-default] security wpa2 psk pass-phrase Huawei@123 aes
[AC-wlan-sec-prof-default] quit

# 将配置应用到 AP 组
[AC-wlan-view] ap-group name default
[AC-wlan-ap-group-default] radio 0
[AC-wlan-ap-group-default-radio-0] vap-profile default wlan 1
[AC-wlan-ap-group-default-radio-0] radio-2g-profile default
[AC-wlan-ap-group-default-radio-0] quit
[AC-wlan-ap-group-default] radio 1
[AC-wlan-ap-group-default-radio-1] vap-profile default wlan 1
[AC-wlan-ap-group-default-radio-1] radio-5g-profile default
[AC-wlan-ap-group-default-radio-1] quit
[AC-wlan-ap-group-default] quit

# 查看 AP 状态
[AC] display ap all
[AC] display station all

7. QinQ 组网配置

7.1 组网拓扑

1
2
3
4
5
[用户 Site A]                    [用户 Site B]
| |
[CE-A] [CE-B]
| |
[PE-A] ======= 运营商网络 ======= [PE-B]

7.2 PE 交换机配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<Huawei> system-view
[Huawei] sysname PE-A

# 创建 VLAN
[PE-A] vlan batch 10 100

# 配置连接用户的接口(添加外层 VLAN)
[PE-A] interface GigabitEthernet 0/0/1
[PE-A-GigabitEthernet0/0/1] description To_CE-A
[PE-A-GigabitEthernet0/0/1] port link-type hybrid
[PE-A-GigabitEthernet0/0/1] port hybrid tagged vlan 100
[PE-A-GigabitEthernet0/0/1] qinq vlan-translation enable
[PE-A-GigabitEthernet0/0/1] port vlan-stacking vlan 10 stack-vlan 100
[PE-A-GigabitEthernet0/0/1] quit

# 配置连接运营商网络的接口
[PE-A] interface GigabitEthernet 0/0/24
[PE-A-GigabitEthernet0/0/24] description To_P-Network
[PE-A-GigabitEthernet0/0/24] port link-type trunk
[PE-A-GigabitEthernet0/0/24] port trunk allow-pass vlan 100
[PE-A-GigabitEthernet0/0/24] quit

# 查看 QinQ 配置
[PE-A] display qinq vlan-translation
[PE-A] display port vlan-stacking

7.3 灵活 QinQ 配置

1
2
3
4
5
6
7
8
9
# 基于内层 VLAN ID 添加不同外层 VLAN
[PE-A] interface GigabitEthernet 0/0/1
[PE-A-GigabitEthernet0/0/1] port vlan-stacking vlan 10 to 20 stack-vlan 100
[PE-A-GigabitEthernet0/0/1] port vlan-stacking vlan 30 to 40 stack-vlan 200

# 基于 802.1p 优先级添加外层 VLAN
[PE-A] interface GigabitEthernet 0/0/1
[PE-A-GigabitEthernet0/0/1] port vlan-stacking 8021p 5 stack-vlan 100
[PE-A-GigabitEthernet0/0/1] port vlan-stacking 8021p 6 stack-vlan 200

文档版本: 1.0
最后更新: 2026-02-27
适用设备: 华为 S5700/S6700/S7700/S9700/CE 系列交换机