VLAN and Trunking 2​

Topology

Tasks:

A small office network has two layer 2 switches SW1 and SW2 connected. A router (R1) is connected to SW1 for inter-VLAN routing using a Router-on-a-Stick configuration. R1 is already configured and inaccessible. The office has two departments: HR (VLAN 10) and Finance (VLAN 20). Configure the VLANs and Trunks for inter-VLAN routing.

  1. Create and Name VLANs on both switches.
        VLAN 10: HR
        VLAN 20: FINANCE
  2. Configure the switch ports connecting to PCsConfigure 802.1q trunk between SW1 and SW2 and allow the necessary VLANs..
  3. Configure the link between SW1 and SW2.
  4. Configure the G0/1 port of SW1 connected to R1.

Solution:

Task 1: Create and Name VLANs on both switches.
VLAN 10: HR
VLAN 20: FINANCE

Configure VLAN 10 and name it HR and VLAN 20 and name it Finance on both switches.

On SW1:

SW1# configure terminal
SW1(config)# vlan 10
SW1(config-vlan)# name HR
SW1(config-vlan)# vlan 20
SW1(config-vlan)# name FINANCE
SW1(config-vlan)# exit

On SW2:

SW2# configure terminal
SW2(config)# vlan 10
SW2(config-vlan)# name HR
SW2(config-vlan)# vlan 20
SW2(config-vlan)# name FINANCE
SW2(config-vlan)# exit

 

Task 2: Configure the switch ports connecting to PCs.

Assign ports Fa0/1 and  Fa0/2 on SW1 to VLAN 10 and VLAN 20 respectively. Assign port Fa0/1 on SW2 to VLAN 20 (Finance).

On SW1:

SW1(config)# interface f0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config)# interface f0/2
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 20

On SW2:

SW2(config)# interface f0/1
SW2(config-if)# switchport mode access
SW2(config-if)# switchport access vlan 20

 

Task 3: Configure the link between SW1 and SW2.

We need to configure the link between SW1 and SW2 as a trunk link and so that it can carry traffic from both VLAN 10 (HR) and VLAN 20 (FINANCE).

On SW1:

SW1(config-if)# interface f0/24
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20

On SW2:

SW2(config-if)# interface f0/24
SW2(config-if)# switchport mode trunk
SW2(config-if)# switchport trunk allowed vlan 10,20

switchport trunk encapsulation dot1q command is not used here because dot1q encapsulation is the default on most modern switches, which do not support ISL encapsulation. However, if the switch in the actual exam supports ISL, you will need to use this command.

 

Task 4: Configure the G0/1 port of SW1 connected to R1.

We need to configure the G0/1 port of SW1 as a trunk link to ensure that traffic from both VLANs can reach R1. R1 will then perform inter-VLAN routing, enabling traffic to be sent from one VLAN to the other.

On SW1:

SW1(config-if)# interface g0/1
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20

Now exit the configuration mode and save the configuration.

SW1(config-if)# end
SW1# write memory

SW2(config-if)# end
SW2# write memory

Verification:

Verify VLAN and Trunk configurations using:

SW1# show vlan brief
SW1# show interfaces trunk

 

Packet Tracer File

Clicking this button will begin the download of a ZIP file. Inside the ZIP file, you'll find a Packet Tracer Activity (.pka) file, which will automatically track your progress as you configure the network.