1. Creating VLANs
2. Access Interfaces
3. Trunk Mode Interfaces
4. General Mode Interfaces
To create a VLAN on the switch, perform the following commands. This example uses VLANs 10, 13, 14, 15, 16.console>enable
console#configure
console(config)#vlan database
console(config-vlan)#vlan 10,13-16
console(config-vlan)#end
console#
Access interfaces on a switch designate one VLAN for that interface, untagged. Any traffic received on a port set for access 10 puts that traffic into VLAN 10. This is common for server-side interfaces that require only one VLAN. The following example configures a server-side interface Gigabit 1/1 for access 10.console#config
console(config)#interface gi1/1
console(config-if)#switchport access vlan 10
To remove access configuration and set it back to default VLAN 1, use the following command.console(config-if)#no switchport access vlan
console(config)#Interface port-channel 1
Trunk interfaces on a switch pass one VLAN untagged, and all other VLANs tagged. This is common for interfaces that connect to other switches, or servers with VMware requiring multiple VLANs. This example sets Trunk mode on external interface Gigabit 0/4.console#config
console(config)#interface gi0/4
console(config-if)#switchport mode trunk
VLAN 1 is the untagged vlan by default, to alter the untagged VLAN, perform the following command.console(config-if)#switchport trunk native vlan 10
To undo the above command, perform the following.console(config-if)#no switchport trunk native vlan
To undo Trunk mode, perform the following.console(config-if)#no switchport mode trunk
console(config)#Interface port-channel 1
General mode interfaces also pass one untagged VLAN and multiple extra tagged VLANs. The difference with general mode is that you specify which VLANs you want to add manually, and does not automatically add every VLAN by default. This is good for VLAN pruning. This example sets General mode on external interface Gigabit 0/4, and allows VLANs 1, 10, 13, 14, but not 15 and 16.console#config
console(config)#interface gi0/4
console(config-if)#switchport mode general
console(config-if)#switchport general allowed vlan add 10,13-14 tagged
General mode does not pass an untagged VLAN by default. To set an untagged VLAN, you must add it and set the PVID. The following example sets 16 as untagged.console(config-if)#switchport general allowed vlan add 16 untagged
console(config-if)#switchport general pvid 16
To remove a VLAN from the port, perform the following command.console(config-if)#switchport general allowed vlan remove 10
To remove a pvid
command, perform the following command.console(config-if)#no switchport general pvid
To remove General mode from an interface, perform the following.console(config-if)#no switchport mode
console(config)#Interface port-channel 1