华为交换机故障排查分析案例

目录

  1. 网络连通性故障
  2. VLAN 故障
  3. 生成树故障
  4. 链路聚合故障
  5. 路由协议故障
  6. DHCP 故障
  7. 安全特性故障
  8. 性能故障
  9. 硬件故障
  10. 故障排查方法论

1. 网络连通性故障

1.1 故障现象

  • PC 无法访问网络
  • Ping 不通网关
  • 部分 VLAN 无法通信

1.2 排查步骤

步骤 1:检查物理连接

1
2
3
4
5
6
7
8
9
10
11
12
13
# 查看接口状态
<SW1> display interface GigabitEthernet 0/0/1
# 检查项:
# - Current state: UP/DOWN
# - Line protocol current state: UP/DOWN
# - Input/Output errors

# 批量查看接口状态
<SW1> display interface brief
# 快速定位 DOWN 的接口

# 查看接口统计
<SW1> display interface GigabitEthernet 0/0/1 | include error|discard

步骤 2:检查 VLAN 配置

1
2
3
4
5
6
7
8
9
10
11
# 查看 VLAN 信息
<SW1> display vlan
<SW1> display vlan 10

# 查看接口 VLAN 配置
<SW1> display port vlan GigabitEthernet 0/0/1

# 查看 MAC 地址表
<SW1> display mac-address
<SW1> display mac-address vlan 10
<SW1> display mac-address interface GigabitEthernet 0/0/1

步骤 3:检查 IP 配置

1
2
3
4
5
6
7
8
9
10
11
# 查看 VLANIF 接口
<SW1> display ip interface brief
<SW1> display interface Vlanif 10

# 查看 ARP 表
<SW1> display arp
<SW1> display arp vlan 10

# 测试连通性
<SW1> ping 192.168.10.1
<SW1> ping -a 192.168.10.1 192.168.20.1 # 指定源地址

1.3 典型案例

案例 1:Access 端口 VLAN 配置错误

现象: PC 无法获取 IP,无法上网

排查:

1
2
3
4
5
6
7
8
9
<SW1> display current-configuration interface GigabitEthernet 0/0/1
# 发现配置:
# port link-type trunk
# port trunk allow-pass vlan 10

<SW1> display port vlan GigabitEthernet 0/0/1
# Port link-type: trunk
# PVID: 1
# Trunk VLAN pass: 10

问题: Access 设备连接了 Trunk 端口,且 PVID 不匹配

解决:

1
2
3
4
<SW1> system-view
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] port link-type access
[SW1-GigabitEthernet0/0/1] port default vlan 10

案例 2:VLANIF 接口 DOWN

现象: 同 VLAN 内可以通信,无法跨 VLAN 通信

排查:

1
2
3
4
5
6
7
8
9
<SW1> display ip interface brief
# Vlanif10 192.168.10.1/24 DOWN

<SW1> display interface Vlanif 10
# Current state: DOWN
# Line protocol current state: DOWN

<SW1> display vlan 10
# VLAN 10 没有活动的物理端口

问题: VLAN 10 没有 UP 的物理端口,VLANIF 自动 DOWN

解决:

1
2
3
4
# 方法 1:确保 VLAN 内有 UP 的物理端口
# 方法 2:配置 VLANIF 强制 UP(某些版本支持)
[SW1] interface Vlanif 10
[SW1-Vlanif10] undo shutdown

2. VLAN 故障

2.1 故障现象

  • VLAN 间无法通信
  • 部分端口无法加入 VLAN
  • VLAN 配置不生效

2.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 查看 VLAN 配置
display vlan
display vlan summary
display vlan 10

# 查看接口 VLAN 成员
display port vlan
display port vlan interface GigabitEthernet 0/0/1

# 查看 VLAN MAC 地址
display mac-address vlan 10

# 查看 VLAN 路由
display ip routing-table vlan 10

2.3 典型案例

案例 1:Trunk 端口未放行 VLAN

现象: 跨交换机同 VLAN 无法通信

排查:

1
2
3
4
5
6
7
8
9
# SW1 配置
<SW1> display interface GigabitEthernet 0/0/24
# Port link-type: trunk
# Trunk VLAN pass: 10 20

# SW2 配置
<SW2> display interface GigabitEthernet 0/0/24
# Port link-type: trunk
# Trunk VLAN pass: 10

问题: SW2 的 Trunk 端口未放行 VLAN 20

解决:

1
2
[SW2] interface GigabitEthernet 0/0/24
[SW2-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20

案例 2:VLAN 接口 IP 配置错误

现象: VLAN 间路由不通

排查:

1
2
3
4
5
6
<SW1> display ip interface brief
# Vlanif10 192.168.10.1/24 UP
# Vlanif20 192.168.20.1/24 UP

<SW1> display current-configuration | include ip routing
# 没有 ip routing 配置

问题: 未启用 IP 路由功能

解决:

1
[SW1] ip routing

3. 生成树故障

3.1 故障现象

  • 网络环路
  • 部分端口被阻塞
  • 网络收敛慢

3.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 查看 STP 状态
display stp
display stp brief
display stp interface GigabitEthernet 0/0/1

# 查看 MSTP
display stp region-configuration
display stp instance 1

# 查看 STP 统计
display stp statistics
display stp tc

# 查看 BPDU 信息
debugging stp bpdu

3.3 典型案例

案例 1:网络环路导致广播风暴

现象: 网络缓慢,CPU 利用率高,接口流量异常

排查:

1
2
3
4
5
6
7
8
<SW1> display cpu-usage
# CPU utilization: 95%

<SW1> display interface brief | include up
# 多个接口流量接近 100%

<SW1> display stp brief
# 发现多个端口处于 FORWARDING 状态,存在潜在环路

解决:

1
2
3
4
5
6
7
8
9
10
11
12
13
# 1. 启用 STP
[SW1] stp enable
[SW1] stp mode rstp

# 2. 配置边缘端口
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] stp edged-port enable

# 3. 启用 BPDU 保护
[SW1] stp bpdu-protection

# 4. 排查物理环路
# 检查是否有两根网线连接同一交换机

案例 2:根桥位置不当

现象: 次优路径,部分链路带宽浪费

排查:

1
2
3
4
5
6
<SW1> display stp brief
# 发现接入交换机成为了根桥

<SW1> display stp | include Root
# Root ID Priority: 32768
# 所有交换机优先级相同,比较 MAC 地址

解决:

1
2
3
4
5
6
7
8
9
# 在核心交换机配置
[Core-SW] stp priority 0
# 或
[Core-SW] stp root primary

# 在汇聚交换机配置
[Agg-SW] stp priority 4096
# 或
[Agg-SW] stp root secondary

4. 链路聚合故障

4.1 故障现象

  • Eth-Trunk 接口 DOWN
  • 成员接口未加入成功
  • 负载分担不均

4.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
# 查看 Eth-Trunk 状态
display eth-trunk
display eth-trunk 1

# 查看 LACP 信息
display lacp statistics eth-trunk 1
display lacp peer eth-trunk 1

# 查看负载分担
display load-balance
display interface Eth-Trunk 1 | include rate

4.3 典型案例

案例 1:LACP 模式不匹配

现象: Eth-Trunk 无法 UP

排查:

1
2
3
4
5
6
7
8
9
10
<SW1> display eth-trunk 1
# Eth-Trunk1's state information is:
# Local:
# Mode: LACP
# Peer:
# Mode: - (无信息)

<SW2> display eth-trunk 1
# Local:
# Mode: Manual Load Balance

问题: 两端模式不匹配(一端 LACP,一端手工)

解决:

1
2
3
# 统一配置为 LACP 模式
[SW2] interface Eth-Trunk 1
[SW2-Eth-Trunk1] mode lacp

案例 2:成员接口配置不一致

现象: 部分成员接口无法加入 Eth-Trunk

排查:

1
2
3
4
5
<SW1> display eth-trunk 1
# 发现部分成员接口状态为 UNSELECT

<SW1> display interface GigabitEthernet 0/0/2
# 发现该接口有独立配置

解决:

1
2
3
4
5
6
# 清除成员接口独立配置
[SW1] clear configuration interface GigabitEthernet 0/0/2

# 重新加入 Eth-Trunk
[SW1] interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2] eth-trunk 1

5. 路由协议故障

5.1 故障现象

  • OSPF 邻居无法建立
  • 路由学习不到
  • 路由震荡

5.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# OSPF 排查
display ospf brief
display ospf peer
display ospf interface
display ospf routing
display ospf error

# 静态路由排查
display ip routing-table
display ip routing-table protocol static
display ip routing-table protocol ospf

# BGP 排查
display bgp peer
display bgp routing-table

5.3 典型案例

案例 1:OSPF 邻居无法建立

现象: OSPF 邻居状态停留在 INIT 或 2-WAY

排查:

1
2
3
4
5
6
7
8
<SW1> display ospf peer
# Neighbor brief information
# Area 0.0.0.0
# Router ID: 2.2.2.2 Address: 192.168.1.2 State: Init

<SW1> display ospf interface Vlanif 10
# 检查 Hello/Dead 间隔
# 检查认证配置

常见问题及解决:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 1. 区域 ID 不匹配
[SW1] ospf 1
[SW1-ospf-1] area 0 # 确保两端区域 ID 一致

# 2. Hello/Dead 间隔不匹配
[SW1] interface Vlanif 10
[SW1-Vlanif10] ospf timer hello 10
[SW1-Vlanif10] ospf timer dead 40

# 3. 认证不匹配
[SW1-ospf-1-area-0.0.0.0] authentication-mode md5 1 cipher Huawei@123

# 4. 网络类型不匹配
[SW1-Vlanif10] ospf network-type broadcast

案例 2:路由震荡

现象: 路由频繁变化,网络不稳定

排查:

1
2
3
4
5
<SW1> display ospf statistics
# 发现大量 SPF 计算

<SW1> display logbuffer | include OSPF
# 查看 OSPF 日志

解决:

1
2
3
4
5
6
7
8
9
10
# 1. 配置 SPF 延迟计算
[SW1] ospf 1
[SW1-ospf-1] spf-schedule-interval 5

# 2. 配置接口开销
[SW1] interface Vlanif 10
[SW1-Vlanif10] ospf cost 100

# 3. 配置路由聚合
[SW1-ospf-1-area-0.0.0.0] abr-summary 192.168.0.0 255.255.0.0

6. DHCP 故障

6.1 故障现象

  • 客户端无法获取 IP
  • 获取到错误网段 IP
  • IP 地址冲突

6.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
# 查看 DHCP 配置
display dhcp server tree
display dhcp server conflict
display dhcp server free-ip

# 查看 DHCP 统计
display dhcp server statistics

# 查看 DHCP Snooping
display dhcp snooping
display dhcp snooping binding

6.3 典型案例

案例 1:DHCP 客户端无法获取 IP

现象: PC 获取到 169.254.x.x 地址

排查:

1
2
3
4
5
<SW1> display dhcp server statistics
# 发现没有 DHCP Discover 消息

<SW1> display current-configuration | include dhcp
# 检查 DHCP 是否启用

解决:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 1. 启用 DHCP
[SW1] dhcp enable

# 2. 配置 IP 池
[SW1] ip pool vlan10
[SW1-ip-pool-vlan10] network 192.168.10.0 mask 255.255.255.0
[SW1-ip-pool-vlan10] gateway-list 192.168.10.1
[SW1-ip-pool-vlan10] dns-list 114.114.114.114

# 3. 接口启用 DHCP
[SW1] interface Vlanif 10
[SW1-Vlanif10] dhcp select global

# 4. 检查 DHCP Snooping 信任接口
[SW1] interface GigabitEthernet 0/0/24
[SW1-GigabitEthernet0/0/24] dhcp snooping trusted

案例 2:DHCP 地址耗尽

现象: 新客户端无法获取 IP

排查:

1
2
3
4
5
<SW1> display dhcp server tree vlan 10
# 查看已分配地址

<SW1> display dhcp server free-ip
# 查看剩余地址

解决:

1
2
3
4
5
6
7
8
9
# 1. 扩大地址池
[SW1] ip pool vlan10
[SW1-ip-pool-vlan10] network 192.168.10.0 mask 255.255.255.0
[SW1-ip-pool-vlan10] gateway-list 192.168.10.1
[SW1-ip-pool-vlan10] excluded-ip-address 192.168.10.1 192.168.10.10
[SW1-ip-pool-vlan10] lease day 1 # 缩短租期

# 2. 清理过期租约
<SW1> reset dhcp server tree all

7. 安全特性故障

7.1 故障现象

  • 合法用户无法接入
  • 端口安全误拦截
  • 802.1X 认证失败

7.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 端口安全
display port-security
display mac-address

# 802.1X
display dot1x
display dot1x connections

# DHCP Snooping
display dhcp snooping
display dhcp snooping binding

# ACL
display acl
display traffic-filter applied-record

7.3 典型案例

案例 1:端口安全导致用户无法接入

现象: 更换 PC 后无法上网

排查:

1
2
3
4
5
6
7
<SW1> display port-security interface GigabitEthernet 0/0/1
# Max MAC count: 1
# Current MAC count: 1
# Protect action: shutdown

<SW1> display mac-address interface GigabitEthernet 0/0/1
# 发现是旧 PC 的 MAC 地址

解决:

1
2
3
4
5
6
7
8
9
# 方法 1:清除旧 MAC
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] undo port-security mac-address sticky

# 方法 2:增加 MAC 数量
[SW1-GigabitEthernet0/0/1] port-security max-mac-count 5

# 方法 3:修改保护动作
[SW1-GigabitEthernet0/0/1] port-security protect-action restrict

案例 2:802.1X 认证失败

现象: 用户认证失败,无法接入网络

排查:

1
2
3
4
5
6
7
8
<SW1> display dot1x connections
# 无认证连接

<SW1> display dot1x statistics
# 查看认证失败统计

<SW1> display radius-configuration
# 检查 RADIUS 配置

解决:

1
2
3
4
5
6
7
8
9
# 1. 检查 RADIUS 服务器连通性
[SW1] test-aaa radius template radius1

# 2. 检查共享密钥
[SW1] display current-configuration | include radius-server shared-key

# 3. 检查接口 802.1X 配置
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] dot1x enable

8. 性能故障

8.1 故障现象

  • 网络延迟高
  • 吞吐量低
  • 丢包严重

8.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# CPU 和内存
display cpu-usage
display memory-usage

# 接口统计
display interface | include rate|error|discard
display interface GigabitEthernet 0/0/1

# 缓存和队列
display qos queue statistics
display qos queue interface

# 风暴控制
display storm-control

8.3 典型案例

案例 1:广播风暴

现象: 网络缓慢,接口流量异常

排查:

1
2
3
4
5
<SW1> display interface brief
# 发现多个接口广播包计数很高

<SW1> display storm-control
# 查看风暴控制状态

解决:

1
2
3
4
5
6
7
8
9
10
11
12
# 1. 启用风暴控制
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] storm-control broadcast min-rate 1000 max-rate 2000
[SW1-GigabitEthernet0/0/1] storm-control multicast min-rate 1000 max-rate 2000

# 2. 排查环路
# 检查物理连接
# 检查 STP 配置

# 3. 隔离问题端口
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] shutdown

案例 2:接口错包

现象: 接口有大量 error/discarded 包

排查:

1
2
3
<SW1> display interface GigabitEthernet 0/0/1
# Input: 1000 packets, 100 errors
# Output: 1000 packets, 50 errors

解决:

1
2
3
4
5
6
7
8
9
10
11
# 1. 检查双工模式
[SW1] interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1] duplex full
[SW1-GigabitEthernet0/0/1] speed 1000

# 2. 检查网线质量
# 更换网线测试

# 3. 检查光模块
display transceiver interface GigabitEthernet 0/0/1
# 更换光模块测试

9. 硬件故障

9.1 故障现象

  • 设备无法启动
  • 接口频繁 UP/DOWN
  • 风扇/电源告警

9.2 排查命令

1
2
3
4
5
6
7
8
9
10
11
12
# 设备信息
display device
display version
display elabel

# 环境信息
display environment
display fan
display power

# 光模块信息
display transceiver interface

9.3 典型案例

案例 1:光模块故障

现象: 光口频繁 UP/DOWN

排查:

1
2
3
4
5
<SW1> display transceiver interface GigabitEthernet 0/0/24
# Voltage: 3.3V (Normal: 3.1-3.5V)
# Temperature: 45C (Normal: 0-70C)
# Tx Power: -20dBm (Normal: -9 to -3dBm) # 偏低
# Rx Power: -25dBm (Normal: -20 to -3dBm) # 偏低

解决:

1
2
3
# 1. 清洁光纤
# 2. 检查光纤长度
# 3. 更换光模块

案例 2:电源故障

现象: 设备告警,部分模块不工作

排查:

1
2
3
4
5
6
7
<SW1> display power
# Power 1: OK
# Power 2: Fault

<SW1> display environment
# Temperature: OK
# Voltage: Warning

解决:

1
2
3
# 1. 检查电源连接
# 2. 更换电源模块
# 3. 检查供电环境

10. 故障排查方法论

10.1 分层排查法

1
2
3
4
5
应用层  → 检查应用程序、服务配置
传输层 → 检查端口、连接状态
网络层 → 检查 IP、路由、ACL
数据链路层 → 检查 VLAN、MAC、STP
物理层 → 检查线缆、接口、硬件

10.2 对比法

1
2
3
4
5
6
# 与正常设备对比配置
display current-configuration
display saved-configuration

# 与基线对比
display baseline-configuration

10.3 分段法

1
2
源端 → 接入 → 汇聚 → 核心 → 汇聚 → 接入 → 目的端
逐段 Ping 测试,定位故障点

10.4 常用排查流程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 1. 收集信息
display current-configuration
display logbuffer
display trapbuffer
display diagnostic-information # 收集诊断信息

# 2. 分析问题
# 根据现象定位可能的故障点

# 3. 制定方案
# 确定排查步骤和解决方案

# 4. 实施解决
# 执行配置变更或硬件更换

# 5. 验证结果
ping test
service test

# 6. 记录归档
# 记录故障现象、原因、解决方案

10.5 诊断信息收集

1
2
3
4
5
6
7
8
# 收集完整诊断信息
<SW1> display diagnostic-information
# 保存到文件
<SW1> display diagnostic-information > flash:/diag.txt

# 收集特定模块信息
<SW1> display logbuffer > flash:/log.txt
<SW1> display trapbuffer > flash:/trap.txt

附录:常用故障排查命令速查

连通性

1
2
3
ping <ip>
tracert <ip>
telnet <ip> <port>

接口

1
2
3
4
display interface brief
display interface <interface>
display mac-address
display arp

VLAN

1
2
3
display vlan
display port vlan
display interface Vlanif

路由

1
2
3
display ip routing-table
display ospf peer
display bgp peer

安全

1
2
3
display acl
display port-security
display dhcp snooping

系统

1
2
3
4
display device
display cpu-usage
display memory-usage
display logbuffer

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