802.1Q Encapsulation Explained

When you want VLAN traffic between two switches, then there is one problem we run into…take a look at the image below:

Ethernet Frame 8023

This is a normal Ethernet frame…do you see any field where we can specify to which VLAN our Ethernet frame belongs? Well, there isn’t! So how does a switch know to what VLAN something belongs when it receives a frame? It has no clue so that’s why we need another protocol to help us.




If you want to VLAN traffic between switches, we have to use a trunk. A trunk connection is simply said nothing more than a normal link, but it is able to pass traffic from different VLANs and has a method to separate traffic between VLANs. Here’s an example:

 

802.1q trunk example

As you can see, we have computers on both sides, and they are in different VLANs, by using trunks, we can make sure all VLAN traffic can be sent between the switches. Because our regular Ethernet frames don’t have anything to show to which VLAN they belong, we will need another protocol.

There are two trunking protocols:

  • 802.1Q: This is the most common trunking protocol. It’s a standard and supported by many vendors.
  • ISL: This is the Cisco trunking protocol. Not all switches support it.

Let’s take a look at 802.1Q:

802.1q Frame Headers

Here’s an example of an 802.1Q Ethernet frame. As you can see, it’s the same as a normal Ethernet frame, but we have added a tag in the middle (that’s the blue field). In our tag, you will find a “VLAN identifier”, which is the VLAN to which this Ethernet frame belongs. This is how switches know to which VLAN our traffic belongs.

There’s also a field called “Priority” which is how we can give a different priority to the different types of traffic. This is useful when you have one VLAN for voice over IP traffic and another VLAN for data traffic, you probably want to give the VoIP traffic priority, or your call quality might suffer.

I hope this has been helpful in understanding 802.1Q.

If you want to know how to configure trunks…take a look at this lesson that I wrote earlier. It explains how to configure trunks on Cisco Catalyst switches.

Tags: ,


Forum Replies

  1. so nice simply u r network genious… thanku sir…

  2. Hi René,

    I would like to thank you for the great content porvided. Good job !

    i am a little be confused about tagging, so my question is :

    Where the frame is tagged :

    1. At the entry of the switch port wich is assigned to a vlan with the " switchport acces " command
    2. Or when it lives the switch on the trunk port command

    thks in advance

  3. Hi Abdelwahid,

    The switch will tag the frame when it leaves the trunk. Internally, there’s no need to tag frames. In the MAC address table the switch will keep track of MAC addresses, interfaces but also the VLANs.

    Hope that helps!

    Rene

  4. Yes indeed, it helps a lot

    Many thanks René :slight_smile:

  5. Hi Rene,
    Can you please share your posts that explain Q-in-Q?

    Thanks,
    Srini

76 more replies! Ask a question or join the discussion by visiting our Community Forum