Marcio Cunha

How to configure a VLAN on a managed switch via console

Learn the practical step-by-step procedure to configure VLANs on enterprise switches using the serial console port and CLI commands.

Marcio Cunha•4 min
Also available in:PortuguêsEspañol
Summary
  • The console port and serial cable guarantee direct access to the switch even without prior network connectivity.
  • Using PuTTY allows interacting with the industry-standard network command-line interface.
  • Creating logical VLANs isolates traffic from different departments for enhanced operational security.
  • Access ports serve end-user devices while trunk ports transport multiple traffic flows simultaneously.
  • Properly saving the configuration to non-volatile memory prevents data loss after reboots.

Why use the console port to configure switches

When purchasing a managed switch for an enterprise network, the equipment arrives without a configured IP address or security rules. In practice, this means that the only secure and direct way to access the internal operating system is by plugging a physical cable into its dedicated console port, usually labeled as 'Console' or 'RS-232'. This serial connection bypasses any common network interface failures and allows diagnostics even when the equipment has been completely misconfigured by mistake.

To perform this bench procedure, you will need a computer with a traditional serial port or, more commonly today, a USB-to-serial adapter, along with a proper cable such as RJ-45 to DB-9 or USB console type. Before starting any advanced server infrastructure and networking configuration, mastering direct command-line access is essential to prevent surprises during critical maintenance windows.

Establishing serial connection and opening the CLI

With the console cable physically connected between your computer's USB port and the switch's serial port, the next step is to open a terminal emulation program. On Windows, the most widely used software for this task is PuTTY, while on Linux or macOS systems, native tools like screen or minicom perfectly fulfill the same technical role with high reliability.

In the terminal software, you must select the connection type as 'Serial' and adjust the industry-standard communication parameters known as serial port configuration. The standard speed is usually 9600 or 115200 bits per second (baud rate), with 8 data bits, no parity, and 1 stop bit (8-N-1). Upon opening the session and pressing the Enter key, the switch will respond by asking for your login credentials or directly displaying the manufacturer's command-line interface (CLI).

Creating and naming VLANs in the operating system

A VLAN (Virtual Local Area Network) physically divides a single switch infrastructure into multiple logical broadcast domains. In practice, this prevents data traffic from the finance department from freely mixing with guest traffic or printer broadcasts, drastically improving overall performance and security in corporate networks.

To create a new VLAN through the command line, we must enter the switch's global configuration mode and execute operating system-specific commands, such as Cisco IOS or similar. Below is a practical example of terminal commands executed to create VLAN 20 and assign a descriptive name to it:

enable
configure terminal
vlan 20
name Finance
exit
exit

This simple procedure creates the logical VLAN record in the equipment's internal database. However, the network will only function correctly after we associate the physical switch ports with this new virtual network, separating traffic according to the operational needs of the organization.

Configuring access ports and trunk ports

Port assignment is the moment when we define the physical destination of network cables coming from computers and routers. There are two main types of ports that require careful attention: Access Ports and Trunk Ports. Access ports connect end-user devices like computers and IP phones, belonging to a single specific VLAN.

Trunk ports, on the other hand, are used to interconnect different switches, carrying traffic from multiple VLANs simultaneously across a single physical cable using identifiers called tags. To configure a physical port as an access port belonging to our previously created VLAN 20, we use a direct sequence of commands in the terminal:

configure terminal
interface gigabitethernet 0/1
switchport mode access
switchport access vlan 20
end

If you need to connect another switch to this same port to expand the infrastructure, the port must be converted to trunk mode, allowing all created VLANs to travel without bottlenecks between devices. It is important to verify compatibility with the IEEE 802.1Q standard protocol, universally used for packet tagging in modern enterprise networks. To complement this implementation in production environments, see our related technical analyses on How to test a power supply thermal fuse with a multimeter and Npm stuck? How to clear cache and fix errors on Windows.

Validating configurations and saving to permanent memory

After executing all VLAN creation commands and port associations, the technical work is not entirely complete. If you reboot the switch right at this exact moment without saving changes, all recent configurations will disappear because they reside solely in the equipment's volatile memory (RAM).

To ensure the configuration survives power outages or scheduled reboots, we must save the current configuration file into non-volatile memory, known as NVRAM or internal flash. Below is the standard command used on most enterprise managed switches to execute this definitive save:

copy running-config startup-config

With the save completed, use verification commands like 'show vlan brief' to check if all ports are correctly associated with their respective virtual networks. Maintaining this technical rigor prevents connectivity failures and ensures a resilient, stable network infrastructure ready to handle the demands of any corporate environment.