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 Rene

    Please can you advise what I can do, I am trying to create vlan 50 on this switch and keep getting following

    SW1(config)#vlan 50
    VTP VLAN configuration not allowed when device is not the primary server for vlan database.
    
    SW1#sh vtp status
    VTP Version : 3 (capable)
    VTP version running : 3
    VTP Domain Name : CCIE-domain
    VTP Pruning Mode : Disabled (Operationally Disabled)
    VTP Traps Generation : Disabled
    Device ID : aabb.cc00.0700
    
    Feature VLAN:
    --------------
    VTP Operating Mode : Server
    Number of existing VLANs : 8
    Number of existing e
    ... Continue reading in our forum

  2. Hi Mohamed,

    There are two trunking protocols, 802.1q and ISL. Some newer switches only support 802.1Q and in that case this command will be unavailable.

    It’s also possible that packet tracer doesn’t support it, it’s a simulator after all. It doesn’t matter too much though…when this command doesn’t work then the switch will use 802.1Q when you configure the interface as a trunk.

    Rene

  3. Thanks, I will give it a go, I have not done that. I was speaking to a guy in my office and he was explaining that, although I had added VLAN 50, at layer 2 level. I would still need to give the VLAN an address to allow layer 3 routing.

  4. I have got it to work with the suggestions made, the mistake I made was not entering int vlan 50 as I was entering vlan 50 on its own and then trying to add the ip address which fails.

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