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.

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 lesson that I wrote earlier. It explains how to configure trunks on Cisco Catalyst switches.

Tags: ,

Forum Replies

  1. Hello Azm

    Here is the topology that you described.


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

    • VLAN 10 subnet is
    • Host A has a default gateway of
    • VLAN 20 subnet is
    • Host B has a default gateway of
    • 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

  2. Hello Azm.

    The order of operations will always be in the same order as the de-encapsulation that occurs when the switch receives the frame. Let’s go through the process assuming that the SVIs for VLAN 10 and VLAN 20 are both configured on Switch 1.

    Host A sends a packet to Host B

    1. Host A encapsulates the packet at the Network layer (layer 3) with a destination IP address of
    2. To encapsulate the Data link layer (layer 2), it has to find the destination MAC address. Because the destination IP address is in a different subnet, and because MAC addresses
    ... Continue reading in our forum

  3. Hello again AZM!

    The process will be much the same, however, in this case, Host A will have a default gateway of and Host B will have a default gateway of Each of these IP addresses correspond to the MAC address of the currently active router. So it is this MAC address that will be placed in the destination MAC address field. Let’s look at it step by step.

    1. Host A prepares a packet with destination IP address It is on a different subnet, so when encapsulating, the destination MAC will be that of the default gateway (10
    ... Continue reading in our forum

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


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


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


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


    ... Continue reading in our forum

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