Spis treści

Cisco: Configuring VLANs on the EtherSwitch Router in GNS3

Introduction

The EtherSwitch Router on the GNS3 is a Cisco router equipped with a switching module (e.g. NM-16ESW), which enables the configuration of VLANs and Layer 2 functionality.

Naming of interfaces

The switching interfaces are named: FastEthernetx/y - e.g. `FastEthernet1/0`, where:

Creating VLANs

VLANs are created using VLAN Database Mode:

Router# vlan database
Router(vlan)# vlan 10 name SALES
Router(vlan)# vlan 20 name HR
Router(vlan)# exit

After exit, the VLANs are stored in NVRAM in the `vlan.dat` file.

Assigning a VLAN to a port (access mode)

Example: assigning port FastEthernet1/0 to VLAN 10:

Router# configure terminal
Router(config)# interface FastEthernet1/0
Router(config-if)# switchport access vlan 10
Router(config-if)# switchport mode access
Router(config-if)# no shutdown
Router(config-if)# exit

Trunk port configuration

The trunk port allows multiple VLANs to be carried over a single connection:

Router(config)# interface FastEthernet1/1
Router(config-if)# switchport trunk encapsulation dot1q
Router(config-if)# switchport mode trunk
Router(config-if)# switchport trunk allowed vlan 10,20
Router(config-if)# no shutdown
⚠️ Note: Some versions of EtherSwitch Router in GNS3 do not support the `switchport trunk encapsulation` command. - in which case use only `switchport mode trunk`.

Creating SVI (Switch Virtual Interface) interfaces

SVI enables VLAN management or routing between VLANs (if Layer 3 functionality is enabled):

Router(config)# interface vlan 10
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Router(config-if)# no shutdown

Ensure that the VLAN ports are active, otherwise the `VLANx` interface remains down.

Checking the configuration of VLANs and ports

Display existing VLANs:

Router# show vlan-switch

Display port configuration:

Router# show interfaces FastEthernet1/0 switchport

Display of liquor status:

Router# show interfaces trunk

Saving configurations

Once the configuration is complete, save it to permanent memory:

Router# write memory

or

Router# copy running-config startup-config