LAN networking | common commands of switches

Keywords: network switch


1, Experimental environment

2, Common commands

3, Noun interpretation

1. Switch

2. Switch configuration

3. Port aggregation

4. Port mirroring

5. Port binding


1, Experimental environment

         Switch: H3C S5000P series Ethernet switch

2, Common commands

1.Enter system view
<Quidway> system-view    #You can simply enter the system view by writing sys

2.Modify switch name
[Quidway] sysname Switch    #Change the name of the device to Switch

3.Enter Ethernet port view
[Quidway] interface GigabitEthernet0/1    #Reducible writing int g0/1

4.get into VLAN view
[Quidway] vlan 1    #Enter VLAN1 view

5.get into VLAN Interface view
[Quidway-vlan1] interface vlan-interface 1    #Enter VLAN1 interface view

6.Return to previous view
[Quidway-vlan1] quit

7.Return to user view
[Quidway-vlan1] return    #You can also use [Ctrl]+[Z]
8.Switch restart
[Quidway] restore default    #Erase configuration information in EEPROM
[Quidway] Reboot    #Restart the switch
9.port configuration
#Modify how the port works duplex {auto|full|half}
#Set the port speed {10|100|1000|auto}
[Switch1-GigabitEthernet0/1] duplex full    #Leave the port in full duplex
[Switch1-GigabitEthernet0/1] speed 100    #Set the port rate to 100Mb/s

[Switch1-GigabitEthernet0/1] undo duplex    #Cancel the port working mode configuration and return to the default state auto
[Switch1-GigabitEthernet0/1] undo speed    #Cancel the port rate configuration and return to the default state auto

10.Port aggregation
[Switch1] link g0/1 to g0/3    #Aggregate ports g0/1 to g0/3 into one aggregation group
[Switch1] display link    #View port aggregation information

11.Port Mirror 
Instance: will g0/1-g0/2 The message on the port is copied to the specified mirror port g0/3 
[Switch1] monitor-port g0/3    #Set mirror port
[Switch1] mirroring-port g0/1 to g0/2    #Set the mirrored port
[Switch1] display mir    #View port mirroring information

12.Port binding
 Instance: host MAC Address and VLAN 1 Port G0/1 Binding.    
Configuration steps:
<Quidway> system-view
[Quidway] mac-address mac-learning g0/1 disable    #Cancel port address learning function
[Quidway] mac-address static xxxx-xxxx-xxxx interface g0/1 vlan 1    #Configure static address table entries

13.see MAC Address table
 see MAC Address table
[Switch1] display mac-address
14.VLAN to configure
<Quidway> sys
[Quidway] vlan 2    #Enter VLAN 2 view
[Quidway-vlan2] management-vlan    #Configured to manage VLAN s.
#Note: VLAN1 cannot be configured to manage VLANs
[Quidway-vlan2] quit    #Exit VLAN view.
[Quidway] interface vlanif 2,Create and enter Vlanif Interface view.
[Quidway-Vlanif2] ip address 24    #Configure the IP address of Vlanif interface

15.Configure the port as Access Interface
[Quidway] int e0/1    #Enter e0/1 Port
[Quidway-Ethernet0/1] port link-type access
[Quidway-Ethernet0/1] port default vlan 10    #Configure PVID of access port
[Quidway-Ethernet0/1] ip address 24    #Configure the IP address of the port

16.Configure the port as Trunk Interface
[Quidway] int e0/1    #Enter e0/1 Port
[Quidway-Ethernet0/1] port link-type trunk
[Quidway-Ethernet0/1] port trunk allow-pass vlan 10 20    #Set trunk port e0/1 to allow VLAN 10 and VLAN 20 data frames to pass through
[Quidway-Ethernet0/1] ip address 24    #Configure the IP address of the port
display + ... View some information, such as:
[Quidway] display current-configuration
#Displays the configuration parameters currently in effect for the Ethernet switch.

[Quidway] display saved-configuration
#Displays the switch profile in EEPROM, that is, the profile used when the Ethernet switch is restarted.

... + ? View help, for example:
[Quidway] dis a?

3, Noun interpretation

1. Switch

        Switches are devices that work at the OSI reference model data link layer (layer 2). Its functions include: address learning, forwarding / filtering and loop elimination.

2. Switch configuration

        1) Configuration through Console port

        2) Configuration accessed via Telnet

3. Port aggregation

         Port aggregation refers to the aggregation of multiple ports to share the access load among member ports.

         An aggregation group can be regarded as a port with larger bandwidth. Port aggregation not only realizes load sharing, but also increases link bandwidth without forming a loop. When a port in the aggregation group fails, data can be forwarded from other ports in the aggregation group.

         The converged port meets the following three conditions:

         1) It must work in full duplex mode

         2) Must operate at the same rate

         3) The VLAN port type of the port must be consistent.

         Ports participating in port aggregation can only be continuous.

4. Port mirroring

         The port based mirroring function can copy the messages of one or more specified ports to the mirroring port for message analysis and monitoring.

5. Port binding

         Port binding refers to the function of binding MAC address to port. Through configuration, users can only allow some authorized devices to access the network through this port, while non authorized devices cannot access the network through this port.

         Basic principle of port binding function:

         1) Cancel the MAC address learning function of the port.

         2) Add the MAC address of the authorized device to the MAC address table of the switch in a static manner


        VLAN, virtual local area network, is a communication technology that logically divides a physical LAN into multiple broadcast domains.

        VLAN functions:

         1) Limit broadcast domain: the broadcast range is limited to one VLAN

         2) Enhance LAN Security: users in one VLAN cannot communicate directly with users in other VLANs

         3) The robustness of the network is improved: the fault is limited to one VLAN, and the fault in this VLAN will not affect the normal operation of other VLANs

        4) Flexibility to build virtual workgroups

         In a VLAN switching network, Ethernet frames mainly exist in two forms: Tagged frames and MAC data frames with 4-byte VLAN tags; Untagged frame, MAC data frame without 4-byte VLAN tag.

         All data frames processed inside the switch are provided with VLAN tags, while some devices connected to the switch in the current network only send and receive Untagged frames; At the same time, for cross switch communication, since there may be multiple VLANs, the port connecting the two switches needs to do some processing on the VLAN tag of the data frame.

         According to the interface connection object and the processing of transmitted and received data frames. Huawei defines four link types of interfaces: Access, Trunk, Hybrid and QinQ.

         The Access interface is generally used to connect with user terminals (such as user hosts, servers, etc.) that cannot recognize tags, or when it is not necessary to distinguish different VLAN members.

        Trunk interface is generally used to connect switches, routers and other devices that can send and receive Tagged frames and Untagged frames at the same time.

Posted by Alexhoward on Mon, 29 Nov 2021 05:31:59 -0800