Huawei Switch Configuration Command
Huawei Switch Configuration Command
Basic Configuration:
Huawei privileges note Privilege note: 0-VISIT, 1-
<switch1>super MONITOR, 2-SYSTEM, 3-MANAGE
Super command for manage
mode.
Changing switch hostname
<Huawei>system-view
[Huawei]sysname switch1
[switch1]quit
Log in with console
<Huawei>system-view
[Huawei]user-interface console 0
[Huawei-ui-console0]user privilege level 3
[Huawei-ui-console0] quit
Configuring passwords
[switch1]user-interface vty 0 4 To set number of users concurrently work with.
[switch1-ui-vty0-4]user privilege level 3 Default privilege level is 0. Set 3 for manage.
[switch1-ui-vty0-4]authentication-mode password Authentication mode aaa is recommended.
[switch1-ui-vty0-4]set authentication password aaa AAA authentication
none Login without checking
cipher password password Authentication through the
[switch1-ui-vty0-4]display this To check configuration.
Configuring passwords with username
[Huawei]user-interface vty 0 4
[Huawei-ui-vty0-4]authentication-mode aaa
[Huawei-ui-vty0-4]quit
[Huawei]aaa
[Huawei-aaa]local-user user1 password cipher
password1
Info: Add a new user.
[Huawei-aaa]local-user user1 service-type telnet
[Huawei-aaa]local-user user1 privilege level 3
[Huawei-aaa]display this
[Huawei-aaa]quit
Giving the switch an IP address
<Huawei>system-view
[Huawei]interface Vlanif 1
[Huawei-Vlanif1]ip address 10.1.1.1 30
[Huawei-Vlanif1]display this
[Huawei-Vlanif1]quit
<Huawei>display ip interface brief
Setting the default route
[Huawei]ip route-static 0.0.0.0 0 10.1.1.1
[Huawei]display ip routing-table
Saving configuration
<Huawei>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]Y
Info: Please input the file name ( *.cfg, *.zip )
[vrpcfg.zip]:
Aug 10 2018 22:53:09-08:00 Huawei
%%01CFM/4/SAVE(l)[0]:The user chose Y when dec
iding whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully
Configuring switch to use SSH
[Huawei]rsa local-key-pair create To generate rsa key
[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 user1 password cipher user1
[Huawei-aaa]local-user user1 privilege level 3 User1 is username
[Huawei-aaa]local-user user1 service-type ssh
[Huawei-aaa]quit
[Huawei]ssh authentication-type default password
There are three types VLAN in huawei Hybrid interface allows tagged
Access frames from multiple VLANs
Trunk Frames send out from a hybrid
Hybrid interface are tagged or untagged
according to the VLAN
Default VLAN on Huawei devices is Hybrid. configuration.
Hybrid interface has the ability
to selectively perform and
removal of VLAN tags from
frames that differ from PVID of
the port interface.
Assign an access interface to access a specific
VLAN:
[switch1]interface GigabitEthernet 0/0/2
[switch1-GigabitEthernet0/0/2]port link-type
access
[switch1-GigabitEthernet0/0/2]port default vlan
10
[switch1-GigabitEthernet0/0/2]quit
Configuring the trunk interface:
[switch1]interface GigabitEthernet 0/0/4
[switch1-GigabitEthernet0/0/4]port link-type To set the link type as trunk.
trunk
[switch1-GigabitEthernet0/0/4]port trunk allow- Allow specific VLANS to this
pass vlan 10 to 20 interface
[switch1-GigabitEthernet0/0/4]port trunk allow-
pass vlan all Allow all vlans
[switch1-GigabitEthernet0/0/4]port trunk pvid
vlan 10 Set default VLAN for trunk
[switch1-GigabitEthernet0/0/4]quit interface.
Configuring the hybrid interface:
[switch1]interface GigabitEthernet 0/0/5
[switch1-GigabitEthernet0/0/5]port link-type To set port type hybrid
hybrid
[switch1-GigabitEthernet0/0/5]port hybrid The hybrid interface is added to
untagged vlan 10 to 20 the VLAN in untagged mode
[switch1-GigabitEthernet0/0/5]port hybrid The hybrid interface is added to
tagged vlan 5 to 7 the VLAN in tagged mode
[switch1-GigabitEthernet0/0/5]port hybrid pvid The default VLAN is configured
vlan 10 for the hybrid interface.
[switch1-GigabitEthernet0/0/5]quit
Create multiple VLAN:
[switch1]vlan batch 11 to 20
[switch1]vlan batch 10 15 to 19 25 28 to 30
Link Type Negotiation protocol(LNP) Like Cisco DTP ( Optional)
Link-type Negotiation Protocol (LNP) dynamically negotiates the link type of an Ethernet Interface.The negotiated
link type can be access or trunk.
The Ethernet interface that is negotiated as an access interface joins VLAN 1 by default.
The Ethernet interface that us negotiated as a trunk interface joins VLAN1 to VLAN 4094 by default.
After LNP is enabled, LNP negotiation is triggered in the following situations.
The local device receives LNP packets from the remote device.
The local configuration or interface status changes.
In addition to access, hybrid, trunk, Dot1q tunnel. LNP provides following link types:
Negotiation-desireable: The local device actively sends LNP packets.
Negotiation-auto : The local device does not actively send LNP packets.
Configuration:
port link-type negotiation-auto Configure the link dynamic negotiation mode as auto.
port link-type negotiation-desirable Configure the link dynamic negotiation mode as
desirable
port trunk allow-pass only-vlan 1 to Remove an interface from a VLAN in negotiation
9 11 to 4094 mode. For example, remove an interface from VLAN
10.
port negotiation disable Disable auto-negotiation of an interface.
lnp disable Disable global LNP
portswitch If the interface is not layer2
display lnp summary To view auto negotiation to all interface
display lnp interface gig0/0/5 To view information to a specific interface
STP
[sw1]stp mode stp Set the STP mode. The mode is set to MSTP by default.
[sw1]stp mode rstp
[sw1]stp root primary Set the root bridge Once the command is run on the
device, the device’s bridge priority value is
automatically set to 0
[sw2]stp root secondary Set the secondary root bridge.
Optional: Setting a Priority for a A priority is set for the switching device.
Switching Device The default priority value of a switching device is
32768.
If the stp root primary or stp root secondary command
[sw1]stp priority 100 has been executed to configure the device as the root
bridge or secondary root bridge, run the undo stp root
command to disable the root bridge or secondary root
bridge function and then run the stp priority priority
command to set a priority.
Optional: Setting a Path Cost for a Port A path cost calculation method is specified.
By default, the IEEE 802.1t standard (dot1t) is used to
calculate the path costs.
[sw3]stp pathcost-standard dot1t All switching devices on a network must use the same
path cost calculation method.
[sw3-GigabitEthernet0/0/1]stp cost 100 A path cost is set for the interface.
When the Huawei calculation method is used, cost
ranges from 1 to 200000.
When the IEEE 802.1d standard method is used, cost
ranges from 1 to 65535.
When the IEEE 802.1t standard method is used, cost
ranges from 1 to 200000000.
Setting a priority for a port In spanning tree calculation, priorities of the ports in a
[sw1-GigabitEthernet0/0/1]stp port ring affect designated port election.
priority 16 To block a port on a switching device, set a greater
[sw1-GigabitEthernet0/0/1]quit priority value than the default priority value for the port.
In spanning tree calculation, priorities of the ports in a
ring affect designated port election.
To block a port on a switching device, set a greater
priority value than the default priority value for the port.
[sw1]display stp brief To checking STP configuration.
[sw1]display stp interface
GigabitEthernet 0/0/1
[sw1]stp enable Configurations on a switching device, such as the device priority and port priority, affect
spanning tree calculation. Any change to the configurations may cause network flapping. To
ensure rapid, stable spanning tree calculation, perform basic configuration on the switching
device and its ports before enabling STP/RSTP.
MSTP
MSTP implements load balancing among VLANs. Traffic in different VLANs is transmitted along different paths.
MSTP Implements fast convergence and provides multiple paths to load balance VLAN Traffic.
MSTP divides a switching network into multiple regions, each of which has multiple spanning trees that are
independent of each other.
An MST (Multiple spanning tree) region consists of several switching devices on the switching network
and the network segments between the switches.
Each spanning tree is called an MSTI(MST Instance). The VLANs in a region are allocated into different
groups. Each group has certain topology. Then MST instances are configured. MSTP maps one or multiple
VLANs to each MSTI.
MSTP Configuration
[sw1]stp mode mstp The working mode of the switching device is configured as
MSTP. By default, the working mode is MSTP.
MSTP region configuration. Configure to
all switches.
[sw1]stp region-configuration MST region view is displayed.
[sw1-mst-region]region-name RG1 Create MST region
[sw1-mst-region]instance 1 vlan 2 Configure VLAN-to-instance mappings.
to 10
[sw1-mst-region]instance 2 vlan 11
to 20
[sw1-mst-region]active region- MST configurations are activated.
configuration
[sw1-mst-region]quit
Configuring root bridge and secondary
root bridge.
[sw1]stp instance 1 root primary Set switch1 as primary root for instance 1
[sw1]stp instance 2 root secondary Set switch1 as secondary root for instance 2
[sw2]stp instance 2 root primary Set switch2 as primary root for instance 2
[sw2]stp instance 1 root secondary Set switch2 as secondary root for instance 1
(Optional) Setting a Path Cost of a The MSTP path cost determines root port
Port in an MSTI selection in an MSTI. The port with the lowest
path cost to the root bridge is selected as a root
[sw3]stp pathcost-standard legacy port.
[sw3-GigabitEthernet0/0/3]stp dot1d-1998 IEEE 802.1D-1998
instance 2 cost 2000 dot1t IEEE 802.1T
[sw3-GigabitEthernet0/0/3]quit legacy Legacy [Huawei standard]
BFD Command:
bfd session-name bind peer-ip ipaddress [vpn-instance vpn-name] interface interface-type
interface-number [source-ip ip-address ].
VRRP Command for backup
quit Quit command allows you to exit from the current view and
return to the upper level view.
return Return command or ctrl+z allows you to go to the user view.
Display current configuration Display the current configuration of the device.
[Huawei]display user- To check the user interface that a device supports
interface
By default, the next startup configuration file is named vrpcfg.zip
[Huawei]save backup.zip Save the configuration file for backup
Md. Al-Amin.
[email protected]