How to configure VLANS | Cisco Switch

Creating VLANS will help you segment your network into smaller broadcast domains.  Configuring VLANS will help group similar hosts into different groups. 

vlans
vlans

In our example we will configure 4 different VLANS.
Engineering, HR, Sales, Printers

Switch#config t
Switch(config)#vlan 10
Switch(config-vlan)#name Engineering
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name HR
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name Sales
Switch(config-vlan)#exit
Switch(config)#vlan 40
Switch(config-vlan)#name Printers
Switch(config-vlan)#exit

Next we will assign the switch ports to VLANS.

Switch(config)#interface gi0/0
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 10
!
Switch(config)#interface gi0/1
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 20
!
Switch(config)#interface gi0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 30
!
Switch(config)#interface gi0/3
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 40

Verification:

Switch#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi1/0, Gi1/1, Gi1/2, Gi1/3
                                                Gi2/0, Gi2/1, Gi2/2, Gi2/3
                                                Gi3/0, Gi3/1, Gi3/2, Gi3/3
10   Engineering                      active    Gi0/0
20   HR                               active    Gi0/1
30   Sales                            active    Gi0/2
40   Printers                         active    Gi0/3
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

Topic discussion at CLI Warriors - Forum