阿国运维网技术分享平台:桌面运维、网络运维、系统运维、服务器运维(及云服务器),精品软件分享、阿国网络、尽在北京运维网
本文精选华为交换机运维中最高频、最关键的30条命令,涵盖安全加固、故障排查、性能优化等场景,每条命令都经过金融/政务/互联网行业实战验证。
一、基础配置篇(新手必会)
1. 进入系统视图
system-view
(所有配置的起点,相当于进入"上帝模式")
2. 修改设备名称
sysname SW-Core-01
规范命名是网络可维护性的第一步
3. 查看端口状态
display interface brief
快速定位异常端口(重点关注Status和Input/Output流量)
4. 配置管理IP
interface Vlanif 1
ip address 192.168.1.254 24远程管理的基础,建议使用非Vlan 1
5. 保存配置
save
切记:未保存的配置重启后会丢失!
二、安全加固篇(防黑必备)
6. 开启SSH服务
stelnet server enable
ssh user admin authentication-type password禁用Telnet的黄金法则
7. 配置ACL禁止非法访问
acl 3000
rule 5 deny tcp source 10.0.0.0 0.255.255.255 destination-port eq 23阻断来自10网段的Telnet请求
8. 设置登录超时
user-interface vty 0 4
idle-timeout 5 05分钟无操作自动断开连接
9. 开启端口安全
port-security enable
port-security max-mac-num 2防止MAC地址泛洪攻击
10. 禁用未使用端口
interface GigabitEthernet 0/0/24
shutdown安全基线要求:空闲端口必须关闭
三、VLAN与链路篇(核心技能)
11. 创建VLAN
vlan 10
description Finance-Dept建议为每个VLAN添加描述信息
12. 配置Trunk端口
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20允许VLAN 10和20通过
13. 设置链路聚合
interface Eth-Trunk 1
mode lacp-static
interface GigabitEthernet 0/0/1
eth-trunk 1提升带宽与可靠性的标准方案
14. 配置端口镜像
observe-port 1 interface GigabitEthernet 0/0/10
interface GigabitEthernet 0/0/5
port-mirroring to observe-port 1 inbound抓包分析的必备设置
15. 开启生成树协议
stp mode rstp
stp root primary防止环路导致全网瘫痪
四、故障排查篇(救急专用)
16. 查看ARP表
display arp
定位IP-MAC绑定问题
17. 追踪路由路径
tracert 8.8.8.8
诊断网络连通性问题
18. 查看MAC地址表
display mac-address
定位终端接入位置
19. 抓取端口流量统计
display interface GigabitEthernet 0/0/1 counters
发现异常流量峰值
20. 查看日志信息
display logbuffer
最近50条日志快速排查
五、高级优化篇(高手进阶)
21. 配置QoS限速
traffic classifier VOICE
if-match dscp ef
traffic behavior VOICE
queue ef bandwidth 30%保障语音流量优先级
22. 设置DHCP Snooping
dhcp snooping enable
interface GigabitEthernet 0/0/5
dhcp snooping trusted防止私接DHCP服务器
23. 配置VRRP虚拟路由
interface Vlanif 10
vrrp vrid 1 virtual-ip 192.168.10.1
vrrp vrid 1 priority 120构建双机热备方案
24. 开启端口隔离
port-isolate mode all
interface GigabitEthernet 0/0/2
port-isolate enable酒店/医院场景防互访
25. 配置BFD检测
bfd
interface GigabitEthernet 0/0/1
bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 3毫秒级链路故障检测
六、运维管理篇(效率倍增)
26. 批量配置端口
port-group batch 0/0/1 to 0/0/10
同时配置多个端口的黑科技
27. 查看CPU利用率
display cpu-usage
性能瓶颈快速定位
28. 恢复出厂设置
reset saved-configuration
reboot慎用!需提前备份配置
29. 配置NTP时间同步
ntp-service unicast-server 210.72.145.44
使用国家授时中心IP地址
30. 导出配置文件
display current-configuration > flash:/backup.cfg
定期备份的黄金命令





