IEEE 802.1Q Frame Format
Introduction
This document describes VLAN frame format and QinQ packet encapsulation format.
VLAN Frame Format
A switch identifies packets from different VLANs according to the information contained in its VLAN tags. IEEE 802.1Q adds a 4-byte VLAN tag between the Source/Destination MAC address and Length/Type fields of an Ethernet frame to identify the VLAN to which the frame belongs. Figure 1-1 shows the position of a VLAN tag in a VLAN data frame.
The following are the two types of Ethernet frames in a VLAN:
Tagged frame: frame with a 4-byte VLAN tag
Untagged frame: frame without a 4-byte VLAN tag
There are two main types of Ethernet links: access links (transmit untagged frames) and trunk links (transmit tagged frames). The two link types differ in the number of VLANs they can carry traffic for: an access link can carry traffic for only one VLAN, and therefore usually connects a switch to a user terminal, such as a host, a server, or an unmanaged switch; a trunk link can carry traffic for multiple VLANs, and as such usually connects a switch to another switch or a router. The frames transmitted on an access link are untagged frames, and the frames transmitted on a trunk link are tagged frames.
All frames processed on a switch carry VLAN tags. After receiving an untagged frame from a user terminal, the switch adds a VLAN tag to the frame, recalculates the frame check sequence (FCS), and then transmits the frame through a trunk link. Before sending the frame to a user terminal, the switch removes the VLAN tag, and sends the untagged frame to the terminal through an access link.
A VLAN tag contains four fields. Table 1 describes the fields.
Field |
Length |
Description |
Value |
---|---|---|---|
TPID |
2 bytes |
Tag Protocol Identifier (TPID), indicating the frame type. |
The value 0x8100 indicates an IEEE 802.1Q frame. An 802.1Q-incapable device discards 802.1Q frames. Device vendors can define their own TPID values, and users can then change the value to realize interconnection of devices from different vendors. |
PRI |
3 bits |
Priority (PRI), indicating the 802.1p priority of a frame. |
The value is in the range from 0 to 7. A larger value indicates a higher priority. If congestion occurs, the switch sends packets with the highest priority first. |
CFI |
1 bit |
Canonical Format Indicator (CFI), indicating whether a MAC address is encapsulated in canonical format over different transmission media. CFI is used to ensure compatibility between Ethernet and token ring networks. |
The value 0 indicates that the MAC address is encapsulated in canonical format, and the value 1 indicates that the MAC address is encapsulated in non-canonical format. The CFI field has a fixed value of 0 on Ethernet networks. |
VID |
12 bits |
VLAN ID (VID), indicating the VLAN to which a frame belongs. |
The VLAN ID is in the range from 0 to 4095. The values 0 and 4095 are reserved, and therefore available VLAN IDs are in the range from 1 to 4094. |
QinQ Packet Encapsulation Format
However, because the 12-bit VLAN tag field defined in IEEE 802.1Q identifies a maximum of 4096 VLANs, the number of users that 802.1Q VLANs can identify and isolate on metro Ethernet networks (MANs) is insufficient. To address this issue, QinQ is developed to expand VLAN space beyond 4096 VLANs so that a larger number of users can be identified on MANs. QinQ is developed to expand VLAN space by adding an additional 802.1Q tag to an 802.1Q packet. This increases the number of VLANs to 4094 x 4094.
The switch forwards packets over a public network according to the outer VLAN tag carried in the packets, and learns MAC addresses from the outer VLAN tag. The inner VLAN tag in the packets is forwarded as payload of the packets. QinQ is applied in scenarios other than simply to expand VLAN space. For example, because the inner and outer VLAN tags can be used to differentiate packets based on users and services, the inner tag can represent a user and the outer tag can represent a service.
Frame Size
The maximum frame length allowed by each interface on a carrier network should be at least 1504 bytes to accommodate the additional length of QinQ packets compared with 802.1Q packets. By default, the maximum frame length allowed on a switch is larger than 1504 bytes and so does not require modification.
TPID
Different carriers may use different TPID values in outer VLAN tags of QinQ frames. To ensure that QinQ frames sent from a Huawei device can be transmitted across a carrier network, set the TPID value to that used by the carrier. Table 1-2 provides some of the common protocol types and their TPID values, which should not be used in such cases.
Related Information
Related Documents
S1720, S2700, S5700, S6720 V200R011C10 Configuration Guide - Ethernet Switching -VLAN Configuration
Query Tool