华为 VRP ↔ 思科 IOS 命令速查手册

左:华为

右:思科

常见 VRP / IOS 命令

01. 登录与命令行模式

操作 华为 Huawei 思科 Cisco
用户视图 <Huawei> Switch>
进入配置模式 system-view enable → configure terminal
进入接口视图 interface GE 0/0/1 interface Gi 0/1
进入 OSPF 视图 ospf 1 router ospf 1
退出当前层级 quit exit
直接返回顶层 return end
查看帮助 ? ?
命令补全 Tab Tab
查看历史命令 display history-command show history

02. 设备信息查看

想查看什么 华为 Huawei 思科 Cisco
设备版本 display version show version
当前配置 display current-configuration show running-config
启动配置 display saved-configuration show startup-config
接口状态/IP display ip interface brief show ip interface brief
接口详细信息 display interface show interfaces
VLAN 信息 display vlan show vlan brief
MAC 地址表 display mac-address show mac address-table
ARP 表 display arp show arp
路由表 display ip routing-table show ip route
CPU 使用率 display cpu-usage show processes cpu
内存使用率 display memory-usage show memory
系统时间 display clock show clock
日志信息 display logbuffer show logging
LLDP 邻居 display lldp neighbor brief show lldp neighbors

03. 接口配置

操作 华为 Huawei 思科 Cisco
进入接口 interface GE 0/0/1 interface Gi 0/1
配置 IP ip address 192.168.1.1 24 ip address 192.168.1.1 255.255.255.0
开启接口 undo shutdown no shutdown
关闭接口 shutdown shutdown
配置描述 description To-R2 description To-R2
查看接口 display interface show interfaces
清除接口计数器 reset counters interface GE 0/0/1 clear counters Gi 0/1

04. VLAN 与交换机配置

操作 华为 Huawei 思科 Cisco
创建 VLAN 10 vlan 10 vlan 10
删除 VLAN 10 undo vlan 10 no vlan 10
进入接口 interface GE 0/0/1 interface Gi 0/1
配置 Access port link-type access switchport mode access
指定 Access VLAN port default vlan 10 switchport access vlan 10
配置 Trunk port link-type trunk switchport mode trunk
允许 VLAN 10、20 port trunk allow-pass vlan 10 20 switchport trunk allowed vlan 10,20
查看 VLAN display vlan show vlan brief
查看 MAC 表 display mac-address show mac address-table
查看 STP display stp brief show spanning-tree

05. 三层交换与 VLANIF / SVI

操作 华为 Huawei 思科 Cisco
创建 VLAN 三层接口 interface Vlanif 10 interface vlan 10
配置网关 IP ip address 192.168.10.1 24 ip address 192.168.10.1 255.255.255.0
开启接口 undo shutdown no shutdown
查看接口状态 display ip interface brief show ip interface brief

06. 静态路由

操作 华为 Huawei 思科 Cisco
配置静态路由 ip route-static 192.168.2.0 24 192.168.1.2 ip route 192.168.2.0 255.255.255.0 192.168.1.2
配置默认路由 ip route-static 0.0.0.0 0 192.168.1.2 ip route 0.0.0.0 0.0.0.0 192.168.1.2
查看路由表 display ip routing-table show ip route
删除静态路由 undo ip route-static ... no ip route ...

07. OSPF 动态路由

操作 华为 Huawei 思科 Cisco
创建 OSPF 进程 ospf 1 router-id 1.1.1.1 router ospf 1
配置 Router ID router-id 1.1.1.1 router-id 1.1.1.1
进入 Area 0 area 0 在 OSPF 模式下配置
宣告网络 network 192.168.12.0 0.0.0.255 network 192.168.12.0 0.0.0.255 area 0
查看邻居 display ospf peer show ip ospf neighbor
查看 OSPF 信息 display ospf brief show ip ospf
查看 OSPF 路由 display ip routing-table protocol ospf show ip route ospf

08. 网络排错命令

排错目的 华为 Huawei 思科 Cisco
测试连通性 ping 192.168.1.1 ping 192.168.1.1
路由追踪 tracert 192.168.1.1 traceroute 192.168.1.1
查看 ARP display arp show arp
查看 MAC display mac-address show mac address-table
查看接口状态 display interface brief show interfaces status
查看 OSPF 邻居 display ospf peer show ip ospf neighbor
查看日志 display logbuffer show logging

09. 配置管理

操作 华为 Huawei 思科 Cisco
保存配置 save write memory
查看当前配置 display current-configuration show running-config
查看启动配置 display saved-configuration show startup-config
撤销配置 undo 命令 no 命令
修改设备名称 sysname SW1 hostname SW1
重启设备 reboot reload

10. 最容易记错的命令:重点记忆

华为 → 思科

华为 Huawei 思科 Cisco 功能说明
display show 查看设备信息、状态和配置
undo no 撤销或删除配置
system-view configure terminal 进入全局配置模式
quit exit 退出当前视图或配置模式
return end 直接返回最高级命令视图
save write memory 保存当前配置
undo shutdown no shutdown 开启接口
shutdown shutdown 关闭接口
sysname hostname 修改设备名称
ip route-static ip route 配置静态路由

记忆口诀:

  • 华为 display = 思科 show
  • 华为 undo = 思科 no
  • 华为 system-view = 思科 configure terminal
  • 华为 quit ≈ 思科 exit
  • 华为 return ≈ 思科 end

使用时的三个注意事项

  1. 思科接口编号不一定和华为一样。例如华为 GE0/0/1,思科可能是 Gi0/1、Gi1/0/1,取决于设备型号。
  2. 表格中的 24 是华为常见的前缀长度写法,思科通常要求完整子网掩码。
  3. show interfaces status 主要适用于支持该命令的 Cisco 交换机,不适用于所有路由器。

还有一个实用技巧:Cisco 在配置模式下可以使用 do show ... 执行查看命令,不必退出配置模式。

例如:

1
Switch(config)# do show ip interface brief

华为和思科的具体命令仍应以设备型号及软件版本为准。