802.1Q Trunking

1. Introduction to 802.1Q Trunking

VLAN Tagging and Frame Handling

When a switch processes traffic from a VLAN, it adds a VLAN tag to Ethernet frames as they traverse a trunk port. This tag ensures that devices in the same VLAN, even if connected to different switches, can communicate.

Here’s what happens step by step:

VLAN Tagging
  1. Tagging VLAN Frames:
    If a device in VLAN 10 (HR) in Building A sends traffic to another device in VLAN 10 in Building B, the switch in Building A tags the frame with VLAN 10 before sending it through the trunk link.
  2. Forwarding Traffic Within the VLAN:
    The switch in Building B receives the tagged frame, checks the VLAN ID, and forwards the traffic only to ports assigned to VLAN 10.
  3. Using Trunk Ports:
    A trunk port is essential for carrying traffic from multiple VLANs across a single physical link. This allows VLANs from both buildings to communicate efficiently without needing separate physical cables for each VLAN.

Why Use Trunking?

Imagine an organization with two buildings:

  • Building A houses the HR and Sales departments.
  • Building B also houses HR and Sales, but on different floors.

The network in each building uses a switch, and both buildings are connected via a trunk link to allow HR and Sales VLANs to communicate between buildings.

Without trunking, you would need separate physical links for each VLAN, which is inefficient and impractical. Trunking solves this by tagging VLAN traffic and carrying it over a single link.

2. Configuring 802.1Q Trunking

VLAN Tagging 1

Configuring Trunk Ports

Configuring the Trunk Port on SW1 (Building A)

  1. Enter configuration mode:
SW1# configure terminal

2. Select the trunk interface (G0/3):

SW1(config)# interface G0/3

3. Set the encapsulation to 802.1Q:

SW1(config-if)# switchport trunk encapsulation dot1q

4. Set the port to trunk mode:

 
SW1(config-if)# switchport mode trunk
  1. (Optional) Specify the allowed VLANs on the trunk:
    If you want to restrict the trunk to only specific VLANs (example VLANs 10 and 20):
 
SW1(config-if)# switchport trunk allowed vlan 10,20

Verifying the Trunk Port Configuration

Use the show interfaces trunk command to verify that the trunk port is active and configured correctly:

 
SW1# show interfaces trunk

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

Port        Vlans allowed on trunk
G0/3        10,20

Port        Vlans in spanning tree forwarding state and not pruned
G0/3        10,20

Configuring the Trunk Port on SW2 (Building B)

Now, let’s configure the trunk port on the switch in Building B (SW2), which connects to the trunk on SW1.

  1. Enter configuration mode:
 
SW2# configure terminal

2. Select the trunk interface (G0/3):

 
SW2(config)# interface G0/3

3. Set the encapsulation to 802.1Q:

 
SW2(config-if)# switchport trunk encapsulation dot1q

4. Set the port to trunk mode:

 
SW2(config-if)# switchport mode trunk

5. (Optional) Specify the allowed VLANs on the trunk:

 
SW2(config-if)# switchport trunk allowed vlan 10,20

Verifying the Trunk Port Configuration

To ensure the trunk port is active and configured correctly, use the show interfaces trunk command on SW2:

 
SW2# show interfaces trunk

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

Port        Vlans allowed on trunk
G0/3        10,20

Port        Vlans in spanning tree forwarding state and not pruned
G0/3        10,20

Now that we’ve successfully configured a trunk port and ensured it’s functioning correctly, the next step is to explore the Native VLAN, its role in trunking, and how to configure it effectively.

For more information :

https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst1000/software/releases/15_2_7_e/configuration_guides/vlan/b_1527e_vlan_c1000_cg/configuring_vlan_trunks.pdf