h3c switch beginner commands

h3c switch beginner commands

H3C from the campus to the data center, box to box, from FE, GE to 10G and 100G, from L2 to L4/7, from IPv4 to IPv6, from the access to the core, the user has the most abundant choices and flexible combinations, in order to provide the industry's most comprehensive coverage of switch products. So what are the primary commands for h3c switches? Follow me below to find out!

Lab Environment

Switch

h3c S3600-28TP-SI

h3c S5024E

Reference Documents

H3C_S3600_v1510 Manual

H3C_S5000E Manual

Principle(Important)

Why Vlan?

Traditional Ethernet is a broadcast network, where all hosts in the network are connected through HUBs or switches and are in the same broadcast domain.

HUB is a physical layer device without switching function, the incoming packets will be forwarded to all ports;

Switch is a link layer device with the ability to forward packets according to the destination MAC address, but when receiving a broadcast packet or an unknown unicast packet

(the destination MAC address of the packet is not in the MAC address table of the switch), the packets will be forwarded to all ports except the incoming port.

In order to solve the problem that Ethernet switches cannot restrict broadcasting in the LAN, VLAN (Virtual LocalArea Network) technology emerged.

A VLAN divides a physical LAN into multiple logical LANs, each of which is a broadcast domain.

Hosts within a VLAN communicate with each other as if they were on the same LAN, but hosts within different VLANs cannot communicate directly.

Vlan Benefits

VLANs have the following benefits over traditional Ethernet:

Broadcasts are limited to a single VLAN, saving bandwidth and increasing network capacity.

Enhanced LAN security: VLANs do not communicate directly with each other, and access is through Layer 3 devices such as routers or Layer 3 switches.

The Vlan Principle

In order for a switch to be able to distinguish between messages of different VLANs, it needs to add a field in the message that identifies the VLAN. Since the switch operates at Layer 2,

it can only recognize the data link layer encapsulation of the message. Therefore, if an identification field is added, it needs to be added to the data link layer encapsulation as well.

In 1999, the IEEE published a draft standard for the IEEE 802.1Q protocol to standardize the implementation of VLANs, and to define the structure of messages with VLAN identifiers.

Legacy Ethernet Frame Encapsulation Format

|DA&SA|Type|#####DATA######|

DA denotes the destination MAC address, SA denotes the source MAC address, TYPE denotes the protocol type, and DATA denotes data.

The IEEE 802.1Q protocol specifies that a 4-byte VLAN Tag is encapsulated after the destination MAC address and the source MAC address to identify information about the VLAN.

|DA&SA|Vlan Tag;TPID;Prioriy;CFI;Vlan ID;|TYPE|#####DATA######|

Important VLAN ID

The VLAN ID identifies the number of the VLAN to which the message belongs, and is 12 bits in length, with a range of 0 to 4095.

The VLAN ID is the number of the VLAN to which the message belongs.

Since 0 and 4095 are usually not used, the value range of VLAN ID is 1~4094.

The switch uses VLAN ID to identify the VLAN to which the message belongs, and encapsulates a VLAN Tag with the default VLAN ID of the receiving port for the received message if the message does not carry a VLAN Tag.

VLAN Tag with the default VLAN ID of the receiving port, and encapsulates a VLAN Tag with the default VLAN ID of the receiving port, and encapsulates a VLAN Tag with the default VLAN ID of the receiving port. When the received message does not carry a VLAN Tag, the switch encapsulates the VLAN Tag with the

default VLAN ID of the receiving port, and classifies the message to be transmitted in the default VLAN of the receiving port.

Ethernet Ports

There are three types of Ethernet port link types:

Access type: the port can only belong to one VLAN, generally used for connecting computers;

Trunk type: the port can belong to more than one VLAN, and can receive and send messages of more than one VLAN, generally used for connecting between switches;

Hybrid type: the port can belong to more than one VLAN, and can receive and send messages of more than one VLAN.

Hybrid type: the port can belong to multiple VLANs, can receive and send messages of multiple VLANs, and can be used for connecting between switches or connecting to user's computer.

Users can add the current Ethernet port to the specified VLAN. After this configuration, the Ethernet port

can forward messages of the specified VLAN, thus realizing the interoperability between the VLAN on this switch and the same VLAN on the other switch.

trunk type, can carry multiple VLANs through at the same time, only allows the default VLAN is not marked, access can only carry a single VLAN, hybrid, can carry multiple VLANs through at the same time, allows multiple VLANs are not marked.

(In port mode) Command Format:

port link-type { access | trunk | hybrid }

Default value: default is to disable the vlan trunk function

The TRUNK port enables interoperability of the same VLANs on different switches, and can carry traffic through multiple VLAN traffic

########################################################################################

Command line view related

User view

#Enter user view after connecting to the switch

system view

system-view #Enter system view

[H3C] #Currently system view

vlan view

[H3C]vlan 2 #Enter vlan view

[H3C-Vlan2] #Currently vlan view

vlan interface view

[H3C-Vlan2]quit #Return to system view

[H3C]interface vlan-interface 2 #Enter vlan interface view

[H3C-Vlan-interface2] #Currently vlan interface view

[H3C-Vlan-interface2]quit #Return to system view

Ethernet port view

[H3C]interface GigabitEthernet 0/1 #Enter port view

[H3C- GigabitEthernet0/1] #Currently in port view

############################################################################################

Help Related

Under any view, type ? to get all the commands in that view and a brief description

?

debugging Enable system debugging functions

display Display current system information

ping Ping function

quit Exit from current command view

reboot Reset switch

reset Reset operation

save Save current configuration

system-view Enter the system view

undo Cancel current setting

Type a command followed by a space-separated list of all keywords and their brief descriptions, if there are keywords at that command line location.

ping ?

-c Specify the number of echo requests to send

-s Specify the number of data bytes to send

X.X.X.X Destination IP address

Type command, press the key, and if the keyword is unique to the first letter entered, the full keyword will be displayed

pi?

ping

###########################################################################################

Vlan Related

Create and enter vlan view or delete vlan<

vlan 2

undo vlan 2 [undo vlan all]

Add the access port to the specified vlan

system-view/vlan 2/view execution

port GigabitEthernet 0/2

port GigabitEthernet 0/3 to GigabitEthernet 0/4 (ports 3-4) or the next statement

port GigabitEthernet 0/3 GigabitEthernet 0/4

Remove access ports from vlan

<

undo port GigabitEthernet 0/2

undo port GigabitEthernet 0/2

undo port GigabitEthernet 0/3 to GigabitEthernet 0/6

undo port GigabitEthernet 0/3 to GigabitEthernet 0/6

undo port GigabitEthernet 0/3 to GigabitEthernet 0/6< /p>

Create and enter vlan interface view

interface Vlan-interface 2

Configure vlan interface IP address

system-view/vlan 2/interface view

ip address 192.168.9.1 255.255.255.0

vlan interface Specify the gateway.

ip gateway 192.168.9.1

Configure the management VLAN, default is VLAN 1

management-vlan 3 #Specify vlan 3 as the management vlan

ip route-static 0.0.0.0.0.0.0.0 192.168.0.2 #Add a default route

display vlan settings

display vlan 3 #vlan

display vlan all

display interface vlan-interface 3 #vlan interface

< p> display ip interface vlan-interface 3 #vlan ip address

display ip routing-table [verbose] #View routing-table summary information, [verbose for details]

#################################################################################

Ethernet port related

Change the port type to trunk (for interoperability of the same VLANs on different switches)

Change the port type to trunk. interworking on different switches)

[H3C101]interface GigabitEthernet 0/2 #Enter port view

[H3C101-GigabitEthernet0/2]port link-type ? #? Get port command help

access Access link-type

hybrid Specify current hybrid port's characteristics

trunk VLAN trunk link-type

[ H3C101-GigabitEthernet0/2]port link-type trunk #Specify the port type as trunk

[h3c101]display interface GigabitEthernet 0/2 #Display information about the specified port (a large portion of the information is omitted)

........................

PVID: 1

Mdi type: auto

Port link-type: trunk

VLAN passing : 1 (default)

VLAN allowed : 1 (default)

Trunk port encapsulation: IEEE 802.1q

.........................

Allow messages from other vlan to pass through Trunk port

[h3c101-GigabitEthernet0/2]port trunk permit vlan 200 300 #Join vlan 200 300

[h3c101-GigabitEthernet0 /2]display interface GigabitEthernet 0/2

PVID: 1

Mdi type: auto

Port link-type: trunk

VLAN passing : 1 (default), 200, 300

VLAN allowed : 1 (default), 200,300

Trunk port encapsulation: IEEE 802.1q

Configure the default VLAN ID of port GigabitEthernet0/2 to 1

[ h3c101-GigabitEthernet0/2]port trunk pvid vlan 1

#################################################################################

User-related

#

Setting the telnet user password

[H3C ]user-interface vty 0

[H3C-vty0]set authentication password dongnan

Set web username and password

[H3C]localuser admin admin 1

Display the current User Configuration

[H3C]display user-interface

Idx Type Tx/Rx

0 AUX 0 9600

+ 1 VTY 0

2 VTY 1

+ 3 WEB 0

4 WEB 1

5 WEB 2

6 WEB 3

+ : Current user-interface is active.

F : Current user-interface is active and working in async mode.

Idx . Absolute index of user-interface.

Type : Type and relative index of user-interface.

###############################################################

Error Related

[H3C]interface vlan-interface 300

Cannot set management-vlan different with L3 interface vlan!

Delete the management VLAN interface first

undo interface vlan-interface 1

The management VLAN has to be deleted. The default is VLAN 1.

undo management-vlan

Add the new management VLAN ID again

management-vlan 300

Add the vlan interface again

interface vlan-interface 300

interface vlan-interface 300<

ip address

ip address 192.168.5.101 255.255.255.0

gateway

ip gateway 192.168.5.1

HW01_0.xy-yd-3526 : This is the name of the switch

IP address 192.168.192.168 collision detected, sourced by 0013-d47a-46a9 on Ethernet0/7 of VLAN6 and 0010-e537-fe72 on Ethernet0/7 of VLAN6: This refers to two ip address This is a conflict between two ip addresses. Specifically in VLAN6, two computers connected to a switch on port 7 have conflicting ip addresses. The two macs are, respectively, 0013-d47a-46a9, 0010-e537-fe72.