encapsulation dot1Q [vlan-id]
Configures IEEE 802.1Q VLAN encapsulation on a subinterface to enable trunking and route traffic for a specific VLAN.
encapsulation dot1Q [vlan-id]When to Use This Command
- Router-on-a-stick inter-VLAN routing: configure a subinterface on a router trunk link to route between VLANs.
- Connecting a router to a switch trunk port to provide Layer 3 gateway for multiple VLANs.
- Segmenting traffic on a WAN link by assigning different VLANs to different subinterfaces.
- Enabling VLAN tagging on a subinterface for a specific VLAN ID to match incoming frames.
Command Examples
Basic VLAN encapsulation on subinterface
interface GigabitEthernet0/0.10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0Router(config)# interface GigabitEthernet0/0.10 Router(config-subif)# encapsulation dot1Q 10 Router(config-subif)# ip address 192.168.10.1 255.255.255.0 Router(config-subif)# end Router# show running-config interface GigabitEthernet0/0.10 Building configuration... Current configuration : 107 bytes ! interface GigabitEthernet0/0.10 encapsulation dot1Q 10 ip address 192.168.10.1 255.255.255.0 end
The subinterface GigabitEthernet0/0.10 is created. 'encapsulation dot1Q 10' tells the router to accept and send frames tagged with VLAN 10. The IP address 192.168.10.1/24 is assigned as the default gateway for VLAN 10 hosts.
Native VLAN encapsulation
interface GigabitEthernet0/0.100
encapsulation dot1Q 100 native
ip address 192.168.100.1 255.255.255.0Router(config)# interface GigabitEthernet0/0.100 Router(config-subif)# encapsulation dot1Q 100 native Router(config-subif)# ip address 192.168.100.1 255.255.255.0 Router(config-subif)# end Router# show running-config interface GigabitEthernet0/0.100 Building configuration... Current configuration : 118 bytes ! interface GigabitEthernet0/0.100 encapsulation dot1Q 100 native ip address 192.168.100.1 255.255.255.0 end
The 'native' keyword indicates that VLAN 100 is the native VLAN. Frames for this VLAN are sent untagged on the trunk. The router expects untagged frames on this subinterface. The IP address 192.168.100.1/24 is assigned.
Understanding the Output
The output from 'show running-config interface [subinterface]' displays the configuration lines. The 'encapsulation dot1Q [vlan-id]' line shows the VLAN ID assigned to the subinterface. If 'native' appears, it means the subinterface handles the native VLAN (untagged frames). The IP address line shows the Layer 3 gateway for that VLAN. In a production network, you should verify that the VLAN ID matches the switch trunk allowed VLAN list. A common issue is mismatched VLAN IDs between router and switch, causing connectivity loss. Also, ensure the native VLAN is consistent on both ends to avoid VLAN hopping or misrouting.
CCNA Exam Tips
CCNA 200-301: Remember that 'encapsulation dot1Q' is only used on subinterfaces, not on physical interfaces.
CCNA 200-301: The native VLAN must match on both ends of a trunk; use the 'native' keyword on the router subinterface.
CCNA 200-301: You can configure multiple subinterfaces on one physical interface, each with a different VLAN ID.
CCNA 200-301: The VLAN ID range is 1-4094; VLANs 1002-1005 are reserved and cannot be used.
Common Mistakes
Mistake 1: Applying 'encapsulation dot1Q' to a physical interface instead of a subinterface — results in an error.
Mistake 2: Forgetting to configure the native VLAN on the router subinterface when the switch trunk uses a non-default native VLAN — causes untagged frames to be dropped.
Mistake 3: Using the same VLAN ID on multiple subinterfaces of the same physical interface — only one subinterface per VLAN is allowed.
Related Commands
show interfaces trunk
Displays trunk interface status, allowed VLANs, and pruning information for all trunk ports on a Cisco switch, used to verify trunking configuration and VLAN membership.
show vlan
Displays the current VLAN configuration on the switch, including VLAN IDs, names, status, and ports assigned to each VLAN, used to verify VLAN creation and port assignments.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions