Basic CLI Commands on H3C Switch

Creating a User on an H3C Switch:

To create a user on an H3C switch, you can perform this operation through a web interface or SSH. Follow the commands below to create a user:

<switch> system-view
[switch] local-user admin class manage
[H3C-luser-manage-admin] password simple password

Specify the user’s access level. In H3C switches, you can set the user’s access level using the “class” command. For instance, to grant the user full administrative access, use the following command:

[H3C] local-user admin class manage

Here, “manage” represents the highest level of access required for full administrative privileges.

Confirm the user’s creation. After successfully creating the user, you can view users using the “display local-user” command:

[switch] display local-user

This command lists all users and their respective access levels.

Creating VLAN on an H3C Switch:

Connect to your switch using SSH or Telnet. Enter the following commands to create a VLAN:

system-view
vlan VLAN_ID
name VLAN_NAME
ip address IP_ADDRESS MASK

Here, replace “VLAN_ID” with the desired VLAN number, “VLAN_NAME” with a name or description for the VLAN, and “IP_ADDRESS” and “MASK” with the IP address and subnet mask for the VLAN.

See also  How to Ping a Computer?

To save the VLAN configuration, use:

save

Assigning IP to VLAN on an H3C Switch:

Connect to your switch via SSH or Telnet. Determine the VLAN ID and create VLAN 10 if not already present:

system-view
vlan 10
quit

Assign an IP address to VLAN 10:

interface vlan 10
ip address 192.168.10.1 255.255.255.0

Enabling Telnet on an H3C Switch:

Connect to the management console and log in with your username/password. Enter the following commands to enable Telnet:

system-view
telnet server enable

Define the username and password for Telnet, e.g., for the “admin” user:

local-user admin password irreversible-cipher your_password

Specify Telnet sessions through VLAN 1:

user-interface vty 0 4
authentication-mode scheme
user privilege level 3
protocol inbound telnet

Enabling SSH on an H3C Switch:

Connect to the management console and log in. Enter the following commands to enable SSH:

system-view
ssh server enable

Generate an RSA key for SSH:

public-key local create rsa

Assign the RSA key to an SSH user:

user-interface vty 0 4
authentication-mode scheme
user-role network-admin
protocol inbound ssh

Enabling Spanning Tree Protocol (STP) on an H3C Switch:

Enter configuration mode and enable STP:

sys
stp global enable

Specify the STP version:

For Rapid Spanning Tree Protocol (RSTP):

stp mode rstp

For Classic Spanning Tree Protocol (CSTP):

stp mode stp

For Multiple Spanning Tree Protocol (MSTP):

stp mode mstp

Optionally, configure STP parameters:

stp max-age time

Save the STP configuration and apply changes:

save
quit

Enabling DHCP Snooping on an H3C Switch:

Connect to the switch through a terminal program. Log in with administrator credentials. Enable DHCP snooping:

system-view
dhcp snooping enable

If needed, configure trusted DHCP servers and ports:

interface GigabitEthernet 1/0/24
dhcp snooping trust
save

Defining Trunk Ports on an H3C Switch:

Connect to the management console and log in. Choose ports for trunking. Configure the ports as trunk:

interface gigabitethernet 1/0/1
port link-type trunk

Specify the VLANs for the trunk:

port trunk permit vlan 10 20

Activate the trunk port:

undo shutdown

Creating an Access Port on an H3C Switch:

Provide administrative access to the switch, usually through a web interface or SSH. Enter the command to create an access port:

interface GigabitEthernet 1/0/1
port link-type access
port default vlan 10

Save the configuration changes:

save

Disabling HTTP Access on H3C Switch

Establish a serial or Telnet connection to the H3C switch.
Enter the following command and press the Enter key:

system-view

Enter the following command and press the Enter key:

undo ip http enable

Viewing CPU Usage on H3C Switch

See also  How to Find Local IP Address?

Access the switch’s CLI console.
Use the command:

display cpu-usage

This command displays real-time CPU usage. Alternatively, you can use the command:

display cpu-usage interval [interval-time]

To view CPU usage over a specific time interval, for example, “display cpu-usage interval 60” displays CPU usage over 60 seconds.

Rebooting H3C Switch

Access the switch’s CLI console.
Use the command:

reboot

Confirm with the “y” command to complete the reboot process.

Disabling a Port on H3C Switch

Access the switch via console or SSH.
Identify the interface to be disabled, connected to the port you want to disable.
Use the “interface” command to configure the interface. For example:

interface GigabitEthernet 1/0/1

To disable the interface, use the “shutdown” command:

shutdown

Enabling a Port on H3C Switch

Access the switch via console or SSH.
Identify the interface to be enabled, connected to the port you want to enable.
Use the “interface” command to configure the interface. For example:

interface GigabitEthernet 1/0/1

To enable the interface, use the “no shutdown” command:

undo shutdown

Checking Port Status on H3C Switch

To view the status of all ports, use:

display interface brief

This command shows the status of all ports and their corresponding numbers.
To view the status of a specific port, use:

display interface <interface-type> <interface-number>

For example:

display interface Gigabitethernet 1/0/1

Assigning a Port to a Specific VLAN on H3C Switch

First, create the VLAN you want. Specify VLAN ID, VLAN name, and other properties.

vlan 10
vlan-name example_vlan

Identify the port you want to assign to the VLAN and set the port mode.

interface GigabitEthernet 0/0/1
port link-type access

Finally, assign the port to the created VLAN.

port access vlan 10

Changing the Speed of a Port on H3C Switch

To display the current speed setting of a port:

display interface <interface-type> <interface-number>

For example:

display interface GigabitEthernet 0/0/1

To change the speed, use:

interface <interface-type> <interface-number>
speed <speed>

For instance, to set the speed of GigabitEthernet 0/0/1 to 100Mbps:

interface GigabitEthernet 0/0/1
speed 100

Save the settings with the “save” command.

See also  What is an IP address?

Changing the HTTP Management Port on H3C Switch

To display the current configuration of the HTTP management port:

display ip http

To change the HTTP management port, use:

ip http port <port-number>

For example, to change the port to 8080:

ip http port 8080

Save the changes with the “save” command.

Changing the SSH Management Port on H3C Switch

To display the current configuration of the SSH management port:

display ssh server status

To change the SSH management port, use:

ssh server port <port-number>

For instance, to change the port to 2222:

ssh server port 2222

Save the changes with the “save” command.

Changing the Telnet Management Port on H3C Switch

To display the current configuration of the Telnet management port:

display telnet server client

To change the Telnet management port, use:

telnet server port <port-number>

For example, to change the port to 2323:

telnet server port 2323

Save the changes with the “save” command.

Writing a Static Route on H3C Switch

Connect to the switch via SSH or Telnet.
To add a static route to the routing table, use:

<Switch> system-view
[Switch] ip route-static destination subnet-mask {next-hop-address | interface-type interface-number} [ preference ] [ description ]

Specify “destination,” “subnet-mask,” and either “next-hop-address” or “interface-type interface-number.” Use “preference” to set priority if there are multiple routes. “description” allows adding a description. For example:

<Switch> system-view
[Switch] ip route-static 192.168.10.0 255.255.255.0 10.0.0.1

To confirm the configured static route, use:

<Switch> display ip routing-table

Assigning DNS Servers on H3C Switch

Connect to the switch via SSH or Telnet.
Enter global configuration mode:

<Switch> system-view

Define DNS server addresses using:

[Switch] dns server <DNS server IP address>

Specify the IP address of your DNS server. If using multiple DNS servers, use multiple “dns server” commands. For example:

[Switch] dns server 8.8.8.8

Viewing ARP Table on H3C Switch

Connect to the switch via SSH or Telnet.
View the ARP cache with:

<Switch> display arp

This command displays all entries in the switch’s ARP cache. Each entry consists of an IP address and a corresponding MAC address. To view the MAC address for a specific IP, use:

<Switch> display arp ip-address <IP address>

Leave a Comment