Think you know VLANs?

Virtual LANs (VLANs) seem to be one of the easiest topics to configure in the CCNA course. However, there can be some tricky things that are often overlooked. First, you must create your VLANs, then configure trunking, and lastly assign ports to VLANs.

To begin, there are three modes you can enter to configure VLANs: VLAN Database mode, VLAN Configuration mode, and Interface Configuration mode.

VLAN Database mode is deprecated so it may not be available for future usage.

SW1#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
SW1(vlan)#vlan 5
VLAN 5 added:
Name: VLAN0005
APPLY completed.

VLAN configuration mode is a sub-mode inside of global configuration mode that allows you to configure all of the basic options.

SW1#config terminal
SW1(config)#vlan 5

Now for Interface configuration mode, you have to issue the command switchport access vlan vlan#. Usually this only applies a VLAN to a port, however if the VLAN in question isn’t inside the VLAN database, then It will be created.

SW1(config)#interface fastEthernet 0/5
SW1(config-if)#switchport access vlan 5
% Access VLAN does not exist. Creating vlan 5

By the way, the VLAN database is a file inside of flash (not NVRAM) called vlan.dat. (Later we will have a post about VLAN Trunking Protocol (VTP) so the management of these VLANS can be simplified in a larger network.)

Secondly, your next objective will be to create your trunks. This can be done dynamically or manually. However in many causes it should be done manually. It is accomplished with the interface command switchport mode trunk.

SW1#config terminal
SW1(config)#interface fastethernet 0/10
SW1(config-if)#switchport mode trunk

Also, a majority of the time, the Ethernet interface must be Fastethernet capable or faster. Although, two different types of encapsulation that can be used for trunking, newer model switches only support IEEE 802.1q. (In a future blog I will discuss options that are necessary for modifying 802.1q trunks).

Lastly, you should apply the VLAN to the interface with the command switchport access vlan vlan#.

SW1(config)#interface fastEthernet 0/15
SW1(config-if)#switchport access vlan 50

You can verify this with the show vlan brief command, the show interface switchport command or the show interfaces status. The various output of these command all show different information, however they have VLAN listed to the interface. Also, the commands for configuring trunk and assigning ports to VLANs are located in the running-config and, (later) the startup-config. (There also will be future posts about the appearance of these different show commands.)

Just remember, with configuring VLAN information there are different things that have to be taken into account. There are different modes for creating VLANs, considerations for configuring trunk and assigning VLANs to interfaces.

Author: Jason Wyatte

In this article

Join the Conversation


  1. Alfa Reply

    Well written and straight to the point. Great…
    Thanks…and keep them coming.

  2. William Reply

    thank you!