Huawei H3C Cisco Command Equivalents: VRP and Comware CLI - 夜莺博客

Huawei H3C Cisco Command Equivalents: VRP and Comware CLI

Network engineers who learned Cisco IOS and then sit down in front of a Huawei VRP or H3C Comware switch usually find the CLI oddly familiar — Comware was historically derived from the same command family as VRP, and both vendors borrowed the IOS concept of hierarchical modes. The differences are systematic rather than random: enable becomes system-view, show becomes display, no becomes undo and write memory becomes save. This article gives the practical mapping table that makes the transition painless.

The mapping below goes deeper than a one-page cheat sheet. It covers the mode model, the core show/display translation, VLAN and trunk syntax, routing protocols, link aggregation, user management and file handling, and it flags the handful of places where a command that looks identical on two platforms actually behaves differently. Everything here is written from the operator's point of view: which string do you type on which box, and what silently breaks if you copy it across.

Why the Three CLIs Feel So Similar

Cisco IOS established the idea that a network operating system should be a hierarchy of contexts - EXEC, global configuration, interface configuration - with a no keyword that undoes whatever a command did. VRP and Comware inherit that grammar almost wholesale, which is why interface GigabitEthernet0/0/1 and quit are character-for-character the same on all three. What the Chinese vendors changed was the vocabulary at the edges: they renamed the privileged state, they replaced no with undo, they made save a first-class command instead of a legacy alias, and they reorganised some views so that the shape of a configuration file reads differently even when the effect is identical.

Command Mode Equivalents

  • Cisco enable / privileged EXEC → Huawei/H3C user view (<HUAWEI>).
  • Cisco configure terminal → Huawei/H3C system view (system-view), prompt [HUAWEI].
  • Cisco interface GigabitEthernet0/0/1 → interface GigabitEthernet0/0/1 (identical syntax).
  • Cisco exit/end → quit / return.
  • Cisco ? help and tab completion → identical.
  • Cisco disable (back to user EXEC) → no equivalent; VRP/Comware has no unprivileged-to-privileged transition to undo.
  • Cisco do show ... from config mode → VRP/Comware allow display commands from any view without a do keyword.
  • Disabling paging: IOS terminal length 0 → VRP screen-length 0 temporary, Comware screen-length disable.

That last point matters more than it looks. On IOS a single terminal length 0 suppresses paging for the session; on VRP the equivalent is screen-length 0 temporary, and on Comware screen-length disable. Scripting a long display current-configuration over SSH without disabling paging first is one of the most common causes of a truncated capture in multi-vendor automation.

The Core Command Mapping

Task Cisco IOS Huawei VRP / H3C Comware
Hostname hostname SW1 sysname SW1
Save config write memory save
Show running config show running-config display current-configuration
Show startup config show startup-config display saved-configuration
Show version show version display version
Interface summary show ip interface brief display ip interface brief
Routing table show ip route display ip routing-table
VLAN list show vlan display vlan
Log buffer show logging display logbuffer
MAC table show mac address-table display mac-address
ARP table show arp display arp
LLDP neighbours show lldp neighbors display lldp neighbor brief
Spanning tree show spanning-tree display stp brief
OSPF neighbours show ip ospf neighbor display ospf peer brief
BGP summary show ip bgp summary display bgp peer
Clear counters clear counters reset counters interface
Negate a command no <command> undo <command>
Erase startup config erase startup-config reset saved-configuration
Reload reload reboot
Ping / traceroute ping / traceroute ping / tracert

The pattern to memorise is that show becomes display, no becomes undo, and anything the IOS CLI would express as a hyphenated compound (running-config, routing-table, interface brief) tends to be flattened or reordered in VRP/Comware. Once you internalise "display + noun", you can guess the right command on an unfamiliar platform far more often than you can guess with the other two vendors' oddities.

VLAN and Interface Configuration Side by Side

Access port configuration on all three platforms follows the same shape, differing only in the keywords:

! Cisco IOS
SW1(config)# vlan 10
SW1(config-vlan)# name servers
SW1(config)# interface GigabitEthernet1/0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10

! Huawei VRP
[HUAWEI] vlan 10
[HUAWEI-vlan10] name servers
[HUAWEI] interface GigabitEthernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] port link-type access
[HUAWEI-GigabitEthernet0/0/1] port default vlan 10

! H3C Comware
[H3C] vlan 10
[H3C-vlan10] name servers
[H3C] interface GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1] port link-type access
[H3C-GigabitEthernet1/0/1] port access vlan 10

The key trap: Huawei uses port default vlan while H3C uses port access vlan for the same access-port concept, and trunk allowed lists differ as port trunk allow-pass vlan (both) with Huawei's port trunk pvid vlan versus H3C's native VLAN handling. Our H3C vs Huawei command comparison covers these differences in full, and the VRP side-by-side reference adds the detail IOS migrants need.

Two more syntax notes that save real time. First, VLAN creation differs in spelling across the two Chinese platforms: VRP accepts vlan batch 10 20 30 to create several VLANs at once, while Comware creates them individually with vlan 10 or as a range with vlan 10 to 30 — so the VLAN creation lines of a Huawei runbook have to be rewritten before they will run on an H3C box. Second, the Layer-3 VLAN interface is interface Vlanif 20 on VRP and interface Vlan-interface 20 on Comware, and OSPF/BGP neighbours expect that naming to match whatever the local convention is.

Access, Trunk and Hybrid: Where Copies Break

Trunk configuration is where a copied snippet does the most damage, because it usually parses cleanly on both platforms. On Huawei the allowed-VLAN verb is allow-pass; on H3C it is permit. Assigning the wrong one does not throw an error on the platform it does not belong to - the port simply keeps its previous VLAN list, and traffic silently fails to cross the uplink.

! Huawei VRP trunk
[HUAWEI-GigabitEthernet0/0/1] port link-type trunk
[HUAWEI-GigabitEthernet0/0/1] port trunk pvid vlan 10
[HUAWEI-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20 30

! H3C Comware trunk
[H3C-GigabitEthernet1/0/1] port link-type trunk
[H3C-GigabitEthernet1/0/1] port trunk pvid vlan 10
[H3C-GigabitEthernet1/0/1] port trunk permit vlan 10 20 30

Both platforms also support a third mode that IOS does not have: port link-type hybrid, where a single port can carry some VLANs tagged and others untagged. On a hybrid port you write port hybrid vlan 10 untagged or port hybrid vlan 20 tagged alongside port hybrid pvid vlan 10. This is the mode that lets a Huawei or H3C switch terminate a VLAN on an access device while still tunnelling it to an uplink, and it is the reason configurations from these platforms often cannot be expressed exactly in IOS terms.

Routing Protocol Command Equivalents

OSPF is the pleasant surprise: the VRP and Comware syntax is almost identical to each other and quite readable next to IOS. The one structural difference is the same as on NX-OS and IOS - VRP/Comware use network statements under the area, not per-interface activation.

! Cisco IOS
router ospf 1
 router-id 1.1.1.1
 network 10.0.0.0 0.0.0.255 area 0

! Huawei VRP / H3C Comware (identical)
[HUAWEI] ospf 1 router-id 1.1.1.1
[HUAWEI-ospf-1] area 0
[HUAWEI-ospf-1-area-0.0.0.0] network 10.0.0.0 0.0.0.255
[HUAWEI-ospf-1-area-0.0.0.0] quit
[HUAWEI-ospf-1] quit

Static routing and BGP are similarly close, with a family-view twist on BGP: VRP uses ipv4-family unicast and Comware uses address-family ipv4 unicast, and in both cases a peer must be explicitly enabled inside that view before it exchanges prefixes.

! Cisco IOS
router bgp 100
 neighbor 10.0.0.2 remote-as 200

! Huawei VRP
[HUAWEI] bgp 100
[HUAWEI-bgp] peer 10.0.0.2 as-number 200
[HUAWEI-bgp] ipv4-family unicast
[HUAWEI-bgp-af-ipv4] peer 10.0.0.2 enable

! H3C Comware
[H3C] bgp 100
[H3C-bgp] peer 10.0.0.2 as-number 200
[H3C-bgp] address-family ipv4 unicast
[H3C-bgp-ipv4] peer 10.0.0.2 enable

Static routes use ip route-static <dest> <mask> <next-hop> on both platforms - the keyword order is the reverse of the IOS habit, which is worth writing down until ip route-static 0.0.0.0 0 192.168.1.1 becomes muscle memory.

Link Aggregation and Spanning Tree

Neither platform uses the Cisco term "port-channel", and the verbs diverge completely even though the concept is the same:

! Cisco IOS
interface Port-channel1
 description uplink
interface range GigabitEthernet1/0/1 - 2
 channel-group 1 mode active

! Huawei VRP (LACP)
[HUAWEI] interface Eth-Trunk 1
[HUAWEI-Eth-Trunk1] mode lacp-static
[HUAWEI] interface GigabitEthernet0/0/1
[HUAWEI-GigabitEthernet0/0/1] eth-trunk 1

! H3C Comware (dynamic LACP)
[H3C] interface Bridge-Aggregation 1
[H3C-Bridge-Aggregation1] link-aggregation mode dynamic
[H3C] interface GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1] port link-aggregation group 1

Spanning tree follows the same shape: both platforms use stp mode rstp or stp mode mstp to select the protocol, Comware 7 adds an explicit stp global enable, and root election uses stp root primary rather than the IOS habit of spanning-tree vlan 10 root primary under a per-VLAN context.

User Management, Privilege Levels and SSH

This is the area where the difference is conceptual, not just lexical. IOS attaches a privilege level to a username and then binds the VTY lines to local authentication. VRP and Comware both build users in an AAA (Huawei) or local-user (H3C) block and then grant a role or service type.

! Cisco IOS
username admin privilege 15 secret Str0ngP@ss
line vty 0 4
 login local
 transport input ssh

! Huawei VRP
[HUAWEI] aaa
[HUAWEI-aaa] local-user admin password irreversible-cipher Str0ngP@ss
[HUAWEI-aaa] local-user admin privilege level 15
[HUAWEI-aaa] local-user admin service-type ssh
[HUAWEI] user-interface vty 0 4
[HUAWEI-ui-vty0-4] authentication-mode aaa
[HUAWEI-ui-vty0-4] protocol inbound ssh

! H3C Comware
[H3C] local-user admin
[H3C-luser-manage-admin] password irreversible-cipher Str0ngP@ss
[H3C-luser-manage-admin] service-type ssh
[H3C-luser-manage-admin] authorization-attribute user-role network-admin
[H3C] line vty 0 63
[H3C-line-vty0-63] authentication-mode scheme
[H3C-line-vty0-63] protocol inbound ssh

Note that both platforms require you to enable the service itself - stelnet server enable on VRP and ssh server enable on Comware - before any of the user configuration takes effect. Forgetting that line is the single most common reason a freshly configured switch refuses an SSH session while happily answering on Telnet.

File and Configuration Management

  • Save: save on VRP (confirms with Y), save force on Comware to skip the filename prompt.
  • Back up to a server: copy running-config tftp on IOS; tftp 192.0.2.10 put vrpcfg.zip startup.cfg style transfers on VRP, and tftp 192.0.2.10 put flash:/startup.cfg on Comware.
  • List files: dir works on all three, but the boot file is vrpcfg.zip (VRP) or startup.cfg (Comware) rather than startup-config.
  • Wipe the startup configuration: reset saved-configuration followed by reboot on both platforms.

Because VRP and Comware store configuration as files in flash, restoring a device is a file operation rather than the IOS ritual of pasting a backup into the console. That makes rollback faster, and it also makes it easy to leave an old vrpcfg.zip on the flash of a switch that was "fixed" months ago.

Diagnostics: Ping, Tracert and Logging

! Both Huawei VRP and H3C Comware
ping -c 5 192.0.2.1
tracert 192.0.2.1
display ip interface brief
display arp
display logbuffer
display interface GigabitEthernet0/0/1 | include CRC

The | filter pipe, the include/exclude keywords and the <cr> screen control all carry over from IOS, and VRP/Comware even add useful extras such as display current-configuration | include vlan for a substring search of the running configuration. Where IOS prints a single table, the Chinese platforms tend to offer a brief variant that is worth learning early: display ospf peer brief, display lldp neighbor brief and display stp brief are the fastest route to the one-line-per-object view you actually want when something is down.

A Five-Minute IOS-to-VRP/Comware Migration Checklist

  1. Translate the mode model: enable+configure terminal becomes system-view; end becomes return.
  2. Replace every no with undo and every show with display.
  3. Rewrite interface names to match the platform's slot convention (0/0/N on many Huawei models, 1/0/N on H3C fixed switches).
  4. Fix the four VLAN verbs: port default vlan vs port access vlan, and allow-pass vs permit.
  5. Rename the Layer-3 VLAN interface: Vlanif vs Vlan-interface.
  6. Move username definitions into the AAA or local-user model, and enable SSH as a service.
  7. Remember save instead of write memory, and check display saved-configuration afterwards.

Related Reading on This Site

The multi-vendor CLI cheat sheet for Cisco, Juniper and Huawei extends this mapping to a fourth vendor. If your estate also includes Cisco IOS XR, the IOS XR command modes guide covers its commit-based model.

原文链接:https://blog.router-switch.com/2023/06/master-the-basic-command-configurations-of-huawei-h3c-ruijie-and-cisco-switches-with-router-switch-com/