老网工最顺手的那几条华为命令,交换机日常维护检查就靠它们

号主:老杨丨11年资深网络工程师,更多网工提升干货,请关注公众号:网络工程师俱乐部


说真的,干网工的都知道,交换机问题不出则已,一出就是客户急、领导催、运维背锅三连击。

如果你还不会用那几条华为最基础也最实用的命令来搞定日常维护,迟早得吃点苦头。

这篇文章不长,但全是精华。全是日常排查/维护中最常用的华为命令,一看就懂,一学就会,一上手就能解决问题!


01 查看设备运行状态类

1. display version

📌 作用:查看设备型号、版本信息、补丁信息。

💡 老哥划重点:遇到兼容性问题、升级需求、BUG排查,第一步就看这个。

<HUAWEI> display version

2.&nbsp;display device

📌 作用:查看设备所有板卡/模块是否正常在线。

💡 适合用于初步判断硬件问题,板卡掉线、模块报错第一时间锁定。

<HUAWEI> display device


02 查看接口状态类

3.&nbsp;display interface brief

📌 作用:查看所有接口当前的up/down状态、IP地址、模式等。

💡 老哥经验:日常最常敲的一条,谁没背过“phy down、protocol down”这俩词?

<HUAWEI> display interface brief

4.&nbsp;display interface GigabitEthernet x/x/x

📌 作用:看某个具体端口的详细工作状态、流量、错误计数等。

💡 故障排查利器,判断丢包、错误包、双工不一致等问题超方便。

<HUAWEI> display interface GigabitEthernet 1/0/1

5.&nbsp;display counters interface GigabitEthernet x/x/x

📌 作用:查看端口的详细计数器,包括入包、出包、错误包。

💡 特别适合抓“丢包”“错包”问题,实测比看brief靠谱得多。


03 查看VLAN/链路聚合等基础配置类

6.&nbsp;display vlan

📌 作用:查看当前交换机所有VLAN及其成员端口。

💡 VLAN错配太常见,特别是划了VLAN但没加端口,看这条直接找出来。

7.&nbsp;display eth-trunk

📌 作用:查看链路聚合配置、状态、成员口信息。

💡 多链路做聚合,别以为都up了就没事,不同设备的LACP对不上的事也不少见。


04 MAC地址&转发类命令

8.&nbsp;display mac-address

📌 作用:查看当前交换机学习到的MAC地址表。

💡 不通就查MAC能不能学到,定位是否从源端口进来了。

<HUAWEI> display mac-address

9.&nbsp;display arp

📌 作用:查看ARP表,看IP和MAC的对应关系。

💡 有时候通不通,不是线的问题,是ARP没起来。静态ARP也记得顺手看下。


05 查看配置类

10.&nbsp;display current-configuration

📌 作用:显示当前运行配置。

💡 最全的一条命令,建议加个过滤,像这样:

<HUAWEI> display current-configuration | include GigabitEthernet


06 告警/系统日志排查类

11.&nbsp;display alarm all

📌 作用:查看所有当前未清除的告警信息。

💡 华为设备的告警机制比较敏感,哪怕没业务影响,也值得看看是不是硬件或链路问题。

12.&nbsp;display logbuffer

📌 作用:查看最近的系统日志,查故障前后设备记录。

💡 配合时间戳使用,能快速定位故障发生时设备的行为。


07 保存配置/查看用户类

13.&nbsp;save

📌 作用:保存当前配置到启动配置文件,防止设备重启配置丢失。

💡 有多少人做了改动没保存就掉电,最后只能重配...别问我怎么知道的。

14.&nbsp;display users

📌 作用:查看当前登录用户及来源IP。

💡 多人一起维护时,这条能防止你被“甩锅”。谁在登录设备,一看就知道。


08 日常巡检模板

巡检不是喊口号,是真能提前发现问题的事儿。下面这套命令清单,一般日巡、周巡、月巡都能用上,建议直接脚本or抄一份贴在运维手册里。

1、设备基础信息

display version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 设备型号、版本、补丁
display device &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 板卡在线状态
display cpu-usage &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// CPU利用率
display memory-usage &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 内存使用率
display environment &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 温度、电源、风扇情况

2、接口/VLAN/链路聚合状态

display interface brief &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 所有接口状态
display interface GigabitEthernet x/x/x // 重点端口详情
display counters interface GigabitEthernet x/x/x &nbsp;// 丢包、错包
display vlan &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // VLAN划分和端口归属
display eth-trunk &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 链路聚合信息

3、转发 & ARP 检查

display mac-address &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 学习到的MAC表
display arp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // IP-MAC绑定关系
display ip routing-table &nbsp; &nbsp; &nbsp; &nbsp;// 路由情况

4、日志 & 告警

display logbuffer &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 查看最近日志
display alarm all &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 当前告警
display trapbuffer &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Trap告警缓存

5、配置/用户/保存

display current-configuration | include xxx // 查配置(按需查)
display users &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 登录用户信息
save &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 保存配置

📝&nbsp;小技巧:

  • 经常出问题的交换机,建议设置定时任务自动跑一套巡检脚本,把结果重定向成文本发邮箱或存日志。
  • 高峰期巡检更重要,比如中午、晚上8点左右,能看到链路利用率或接口突发状态。


09 实战案例

背景:办公楼某层经常断网,用户说“时好时坏”,技术人员去查接口全是up的,客户一度怀疑是“鬼上身”。

排查过程:

  1. 检查接口状态

display interface brief

👉 所有接口正常,没发现down。

  1. 查详细接口流量 & 错误包

display interface GigabitEthernet 1/0/24

发现持续出现 CRC 错误 + input errors 飙升。

结论:这不是链路断,而是物理链路不稳定,可能是网线质量/水晶头接触问题。

  1. 查MAC学习情况

display mac-address | include 1/0/24

👉 多次掉线重学 MAC 地址,说明用户口频繁掉线。

最终结论:网线质量不过关,换线后问题解决。如果没有日常跑&nbsp;display counters&nbsp;去看错误包,很可能就忽略了这种「表面up,实则抖」的故障。

华为交换机排错,命令熟练=问题减少。

别觉得这些命令“简单”,真到现场你就知道,越基础的命令越救命。老网工从来不怕命令多,就怕关键时刻想不起来用哪条。


原创:老杨丨11年资深网络工程师,更多网工提升干货,请关注公众号:网络工程师俱乐部

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值