HUAWEI Commands
HUAWEI Commands
1|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Flash
<Huawei> pwd Display the current working
directory.
<Huawei> dir Command displays information
about files and directories in the
storage medium.
<HUAWEI> dir /all Display information about all files
and directories in the current
directory.
dir /all-filesystems Display information about files and
directories in the root directories
of all the storage media on the
devices in a stack.
<Huawei> dir vrpcfg.cfg Display information about the file
vrpcfg.cfg in the current directory.
<Huawei> more command to display the file
content directly on a device.
<Huawei> mkdir [File name] command to create a subdirectory
in a specified directory, and the
subdirectory name must be unique.
<Huawei> rmdir [File name] command deletes a specified
directory from the remote SFTP
server.
<Huawei> copy flash:/config.cfg flash:/temp/temp.cfg command copies a file
<Huawei> move flash:/test/sample.txt flash:/sample.txt command moves the source file
from a specified directory to a
destination directory.
<Huawei> rename sample.txt sample.bak command renames a file or folder.
<Huawei> delete test.txt command delete file
Delete flash:/test.txt?[Y/N]:y
Info: Deleting file flash:/test.txt...succeeded.
<Huawei> undelete sample.bak Restore file sample.bak from the
Undelete flash:/sample.bak ?(y/n)[n]:y recycle bin.
Undeleted file flash:/sample.bak.
<Huawei> undelete flash: Restore a file that has been moved
Undelete flash:/test.txt?(y/n)[n]:y from the root directory to the
Undeleted file flash:/test.txt. recycle bin.
2|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Undelete flash:/rr.bak?(y/n)[n]:y
Undeleted file flash:/rr.bak.
<Huawei> reset recycle-bin flash:/test/test.txt command permanently deletes
Squeeze flash:/test/test.txt?(y/n)[n]:y files from the recycle bin.
Clear file from flash will take a long time if
needed...Done.
%Cleared file flash:/test/test.txt.
Common display Commands
display this Verify configurations in the current view
display interface brief command displays brief information about the
status and configuration of interfaces.
display diagnostic-information Basic information
display device Device information
display interface Interface information
display startup Startup file information
display version Versions
display patch-information Patch information
display device elabel Electronic label information
display health Device status
display configuration recover-result Configuration recovery information
display current-configuration Current configurations
display saved-configuration Saved configurations
display clock Time
display ntp status NTP clock information
display logbuffer User logs
display memory Memory usage
display cpu CPU usage
display switchover state Active/standby switchover status
display alarm active Device alarms
display device alarm hardware Hardware alarms
display device temperature all Temperature information
display device fan Fan information
display device power Power supply information
Console Local Password
[Huawei] user-interface console 0
[Huawei -ui-console0] user privilege level 15
[Huawei -ui-console0] authentication-mode Password
[Huawei -ui-console0] set authentication Password Huawei@123
[Huawei -ui-console0] quit
Console local Authentication
[Huawei] user-interface console 0
[Huawei -ui-console0] authentication-mode aaa
[Huawei -ui-console0] quit
3|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
[Huawei] aaa
[Huawei-aaa] local-user admin password irreversible-cipher Huawei@123
[Huawei-aaa] local-user admin privilege-level 15
[Huawei-aaa] local-user admin service-type Terminal
HTTP
<Huawei> system-view
[Huawei] http server enable
[Huawei] http server-source -i vlanif [Management Vlanif]
[Huawei] aaa
[Huawei-aaa] local-user admin password irreversible-cipher Huawei@123
[Huawei-aaa] local-user admin privilege-level 15
[Huawei-aaa] local-user admin service-type http
STelnet (SSH)
[Huawei] stelnet server enable
[Huawei] ssh server-source -i vlanif [Management Vlanif]
[Huawei] user-interface vty 0 4
[Huawei-ui-vty0-4] authentication-mode aaa
[Huawei-ui-vty0-4] protocol inbound ssh
[Huawei-ui-vty0-4] quit
[Huawei] aaa
[Huawei-aaa] local-user admin password irreversible-cipher Huawei@123
[Huawei-aaa] local-user admin privilege level 15
Warning: This operation may affect online users, are you sure to change the user privilege level
?[Y/N]y
[Huawei-aaa] local-user admin service-type ssh
[Huawei-aaa] quit
Telnet
[Huawei] telnet server enable
[Huawei] telnet server-source -i vlanif [Management Vlanif]
[Huawei] user-interface vty 0 4
[Huawei-ui-vty0-4] authentication-mode aaa
[Huawei-ui-vty0-4] protocol inbound telnet
[Huawei-ui-vty0-4] quit
[Huawei] aaa
[Huawei-aaa] local-user admin password irreversible-cipher Huawei@123
[Huawei-aaa] local-user admin privilege level 15
4|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Warning: This operation may affect online users, are you sure to change the user privilege level
?[Y/N]y
[Huawei-aaa] local-user admin service-type telnet
[Huawei-aaa] quit
FTP
[Huawei] ftp server enable
[Huawei] aaa
[Huawei-aaa] local-user admin password
irreversible-cipher Huawei@123
[Huawei-aaa] local-user admin privilege level 15
[Huawei-aaa] local-user admin service-type ftp
[Huawei-aaa] local-user admin ftp-directory flash:/
[Huawei-aaa] quit
[Huawei] quit
<Huawei> save
FTP
<Huawei> ftp 192.168.161.141 Login the FTP Server, then enter the
Trying ftp 192.168.161.141 username
Press CTRL+K to abort and the password on the FTP Server
Connected to ftp 192.168.161.141
220 FTP service ready.
User (192.168.161.141:(none)):huawei
331 Password required for huawei
Password: 8031
[ftp] get S9300.cc Get the new system software from the
FTP Server
[ftp] put S9300.cc Put the new system software to the FTP
client
5|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
display local-user expire-time Verify the time when the local account expires.
display local-aaa-user password policy {access- Display the password policy for local users.
user | administrator}
POE
[Huawei] interface Ethernet0/0/1 Used to create shortcuts for long
[Huawei-Ethernet0/0/1] poe enable commands. Enable the POE function on
the interface, by default, the POE
function is auto-enable on the interface
6|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
7|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
8|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
display ntp-service trace check the path from the local device to the
reference clock source.
VCMP
Switch A (Server):
[HUAWEI] vcmp role server
[HUAWEI] vcmp device-id 10
[HUAWEI] vcmp domain HUAWEI
[HUAWEI] vcmp authentication sha2-256 password Huawei@123
Switch B (Client):
[HUAWEI] vcmp role Client
[HUAWEI] vcmp domain HUAWEI
[HUAWEI] vcmp authentication sha2-256 password Huawei@123
Verifying VCMP Configuration
display vcmp status Check the VCMP configuration, including the
VCMP domain name, VCMP role, device ID,
configuration revision number, and VCMP
domain authentication password.
display vcmp interface brief Check the VCMP status on Layer 2 Ethernet
interfaces.
Default route
[HUAWEI] ip route-static 0.0.0.0 0.0.0.0 10.0.2.1
VLAN Configuration
<Huawei> system-view Create single VLAN
[Huawei] vlan 90
<Huawei> system-view Set of VLANS
[Huawei] vlan batch 1 to 30
<Huawei> system-view Separate set of VLANS
[Huawei] vlan batch 20 30 32 90
VLAN Description
[Huawei] vlan 1
[Huawei-vlanif1] description Management Vlan
Port Types
Access port
[Huawei-GigabitEthernet0/0/35] port link-type access
[Huawei-GigabitEthernet0/0/35] port default vlan 5
Trunk Port
[Huawei-GigabitEthernet0/0/30] port link-type trunk
[Huawei-GigabitEthernet0/0/30] port trunk allow-pass vlan 1 2 5
9|Page
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Hybrid Port
<Huawei> system-view
[Huawei] interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/11] port link-type hybrid
[Huawei-GigabitEthernet0/0/11] port hybrid untagged vlan 2
[Huawei-GigabitEthernet0/0/11] port hybrid tagged vlan 30
[Huawei-GigabitEthernet0/0/11] port hybrid pvid vlan 2
Delete interface port type
[Huawei] interface G0/0/35
[Huawei-GigabitEthernet0/0/35] undo port link-type
VLAN Configuration Based on Port
[Huawei] vlan 2 Vlan can be Created singly or batch
[Huawei] vlan bacth 2 to 10
[Huawei] vlan 2
[Huawei-vlan2] port GigabitEthernet1/0/1 to Configure the VLAN on the access port
GigabitEthernet1/0/2
or
[Huawei] interface GigabitEthernet1/0/1
[Huawei-GigabitEthernet1/0/1] port link-type access
[Huawei-GigabitEthernet1/0/1] port default vlan 2
Interface VLAN
[Huawei] interface vlanif 2
[Huawei-vlanif2] ip add 192.168.1.1 255.255.255.0
Also you can write prefix instant of subnet mask 192.168.1.1 24
[Huawei-vlanif2] ip add 192.168.1.1 24
Verifying interface VLAN Configuration
display interface vlanif [ vlan-id ] command to check the VLANIF
interface configuration.
10 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Display ip interface brief command displays brief information
about interface IP addresses, including
the IP address, subnet mask, physical
status, link-layer protocol status, and
number of interfaces in different states.
DHCP Server Based on the Global Address Pool
<Huawei> system-view
[Huawei] dhcp enable
Create address pools and set
[Huawei] ip pool 1
the attributes of the address
[Huawei-ip-pool-1] network 10.1.1.0 mask 255.255.255.128
pools
[Huawei-ip-pool-1] dns-list 10.1.1.2
[Huawei-ip-pool-1] gateway-list 10.1.1.1
[Huawei-ip-pool-1] excluded-ip-address 10.1.1.2
[Huawei-ip-pool-1] excluded-ip-address 10.1.1.4
[Huawei-ip-pool-1] lease day 10
[Huawei-ip-pool-1] quit
11 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
display dhcp relay { all | interface interface-type interface-number } command to view
information about the
DHCP server or DHCP
server group on the
interface functioning
as a DHCP relay agent.
display dhcp server group [ group-name ] command to view the
configuration of the
DHCP server group.
Port isolation
<Huawei> system-view Port isolation includes
[Huawei] port-isolate mode all unidirectional isolation
[Huawei] interface gigabitethernet 1/0/1 and bidirectional
[Huawei-GigabitEthernet1/0/1] port-isolate enable group 3 isolation. Layer 2
isolation and Layer 3
interworking is used
by default. To
configure Layer 2 and
Layer 3 isolation, run
the port-isolate mode
all command.
Verifying Port isolation
display port-isolate group { group-id | all } command to check the
configuration of the
port isolation group.
Stacking
Master Switch
Standby Switch
12 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Slave Switch
13 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
Standby Switch
<HUAWEI> system-view
[HUAWEI] sysname SwitchB
[SwitchB] set css mode lpu
[SwitchB] set css id 2
[SwitchB] set css priority 10
[SwitchB] interface css-port 1
[SwitchB-css-port1] port interface xgigabitethernet 1/0/1 to xgigabitethernet 1/0/2 enable
[SwitchB-css-port1] quit
[SwitchB] interface css-port 2
[SwitchB-css-port2] port interface xgigabitethernet 2/0/1 to xgigabitethernet 2/0/2 enable
[SwitchB-css-port2] quit
[SwitchB] css enable
Warning: The CSS configuration will take effect only after the system is rebooted. T
he next CSS mode is LPU. Reboot now? [Y/N]:y
Verifying CSS
display current-configuration | include css command to view the CSS physical port-Down
delay function configuration.
14 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
[Huawei] voice-vlan mac-address mac-address mask oui- Set the OUI of the voice VLAN
mask
[description text]
All switches:
<Huawei> system-view Configure the spanning tree mode
[Huawei] stp mode stp as STP and enable stp on the
[Huawei] stp enable system view
Switch A (root):
Configure Switch A as the root of
[Huawei] stp root primary
the ring
or
[Huawei] stp priority 0
15 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
All switches:
Configure the spanning tree mode
<Huawei> system-view as RSTP and
[Huawei] stp mode rstp enable stp on the system view
[Huawei] stp enable
16 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
All switches:
17 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
18 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
ACL
Basic ACL
<HUAWEI> system-view Configuring a packet filtering
[HUAWEI] acl 2001 rule based on the source IP
[HUAWEI-acl-basic-2001] rule permit source 192.168.1.3 0 address (host address).
To allow the packets from a
host to pass, add a rule to an
ACL. For example, to allow
packets from host 192.168.1.3
to pass, create the following
rule in ACL 2001.
<HUAWEI> system-view Configuring a packet filtering
[HUAWEI] acl 2001 rule based on the source IP
[HUAWEI-acl-basic-2001] rule permit source 192.168.1.3 0 address segment
[HUAWEI-acl-basic-2001] rule deny source 192.168.1.0 To allow the packets from a
0.0.0.255 host to pass and reject the
[HUAWEI-acl-basic-2001] description permit only 192.168.1.3 packets from other hosts on the
through same network segment,
configure rules in an ACL. For
example, to allow the packets
from host 192.168.1.3 to pass
and reject the packets from
other hosts on network
segment 192.168.1.0/24,
configure the following rules in
ACL 2001 and set the
description of ACL 2001 to
Permit only 192.168.1.3
through.
Advanced ACL
<HUAWEI> system-view Configuring a packet filtering rule for
[HUAWEI] acl 3001 ICMP protocol packets based on the
[HUAWEI-acl-adv-3001] rule permit icmp source source IP address (host address) and
192.168.1.3 0 destination 192.168.2.0 0.0.0.255 destination IP address segment
19 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
20 | P a g e
Fawzy Abdelbaset | LinkedIn
HUAWEI Commands BY: Fawzy Abdelbaset
21 | P a g e
Fawzy Abdelbaset | LinkedIn