Displaying VLAN List.
Below is an example to display list of vlan and its associated port(s):
User Access Verification
Username: admin
Password:
SW03>enable
Password:
SW03#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Gi0/22
2 DMZ active Gi0/15
3 Proxy active
4 Secured active Gi0/9
5 Calr active
6 Proc active
7 Test active
8 Center active
9 Apps
10 Users active
11 Backup active
12 VLAN0012 active
13 VLAN0013 active Gi0/7, Gi0/8, Gi0/10, Gi0/11
Gi0/12, Gi0/13, Gi0/14, Gi0/16
Gi0/17, Gi0/18
14 ipphone active
15 team active
100 TM_IPVPN active
110 TM active
999 Management active Gi0/1, Gi0/2, Gi0/3, Gi0/4
--More--
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
Gi0/5, Gi0/6, Gi0/19, Gi0/20
Gi0/21
1002 fddi-default act/unsup
1003 trcrf-default act/unsup
1004 fddinet-default act/unsup
1005 trbrf-default act/unsup
Creating VLAN.
In order to create vlan, first note the the number of existing vlan. Vlan numbering must be unique. Example below describe the steps of creating a vlan 10 named security.
Switch>enable
Switch#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name security
Switch(config-vlan)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Use show running-config command to verify that the vlan is successfully created.
Save your configuration by using: copy running-config startup-config > enter. Press enter again to accept default destination filename (startup-config). The switch will performed the operation and display OK, before returning to the prompt.
Associating port with VLAN.
To add port to vlan, there are two ways to do it. First, adding port one by one and second by adding using port range. The first method is useful to add a single port or to add ports that are not adjacent to each other (range cannot be used). The second one is for adding ports that are sequentially numbered eg: port 20 to 35. The example procedure for both methods are listed below. These procedure can also be used to reallocate port(s) between vlan.
a) Adding a single port
Switch#conf term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fa0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode.
Switch(config-if)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
b) Adding a range of port
Switch#conf term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface range fa0/20 – fa0/35
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but will only
have effect when the interface is in a non-trunking mode.
Switch(config-if-range)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Save your configuration by using: copy running-config startup-config > enter. Press enter again to accept default destination filename (startup-config). The switch will perform the operation and display OK, before returning to the prompt.
Unassociate port(s) from vlan.
You need to unassociate port(s) from vlan before deleting the vlan. To do this, below are the examples.
a)Unassociate a port
Switch#config term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fa0/1
Switch(config-if)#no switchport access vlan 10
Switch(config-if)#no spanning-tree portfast
Switch(config-if)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
b) Unassociate a range of port
Switch#config term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface range fa0/20 – fa0/35
Switch(config-if-range)#no switchport access vlan 10
Switch(config-if-range)#no spanning-tree portfast
Switch(config-if-range)#exit
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
When you unassociate a port from its vlan, it will return back to its original vlan which is vlan 1. Save your configuration by using: copy running-config startup-config > enter. Press enter again to accept default destination filename (startup-config). The switch will performed the operation and display OK, before returning to the prompt.
Deleting a vlan.
procedure listed below is example to delete a vlan.
Switch#config term
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#no vlan 10
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Switch#exit
Save your configuration by using: copy running-config startup-config > enter. Press enter again to accept default destination filename (startup-config). The switch will performed the operation and display OK, before returning to the prompt.