::
Computers & Technology
How to Setup VLAN on Cisco switch or router
SpiderTip
Posted: 2017-09-23
A VLAN is a group of end stations with a common set of requirements, independent of physical location. VLANs have the same attributes as a physical LAN but allow you to group end stations even if they are not located physically on the same LAN segment.
VLANs are usually associated with IP subnetworks. For example, all the end stations in a particular IP subnet belong to the same VLAN. Traffic between VLANs must be routed. LAN port VLAN membership is assigned manually on an port-by-port basis.
The method of creating VLAN is mostly same across the vendors.
Cisco Vlan Command
Switch# conf t - Enters configuration mode
Switch(config)# vlan 2 - Creates Vlan 2
switch(config-vlan)# name "IT Deaprtment" - Names the Vlan
switch(config-vlan)# exit - Exits to global config mode
switch(config-vlan)# interface gigabitEthernet 1/0/21 - Enter the interface of port 21.
switch(config-vlan)# switchport access vlan 2 - Assign the interface to VLAN 2
switch(config-vlan)# exit - Exit to global config mode
switch(config)# interface range gigabitEthernet 1/0/21-40 - Enters the range of ports 21 to 40
switch(config-if)#switchport access vlan 2 - Assigns all the ports above to VLan 2
switch(config-vlan)# exit - Exits to global config mode
switch(config)# exit - Exits to privilage mode
switch# show vlan - Display the vlans and ports per vlan
You can also assign range of ports to specific VLAN instead of individual ports.
switch(config-vlan)# interface gigabitEthernet 1/0/21-34 - Enter the interface of port 21-34.
switch(config-vlan)# switchport access vlan 2 - Assign the selected interface range to VLAN 2