The vlan-type dot1q command associates an Ethernet sub-interface with VLANs and configures the VLAN encapsulation type for the Ethernet sub-interface as dot1q.
The undo vlan-type dot1q command cancels the VLAN encapsulation of the Ethernet sub-interface.
By default, an Ethernet sub-interface is not encapsulated with VLAN. The VLAN ID associated with an Ethernet sub-interface does not exist.
| Parameter | Description | Value |
|---|---|---|
| vlan-id | Specifies an ID of the VLAN to which an interface belongs. |
The value is an integer ranging from 1 to 4094. |
Usage Scenario
When a Layer 3 device and a Layer 2 device are directly connected through Ethernet interfaces, and the Ethernet interfaces are added to specific VLANs, you need to configure the VLAN encapsulation type for the Ethernet sub-interface on the Layer 3 device to ensure that the two devices normally communicate with each other. You can run the vlan-type dot1q command to associate the Ethernet sub-interface with VLANs and configure the VLAN encapsulation type for the Ethernet sub-interface.
Precautions
Sub-interfaces of different main interfaces can be encapsulated with the same VLAN ID. However, sub-interfaces of the same main interface cannot be encapsulated with the same VLAN ID.
If the sub-interface has been configured with the dot1q, you cannot run the vlan-type dot1q command.
<sysname> system-view
[sysname] interface gigabitethernet2/0/0.1
[sysname-GigabitEthernet2/0/0.1] vlan-type dot1q 60
# Set the VLAN ID to 4094 in the Eth-Trunk sub-interface view and specify the VLAN encapsulation mode.
<sysname> system-view
[sysname] interface eth-trunk 3
[sysname-Eth-Trunk3] quit
[sysname] interface eth-trunk 3.3
[sysname-Eth-Trunk3.3] vlan-type dot1q 4094