Configuring Industrial Switches via the CLI

Tag: industrial switches    Blog | 05-14-2025
Configuring Industrial Switches via the CLI (Command Line Interface)


The specific steps for configuring industrial switches through the CLI may vary depending on the device model and manufacturer. However, the general process is largely similar. Here is a general configuration guide:

Configuring Industrial Switches

1. Connecting to the Switch

Physical Connection

  • Console Connection: Use an RJ45-to-USB or RS232 serial cable to connect to the Console port of the switch. Access it through terminal emulation software (such as PuTTY, SecureCRT). Set the baud rate to 9600bps, with 8 data bits, 1 stop bit, and no parity.
  • SSH/Telnet Connection: You need to know the IP address of the switch in advance and connect remotely via the network (the switch must have its network interface configured already).

Initial Access

After connecting, press the Enter key to activate the CLI. You may be required to enter the default username and password (common defaults are like: admin/adminroot/root).


2. Entering the Configuration Mode


Most industrial switches have a hierarchical CLI structure, and you need to enter the privileged mode and the global configuration mode:


bash
# Enter the privileged mode from the user mode (password required)> enable# Enter the global configuration mode# Different manufacturers may have different syntax. Commonly:# Cisco style:# # configure terminal# Huawei/H3C style:# # system-view# Typical industrial switch style:# # config

3. Basic Configuration

Setting the Device Name

bash
(config)# hostname [Switch Name]

Configuring the Management IP

bash
(config)# interface vlan [VLAN ID]  # Enter the management VLAN interface(config-if)# ip address [IP Address] [Subnet Mask](config-if)# no shutdown  # Activate the interface(config-if)# exit

Setting the Default Gateway

bash
(config)# ip default-gateway [Gateway IP]

4. VLAN Configuration (Virtual Local Area Network)

Creating VLANs

bash
(config)# vlan [VLAN ID](config-vlan)# name [VLAN Name](config-vlan)# exit

Assigning Ports to VLANs

bash
(config)# interface [Port Number]  # For example: ethernet 1/0/1(config-if)# switchport mode access(config-if)# switchport access vlan [VLAN ID](config-if)# exit

5. Port Configuration

Setting the Port Speed and Duplex Mode

bash
(config)# interface [Port Number](config-if)# speed [10/100/1000]  # Speed (Mbps)(config-if)# duplex [auto/full/half]  # Duplex mode(config-if)# exit

Enabling/Disabling Ports

bash
(config)# interface [Port Number](config-if)# shutdown  # Disable the port(config-if)# no shutdown  # Enable the port(config-if)# exit

6. Spanning Tree Protocol (STP) Configuration

To prevent network loops:


bash
(config)# spanning-tree mode [stp/rstp/mstp]  # Select the STP mode(config)# spanning-tree vlan [VLAN ID] priority [Priority]  # Set the priority

7. Saving the Configuration

After the configuration is completed, it needs to be saved to avoid losing it after a reboot:


bash
# Different manufacturers have different commands:# Cisco style:# # copy running-config startup-config# Huawei/H3C style:# # save# Typical industrial switch style:# # write memory

8. Verifying the Configuration

bash
# View the interface status# # show interfaces# # show interfaces status# View the VLAN configuration# # show vlan# View the IP configuration# # show ip interface brief# View the spanning tree status# # show spanning-tree

Precautions

  1. Backup Configuration: Use show running-config to export the current configuration before operation.
  2. Industrial Environment Characteristics: Some switches support ring network redundancy protocols (such as RSTP, ERPS, MRP), which require additional configuration.
  3. Security Settings:


bash
# Set the management password(config)# enable secret [Password]# Configure SSH(config)# ip ssh version 2(config)# username [Username] password [Password]


  1. Log Monitoring: Configure a log server to collect the device status.


Please refer to the CLI manual provided by the device manufacturer for specific operations.