How to Configure VLAN in Layer 2 Switch in GNS3? – In this article, we will use the GNS3 program to create VLANs and perform Inter-VLAN (VLAN Routing) operations on the Cisco Layer 2 Switch.
How to Configure VLAN in Layer 2 Switch in GNS3?

How to Configure VLAN in Layer 2 Switch in GNS3?

How to Configure VLAN in Layer 2 Switch in GNS3?

More specific network designs are being made with GNS3. With Dynamips we can create a real network topology using the IOS images of Cisco Router or Cisco Switch network devices.

In our previous article, we implemented how to add Layer 2 Switch in GNS3. Before proceeding with the VLAN configuration steps on the Layer 2 Switch, you need to add the Layer 2 Switch on the GNS3. After adding Layer 2 Switch on GNS3, you can proceed to VLAN configuration steps.

We were integrating VMware Workstation virtual machines as client computers when designing the network in the GNS3 program. In this article, we will use the Virtual PC Simulator (VPCS) from the GNS3 tools. With the use of VPCS, we can make our computer work more efficiently.

Virtual machines will create loads on our computers. But remember that we have to use virtual machines in different scenarios.

Our Recommendation

How to Create VLAN in L2 Switch?

We can now move on to configure VLAN in Layer 2 Switch. These steps;

1. Assign Ip Address to VPCS
2. Creating a VLAN on L2 Switch
3. Determination of Switch Trunk Ports
4. Trunking between L2 Switches
5. Cisco Router Inter-VLAN Configuration

   Step 1

Run the GNS3 program and add a Cisco Router from the Tools section to the workspace.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 2

Add Layer 2 Switch and 2 VPCS to the workspace.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 3

Add one more Layer 2 Switch and VPCS for Layer 2 VLAN configuration.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 4

In the GNS3 workspace, click the right button / configure on the Layer 2 Switch. In the window that opens, we will increase the amount of RAM for the Cisco Layer 2 Switch. Because the L2 Switch we added to the GNS3 program is Qemu-based, boot problems can occur with low RAM.

Configure the amount of Cisco L2 Switch RAM to 400 MB, and then click the Network tab.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 5

On the Network tab, set the number of Adapters to 4 to add the interface to the Switch.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 6

In the GNS3 workspace, you can specify a 300 MB RAM amount if we use two interfaces on Cisco Layer 2 Switch-2.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 7

Add 2 interfaces from the Network tab.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 8

After performing the above steps, click on the cabling option and then cable the network devices in the work area.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 9

In the process to configure VLAN in L2 Switch in GNS3, the final status of the network topology is as shown below. After specifying the VLANs on the network topology, note the IP addresses for the VPCS.

Trunk connection is required between Cisco switches. So specify the trunking area. Finally, for Cisco Router VLAN routing configuration, the between the connection of Cisco Router and Cisco Switch will be configured as trunks.

Double click on VPCS PC1 to assign the IP address.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 10

To assign the IP address to PC1, type the following command and press the Enter key. You can use the show ip command to browse the Ip configuration.

[code] ip 192.168.5.5/24 192.168.5.1
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 11

To give the IP address to the VPCS PC2, execute the following command. The point to note here is to step by network topology. IP address will be different because PC2 will be a member of VLAN10.

[code] ip 192.168.10.10/24 192.168.10.1
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 12

If we are going to join VLAN5, run the following command to give the IP address for VPCS PC3.

[code] ip 192.168.5.10/24 192.168.5.1
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 13

To create VLAN in L2 Switch, click on Layer 2 Switch-1 and Layer 2 Switch-2 to configure Cisco Switches.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 14

To create a VLAN in Cisco Layer 2 Switch, follow these commands.

L2 Switch-1

[code] vIOS-L2-01# conf t
vIOS-L2-01(config)# vlan 5
vIOS-L2-01(config-vlan)# name IT
vIOS-L2-01(config-vlan)# exit
vIOS-L2-01(config)# vlan 10
vIOS-L2-01(config-vlan)# name SALES
vIOS-L2-01(config-vlan)# exit
vIOS-L2-01(config)# end
vIOS-L2-01# wr
[/code]

L2 Switch-2

[code] vIOS-L2-01# conf t
vIOS-L2-01(config)# vlan 5
vIOS-L2-01(config-vlan)# name IT
vIOS-L2-01(config-vlan)# exit
vIOS-L2-01(config)# end
vIOS-L2-01# wr
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 15

After the Cisco Layer 2 Switch VLAN creation steps, we need to configure the L2 Switch interfaces. The interfaces connected to the Cisco Router and L2 Switch will be configured as trunks.

Use the following commands to specify the Access and Trunk interfaces of the Layer 2 Switch and make the PCs members of the VLANs.

[code] vIOS-L2-01(config)#interface gigabitethernet 0/1
vIOS-L2-01(config-if)#switchport mode access
vIOS-L2-01(config-if)#switchport access vlan 5
vIOS-L2-01(config-if)#exit
vIOS-L2-01(config)#
vIOS-L2-01(config)#interface gigabitethernet 0/2
vIOS-L2-01(config-if)#switchport mode access
vIOS-L2-01(config-if)#switchport access vlan 10
vIOS-L2-01(config-if)#exit
vIOS-L2-01(config)#
vIOS-L2-01(config)#interface gigabitethernet 0/3
vIOS-L2-01(config-if)#switchport trunk encapsulation dot1q
vIOS-L2-01(config-if)#switchport mode trunk
vIOS-L2-01(config-if)#exit
vIOS-L2-01(config)#
vIOS-L2-01(config)#interface gigabitethernet 0/0
vIOS-L2-01(config-if)#switchport trunk encapsulation dot1q
vIOS-L2-01(config-if)#switchport mode trunk
vIOS-L2-01(config-if)#exit
vIOS-L2-01(config)#exit
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 16

To perform the same operation on Cisco Layer 2 Switch-2, perform the following commands.

[code] vIOS-L2-01# conf t
vIOS-L2-01(config)#interface gigabitethernet 0/1
vIOS-L2-01(config-if)#switchport mode access
vIOS-L2-01(config-if)#switchport access vlan 5
vIOS-L2-01(config-if)#exit
vIOS-L2-01(config)#
vIOS-L2-01(config)#interface gigabitethernet 0/0
vIOS-L2-01(config-if)#switchport trunk encapsulation dot1q
vIOS-L2-01(config-if)#switchport mode trunk
vIOS-L2-01(config-if)#end
vIOS-L2-01#wr
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 17

Configuring Inter-VLAN Routing on Cisco Router in GNS3

Up to this step, we configured VPCS computers, created VLANs, assigned PCs to VLANs, and made the trunking connection.

In this step, we will perform VLAN routing on the Cisco Router over a single cable. After clicking on the Cisco Router in the GNS3 workspace, execute the following commands.

[code] R1# conf t
R1(config)#interface fastethernet 0/0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
R1(config)#interface fastethernet 0/0.5
R1(config-subif)#encapsulation dot1q 5
R1(config-subif)#ip address 19
*Mar 1 00:09:18.259: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
R1(config-subif)#ip address 192.168.5.1 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit
R1(config)#
R1(config)#interface fastethernet 0/0.10
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip address 192.168.10.1 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#end
R1#wr
[/code]

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 18

We have completed the Cisco Layer 2 Switch VLAN configuration steps. Now let’s ping the computers. Pinging from PC1 to PC2 member of VLAN is successful. Routing between VLANs works fine.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 19

When you ping PCs that are members of VLAN5 from PC2, you can see that the process is successful.

How to Configure VLAN in Layer 2 Switch in GNS3?

   Step 20

In the same way, PC3 connects to VLAN10 in a healthy way.

How to Configure VLAN in Layer 2 Switch in GNS3?

Show Commands Related to How to Configure VLAN in Layer 2 Switch in GNS3

PC1 Ip ConfigPC2 Ip ConfigPC3 Ip ConfigL2 Switch-1 = show vlan briefL2 Switch-2 = show vlan briefL2 Switch-1 = show running-configL2 Switch-2 = show running-configL2 Switch-1 = show interfaces trunkL2 Switch-2 = show interfaces trunkR1#show running-config

PC1> ip 192.168.5.5/24 192.168.5.1
Checking for duplicate address…
PC1 : 192.168.5.5 255.255.255.0 gateway 192.168.5.1

PC1> show ip

NAME : PC1[1] IP/MASK : 192.168.5.5/24
GATEWAY : 192.168.5.1
DNS :
MAC : 00:50:79:66:68:00
LPORT : 10003
RHOST:PORT : 127.0.0.1:10002
MTU: : 1500

PC1>

PC2> ip 192.168.10.10/24 192.168.10.1
Checking for duplicate address…
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1

PC2> show ip

NAME : PC2[1] IP/MASK : 192.168.10.10/24
GATEWAY : 192.168.10.1
DNS :
MAC : 00:50:79:66:68:01
LPORT : 10005
RHOST:PORT : 127.0.0.1:10004
MTU: : 1500

PC2>

PC3> ip 192.168.5.10/24 192.168.5.1
Checking for duplicate address…
PC1 : 192.168.5.10 255.255.255.0 gateway 192.168.5.1

PC3> show ip

NAME : PC3[1] IP/MASK : 192.168.5.10/24
GATEWAY : 192.168.5.1
DNS :
MAC : 00:50:79:66:68:02
LPORT : 10007
RHOST:PORT : 127.0.0.1:10006
MTU: : 1500

PC3>

vIOS-L2-01#show vlan brief

VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active
5 IT active Gi0/1
10 SALES active Gi0/2
100 VLAN100 active
200 VLAN0200 active
300 VLAN0300 active
1002 fddi-default act/unsup
1003 trcrf-default act/unsup
1004 fddinet-default act/unsup
1005 trbrf-default act/unsup

vIOS-L2-01#show vlan brief

VLAN Name Status Ports
—- ——————————– ——— ——————————-
1 default active
5 IT active Gi0/1
100 VLAN100 active
200 VLAN0200 active
300 VLAN0300 active
1002 fddi-default act/unsup
1003 trcrf-default act/unsup
1004 fddinet-default act/unsup
1005 trbrf-default act/unsup
vIOS-L2-01#

vIOS-L2-01#show running-config
Building configuration…

Current configuration : 5125 bytes
!
! Last configuration change at 06:26:58 UTC Mon May 15 2017
!
version 15.0
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname vIOS-L2-01
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
!
!
!
vtp domain CISCO-vIOS
vtp mode transparent
!
!
!
ip cef
no ipv6 cef
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
vlan 5
name IT
!
vlan 10
name SALES
!
vlan 100
name VLAN100
!
vlan 200,300
!
!
!
!
!
interface GigabitEthernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
switchport access vlan 5
media-type rj45
negotiation auto
!
interface GigabitEthernet0/2
switchport access vlan 10
media-type rj45
negotiation auto
!
interface GigabitEthernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
media-type rj45
negotiation auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
line con 0
logging synchronous
line aux 0
line vty 0 4
logging synchronous
login
line vty 5 15
logging synchronous
login
!
!
end

vIOS-L2-01#

vIOS-L2-01#show running-config
Building configuration…

Current configuration : 4883 bytes
!
! Last configuration change at 06:30:23 UTC Mon May 15 2017
!
version 15.0
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname vIOS-L2-01
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
!
!
!
vtp domain CISCO-vIOS
vtp mode transparent
!
!
!
ip cef
no ipv6 cef
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
vlan 5
name IT
!
vlan 100
name VLAN100
!
vlan 200,300
!
!
!
interface GigabitEthernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
media-type rj45
negotiation auto
!
interface GigabitEthernet0/1
switchport access vlan 5
media-type rj45
negotiation auto
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
line con 0
logging synchronous
line aux 0
line vty 0 4
logging synchronous
login
line vty 5 15
logging synchronous
login
!
!
end

vIOS-L2-01#

vIOS-L2-01#show interfaces trunk

Port Mode Encapsulation Status Native vlan
Gi0/0 on 802.1q trunking 1
Gi0/3 on 802.1q trunking 1

Port Vlans allowed on trunk
Gi0/0 1-4094
Gi0/3 1-4094

Port Vlans allowed and active in management domain
Gi0/0 1,5,10,100,200,300
Gi0/3 1,5,10,100,200,300

Port Vlans in spanning tree forwarding state and not pruned
Gi0/0 1,5,10,100,200,300
Gi0/3 1,5,10,100,200,300
vIOS-L2-01#

vIOS-L2-01#show interfaces trunk

Port Mode Encapsulation Status Native vlan
Gi0/0 on 802.1q trunking 1

Port Vlans allowed on trunk
Gi0/0 1-4094

Port Vlans allowed and active in management domain
Gi0/0 1,5,100,200,300

Port Vlans in spanning tree forwarding state and not pruned
Gi0/0 1,5,100,200,300
vIOS-L2-01#

R1#show running-config
Building configuration…

Current configuration : 1149 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.5
encapsulation dot1Q 5
ip address 192.168.5.1 255.255.255.0
!
interface FastEthernet0/0.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
!
interface Serial0/0
no ip address
shutdown
clock rate 2000000
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
!
!
control-plane
!
!
!
gatekeeper
shutdown
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
line vty 0 4
login
!
!
end

R1#

How to Configure VLAN in Layer 2 Switch in GNS3? ⇒ Video

You can watch the video related to how to configure Inter-VLAN Routing on Layer 2 Switches and you can also subscribe to our YouTube channel…

  Final Word

How to Configure VLAN in Layer 2 Switch in GNS3? – The Layer 2 Switch integration to the GNS3 program is absolutely necessary. You can then proceed to the L2 switch VLAN configuration step.

If this article is helpful, send me feedback by commenting! Thanks in advance, take care of yourself!

Also, you can add to browser bookmarks by pressing the CTRL+D to read this article later!

Articles Related to How to Configure VLAN in Layer 2 Switch in GNS3

Products Related to How to Configure VLAN in Layer 2 Switch in GNS3
Related Products

Download GNS3 Topology Related to How to Configure VLAN in Layer 2 Switch in GNS3

Leave a Reply

Your email address will not be published. Required fields are marked *

twenty − 5 =