Watch on Instagram

Network Bytes · Episode 31 · CCNA 2.2

Trunk ports and 802.1Q tags

One cable between two switches can carry many VLANs. A trunk port tags each frame with a 4-byte 802.1Q tag that says which VLAN it belongs to.

Posted · About a 1 minute watch, 3 minute read · Take the quiz

One cable per VLAN gets messy

VLANs split one switch into separate networks (see EP30). But offices rarely have just one switch. If VLAN 10 and VLAN 20 both live on two switches, frames for each VLAN have to cross between them.

You could run one cable per VLAN. With two VLANs that's two cables; with ten VLANs it's ten cables, and ten ports used up on each switch. It doesn't scale.

Instead, you configure the link between the switches as a trunk. A trunk port carries frames from many VLANs over a single cable. By default, a Cisco trunk allows all VLANs, and you can limit it to the ones you need.

The ports your devices plug into are access ports. An access port belongs to one VLAN and sends ordinary, untagged frames, so your laptop never knows VLANs exist.

The 802.1Q tag: a luggage label for frames

With many VLANs on one cable, the far switch needs to know which VLAN each frame belongs to. So the sending switch inserts a small tag into the Ethernet frame, like a luggage label. The standard for this is IEEE 802.1Q.

The tag is 4 bytes, inserted between the source MAC address and the EtherType field:

  • 2 bytes of TPID (0x8100), which marks the frame as tagged
  • priority and DEI bits
  • a 12-bit VLAN ID, which allows VLANs 1-4094

Read, remove, deliver

The receiving switch reads the VLAN ID in the tag, removes the tag, and forwards the frame only out of ports in that VLAN (or on to another trunk, tagged again). A frame tagged VLAN 20 never reaches a VLAN 10 port.

One exception to "every frame is tagged": frames in the trunk's native VLAN (VLAN 1 by default on Cisco) cross the trunk untagged, and both ends of the trunk should agree on which VLAN that is.

Try it yourself

If you have Cisco Packet Tracer (free with a Cisco Networking Academy account), connect two switches, set the link between them to a trunk with switchport mode trunk, then run show interfaces trunk. You'll see the trunk port, its native VLAN and the list of VLANs allowed across it.

Good to know

  • IEEE 802.1Q inserts a 4-byte tag (2-byte TPID 0x8100 plus priority, DEI and a 12-bit VLAN ID, giving VLANs 1-4094) between the source MAC and the EtherType.
  • Simplified in the video: frames in the trunk's native VLAN (VLAN 1 by default on Cisco) cross the trunk untagged, and both ends should agree on it.
  • Access ports carry one VLAN and send untagged frames to end devices. Voice VLANs on IP-phone ports are an exception.
  • Cisco's older ISL trunking is obsolete and not on the CCNA.

For CCNA learners

This lines up with CCNA 200-301 exam topic 2.2, configure and verify interswitch connectivity: know that trunks carry many VLANs using 802.1Q tags, that the native VLAN is untagged, and how to check a trunk with show interfaces trunk.

Answer to the comment question

40 bytes. Each 802.1Q tag is 4 bytes, so 10 tagged frames carry 4 × 10 = 40 bytes of tags. That's tiny next to the frames themselves, which is why tagging costs almost nothing.

Test your knowledge

Quick quiz: Trunk ports and 802.1Q tags

4 multiple-choice questions. Pick one answer for each, then check how you did.

1What does a trunk port do?
2How big is an 802.1Q tag?
3What does the receiving switch do with a tagged frame?
4Which frames cross a Cisco 802.1Q trunk untagged?

Sources

Video transcript

How does one cable carry ten VLANs?

You could run one cable per VLAN between two switches. But with ten VLANs, that's ten cables and ten ports used up on each switch. Messy.

Instead, you set up one link as a trunk. A trunk port carries frames from many VLANs over a single cable.

To keep them apart, the sending switch sticks a small tag on each frame, like a luggage label, saying which VLAN it belongs to. The standard is 802.1Q, and the tag is just four bytes.

The other switch reads the label, removes it, and delivers the frame only to ports in that VLAN. Your laptop's access port never sees tags.

Each tag is four bytes. If ten frames cross the trunk, how many bytes of tags is that? Comment your answer below!

That's your byte.

More from Network Bytes

All Network Bytes lessons