VLAN Configuration and VLAN Trunking Protocol

If you wish to add a VLAN to a switch one way to do it, is to configure a port that requires the the specified vlan. In the next example we will add VLAN 4 to a switch while configuring a port.  First we can check what VLANs exist.

#show vlan 


VLAN Name Status Ports

1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2

1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

1 enet 100001 1500 – – – – – 0 0
1002 fddi 101002 1500 – – – – – 0 0
1003 tr 101003 1500 – – – – – 0 0
1004 fdnet 101004 1500 – – – ieee – 0 0
1005 trnet 101005 1500 – – – ibm – 0 0

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans

As we can see the vlan 4 doesnt exist. To add the Vlan 4 we can add it using while configuring a port, like in the following example.

Switch#conf t
Enter configuration commands, one per line.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport access vlan 4
% Access VLAN does not exist. Creating vlan 4

As you can see in the output the switch has realized that VLAN4 does not exist so its went ahead and created it automatically.

Switch>copy running-config startup-config
Destination filename [startup-config]?
Building configuration...

The VTP advertises VLANs to other Switches, in client and server mode or transparent. You can set the VTP to Transparent or disable it using the following commands:

Switch#conf t
Switch#vtp mode transparent
Switch#copy run start


Switch#conf t
Switch#vtp mode off
Switch#copy run start

Configuring VLAN Trunking can be very simple if you just statically configure trunking.  Here is a basic example how set a switchport to trunk mode and to add 2 VLANS to the trunk port.

Switch>configure terminal
Switch#interface gigabit 3/1
Switch#switchport mode trunk
Switch#switchport trunk allowed vlan add 3-4
Switch#do copy running-config startup-config