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 Fields

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.

When you want VLAN traffic between two switches then there is one problem we run into...take a look at the image below: 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 somet



If you want to VLAN traffic between switches we have to use a trunk. A trunk connection is simply said nothing more but 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 to understand 802.1Q.

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

Tags: ,


Forum Replies

  1. Hi Laz,

    Thank you very much for your reply. It really helped.

    Regards,
    Abc

  2. Hello Azm

    Here is the topology that you described.

    //cdn-forum.networklessons.com/uploads/default/original/1X/f0c5057a55ecdd55faa8e073c49a468a787cebb0.png

    Except for the labeling in the diagram, the network has the following elements:

    • VLAN 10 subnet is 10.10.10.0/24
    • Host A has a default gateway of 10.10.10.1
    • VLAN 20 subnet is 10.10.20.0/24
    • Host B has a default gateway of 10.10.20.1
    • Both Switch 1 and Switch 2 are layer 3 switches
    • We assume that no additional SVIs or routed ports are configured on either switch.

    Keep in mind that the order of operations of MAC

    ... Continue reading in our forum

  3. Hello Laz,
    EXCELLENT. This has been really helpful and thank you so much for your time.

    Azm

  4. Hello Laz,
    I am sorry for asking you so many questions. One more question.

    //cdn-forum.networklessons.com/uploads/default/original/1X/7b00da72ef9d195e002c531a081af3b8f04887ad.png

    When I am doing a traceroute from 10.10.10.10 to 10.20.20.20. I am getting the below result.

    //cdn-forum.networklessons.com/uploads/default/original/1X/249a9f64348ec47e9e9c35619c2ba9b3b6b9db76.png

    When I am doing a traceroute from 10.20.20.20 to 10.10.10.10, I am getting the below result:

    //cdn-forum.networklessons.com/uploads/default/original/1X/5cb7dcbdbcf575876fb96e9f8b1f70f3792b83

    ... Continue reading in our forum

  5. Hello Laz,
    Got it. Great and accurate explanation once again. Thank you so much.

    Azm

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