Interface

encapsulation dot1Q <vlan>

Tag the subinterface with this VLAN ID. Must match the trunk's allowed VLAN.

Works on: Router, FirewallMode: iface
Watch out

The switch sends its trunk's native VLAN untagged, so the subinterface for that VLAN needs 'encapsulation dot1Q <vlan> native' (or the address goes on the physical port). An address on the physical port never answers a tagged VLAN.

Run this command live

Don't just read it — type encapsulation dot1Q <vlan> in a real network simulator in your browser and watch it take effect. No install, no account needed to start.

Open the lab

Frequently asked

What does the "encapsulation dot1Q <vlan>" command do?

Tag the subinterface with this VLAN ID. Must match the trunk's allowed VLAN.

What's the common gotcha with "encapsulation dot1Q <vlan>"?

The switch sends its trunk's native VLAN untagged, so the subinterface for that VLAN needs 'encapsulation dot1Q <vlan> native' (or the address goes on the physical port). An address on the physical port never answers a tagged VLAN.

More Interface commands

← Back to the full command reference