The encapsulation command configures the encapsulation mode of packets allowed to pass a Layer 2 sub-interface.
The undo encapsulation command deletes the encapsulation mode of packets allowed to pass a Layer 2 sub-interface.
By default, the encapsulation mode of packets allowed to pass a Layer 2 sub-interface is not configured.
encapsulation { dot1q vid low-pe-vid [ to high-pe-vid ] | default | untag | qinq vid low-vlan-vid [ to high-vlan-vid ] ce-vid low-ce-vid [ to high-ce-vid ] }
undo encapsulation { dot1q vid low-pe-vid [ to high-pe-vid ] | default | untag | qinq vid low-vlan-vid [ to high-vlan-vid ] ce-vid low-ce-vid [ to high-ce-vid ] }
Parameter | Description | Value |
---|---|---|
dot1q |
Sets encapsulation mode of packets allowed to pass a Layer 2 sub-interface to Dot1q. This mode enables a Layer 2 sub-interface to receive packets with a VLAN tag. |
- |
vid low-pe-vid [ to high-pe-vid ] |
Specifies the outer VLAN ID in packets allowed to pass a Layer 2 sub-interface in Dot1q encapsulation mode.
|
The value is an integer that ranges from 2 to 4094. |
default |
Sets the encapsulation mode of packets allowed to pass a Layer 2 sub-interface to default. This mode enables a Layer 2 sub-interface to receive all packets, regardless of whether they contain VLAN tags. |
- |
untag |
Sets the encapsulation mode of packets allowed to pass a Layer 2 sub-interface to untag. This mode enables a Layer 2 sub-interface to receive packets without VLAN tags. |
- |
qinq |
Sets encapsulation mode of packets allowed to pass a Layer 2 sub-interface to QinQ. This mode enables a Layer 2 sub-interface to receive packets with double VLAN tags. |
- |
vid low-vlan-vid [ to high-vlan-vid ] |
Specifies the outer VLAN ID in double-tagged packets allowed to pass a Layer 2 sub-interface in QinQ encapsulation mode.
|
The value is an integer that ranges from 2 to 4094. |
ce-vid low-ce-vid [ to high-ce-vid ] |
Specifies the inner VLAN ID in double-tagged packets allowed to pass a Layer 2 sub-interface in QinQ encapsulation mode.
|
The value is an integer that ranges from 1 to 4094. |
Usage Scenario
On a VXLAN network, a Layer 2 sub-interface functions as a VXLAN service access point to forward data packets in a BD.
Packets passing through a physical interface may contain one or two VLAN tags or no VLAN tag. After you run the encapsulation command in a Layer 2 sub-interface view to configure the encapsulation mode, the sub-interface can forward only specified types of packets.
Prerequisites
Run the command interface interface-type interface-number.subnum mode l2 to create a VXLAN Layer 2 sub-interface
Precautions
When configuring an encapsulation mode on a Layer 2 sub-interface, pay attention to the following points:
The VLAN ID in dot1q mode or outer VLAN ID in qinq mode cannot be the same as the allowed VLAN of the corresponding main interface or the global VLAN.
On the same main interface, the VLAN ID in dot1q mode and the outer VLAN ID in qinq mode must be different.
After NAC authentication is configured on the main interface, the traffic encapsulation type on a Layer 2 sub-interface cannot be set to default.
When the encapsulation mode of a Layer 2 sub-interface is default, the corresponding main interface cannot be added to any VLAN, including VLAN 1.
Before the encapsulation mode of a Layer 2 sub-interface is set to default, the main interface has only one sub-interface.
After the encapsulation mode of a Layer 2 sub-interface is set to default, no other sub-interface can be created on the main interface.
When the encapsulation mode of a Layer 2 sub-interface is set to untag, the corresponding main interface cannot be added to VLAN 1, and other sub-interfaces of the main interface cannot be set to untag.
You can configure only one encapsulation mode for each Layer 2 sub-interface. If an encapsulation mode has been configured for a Layer 2 sub-interface, run the undo encapsulation command to delete the original mode before you configure another mode.
<HUAWEI> system-view [HUAWEI] interface GigabitEthernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type hybrid [HUAWEI-GigabitEthernet0/0/1] quit [HUAWEI] interface gigabitethernet 0/0/1.1 mode l2 [HUAWEI-GigabitEthernet0/0/1.1] encapsulation dot1q vid 10