How to create VLAN on a cisco switch

This article is all about how to create VLANs on a cisco switch. In the previous tutorial, we will learn about basic cisco switch configuration but here in this tutorial, we learn about some advanced configuration on cisco switches. In this tutorial, we learn about how to create VLANs, How to remove VLANs and how to create Trunk between two switches to communicate between our VLANs. But first of all, we learn some basics about VLAN like what is VLAN, why we use VLAN on switches and what are the uses of VLAN. Then we learn about how to create and remove VLANs and how to create a trunk on switches. Here we also learn about troubleshooting tips related to VLANs.

What is VLAN

A VLAN is a broadcast domain formed by switches. But all the switches by default works on VLAN 1. So you do not need to do anything to use switches for your connectivity, you just need to connect your device with switch ports and you are in a network.

Why we use VLAN and uses of VLAN on switches

Basically, all the switches works on VLAN 1 so all the PCs which are connected through the switches will be able to ping by all the PCs because they all are on the same network. If you want to make a single switch into multiple virtual switches then VLAN is the best option for switches. VLAN is also used when we are feeling a lot of broadcast traffic on our VLAN.

What is Trunk and why we use it on switches

A trunk is a special port that runs ISL or 802.1q so that it can carry traffic from more than one VLAN.

Now to understand VLAN configuration on switches we take a lab in cisco packet tracer. In this lab, we take two switches and 8 PCs to understand VLAN configuration.

how to create VLANs on switches

In this lab, we create two VLANs one is named as VLAN 100 and one is name as VLAN 50 and then we divide PCs in both the VLANs using commands that are given below. After that, we create trunk in between both the switches to allow both the PCs to communicate all the PCs according to their VLANs.

Now, first of all, we create VLAN on switch S1 using given below command on the switch

For switch S1

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname S1

S1(config)#vlan 100

S1(config-vlan)#name rahul

S1(config-vlan)#exit

S1(config)#vlan 50

S1(config-vlan)#name dd

S1(config-vlan)#exit

Now VLANs will be created on the switch and assign IP address on all the PCs.

 

Now check whether our VLAN is created succesfully or not

S1#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

50 dd active

100 rahul active

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

—- —– ———- —– —— —— ——– —- ——– —— ——

1 enet 100001 1500 – – – – – 0 0

50 enet 100050 1500 – – – – – 0 0

100 enet 100100 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

Remote SPAN VLANs

————————————————————————–

Primary Secondary Type Ports

——- ——— —————– —————————————

 

Now assign VLAN membership to all active interfaces of the switch

For switch S1 use given below commands

S1>enable

S1#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

S1(config)#int fa0/1

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 50

S1(config-if)#exit

S1(config)#int fa0/2

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 50

S1(config-if)#exit

S1(config)#int fa0/3

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 100

S1(config-if)#exit

S1(config)#int fa0/4

S1(config-if)#switchport mode access

S1(config-if)#switchport access vlan 100

S1(config-if)#exit

 

Now check that proper port is assigned with proper vlan or not on switch s1

S1>en

S1#show vlan

VLAN Name Status Ports

—- ——————————– ——— —————————-

1 default active 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

50 dd active Fa0/1, Fa0/2

100 rahul active Fa0/3, Fa0/4

 

Now after that, we create vlan on switch S2 using given below codes

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname S2

S2(config)#vlan 100

 

S2(config-vlan)#name rahul

S2(config-vlan)#exit

S2(config)#vlan 50

S2(config-vlan)#name dd

S2(config-vlan)#exit

S2(config)#exit

 

Now check that wether vlan is created successfully or not on switch S2

S2#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

50 dd active

100 rahul active

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

—- —– ———- —– —— —— ——– —- ——– —— ——

1 enet 100001 1500 – – – – – 0 0

50 enet 100050 1500 – – – – – 0 0

100 enet 100100 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

Remote SPAN VLANs

————————————————————————–

Primary Secondary Type Ports

——- ——— —————– —————————————-

 

Now assign VLAN membership on switch S2

S2>enable

S2#config t

Enter configuration commands, one per line. End with CNTL/Z.

S2(config)#int fa0/1

S2(config-if)#switchport mode access

 

S2(config-if)#switchport access vlan 100

S2(config-if)#exit

S2(config)#int fa0/2

S2(config-if)#switchport mode access

S2(config-if)#switchport access vlan 100

S2(config-if)#exit

S2(config)#int fa0/3

S2(config-if)#switchport mode access

S2(config-if)#switchport access vlan 50

S2(config-if)#exit

S2(config)#int fa0/4

S2(config-if)#switchport mode access

S2(config-if)#switchport access vlan 50

S2(config-if)#exit

 

Now check VLAN membership on switch S2

S2#show vlan

VLAN Name Status Ports

—- ——————————– ——— ——————————-

1 default active 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

50 dd active Fa0/3, Fa0/4

100 rahul active Fa0/1, Fa0/2

 

Now we create Trunk on both the switches to allow communication in between both the switches and VLANs

For switch S1
S1>enable
S1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#int fa0/5
S1(config-if)#switchport trunk allowed vlan all
S1(config-if)#switchport mode trunk

S1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up

S1(config-if)#exit

 

For switch S2
S2>enable
S2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S2(config)#int fa0/5
S2(config-if)#switchport trunk allowed vlan all
S2(config-if)#switchport mode trunk
S2(config-if)#exit

Now we troubleshoot and verify our configuration using troublshoot commands on Switch S1

To show information about VLANs use given below command

S1#show vlan

VLAN Name Status Ports

—- ——————————– ——— —————————-

1 default active 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

50 dd active Fa0/1, Fa0/2

100 rahul active Fa0/3, Fa0/4

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

—- —– ———- —– —— —— ——– —- ——– —— ——

1 enet 100001 1500 – – – – – 0 0

50 enet 100050 1500 – – – – – 0 0

100 enet 100100 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

Remote SPAN VLANs

————————————————————————–

Primary Secondary Type Ports

——- ——— —————– —————————————-

To saw brief information about VLANs

S1#show vlan brief

VLAN Name Status Ports

—- ——————————– ——— ——————————-

1 default active 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

50 dd active Fa0/1, Fa0/2

100 rahul active Fa0/3, Fa0/4

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

 

Now to remove VLAN from a switch use given below command

S1#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

S1(config)#no vlan 100

S1(config)#exit

 

Now check whether vlan 100 is removed or not

S1#show vlan brief

VLAN Name Status Ports

—- ——————————– ——— ——————————-

1 default active 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

50 dd active Fa0/1, Fa0/2

1002 fddi-default active

1003 token-ring-default active

1004 fddinet-default active

1005 trnet-default active

If you have any queries regarding this solved out through the comment section and also provide feedback to us because your feedback is valuable for us.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s