FaizanTech Core

Vlan and trunking

What Is VLAN and Trunking in Networking? Beginner’s Guide

In the modern era of networking, where security, scalability, and efficiency are essential, VLAN trunking stands as a crucial concept. Whether you’re a beginner or brushing up your knowledge, understanding what VLAN is in networking and how VLAN trunking works can transform how you design and manage your networks.

In this comprehensive guide, we’ll cover everything you need to know — from VLAN trunking protocol, VLAN tagging, trunk vs access port, to step-by-step VLAN trunk configuration on Cisco switches

Table of Contents

What is VLAN in Networking?

VLAN Definition

VLAN stands for Virtual Local Area Network. It’s a technology that allows network administrators to segment a single physical network into multiple logical networks. Devices within the same VLAN can communicate with each other as if they were on the same physical LAN — even if they are not.

VLANs provide better security by isolating groups of devices, reduce unnecessary broadcast traffic, and make networks easier to manage. Inter-VLAN communication requires a router or Layer-3 switch. Access ports connect end devices to one VLAN, while trunk ports carry multiple VLANs across switches. VLANs are essential in modern enterprise networks for scalability and flexibility.

Learn more here: Cisco Networking Academy – VLANs

How VLANs Work

VLANs work by tagging Ethernet frames with a VLAN ID (VID), enabling switches to identify which VLAN the traffic belongs to. VLANs provide network segmentation, enhanced security, and better management of broadcast domains.

For example, an organization can create separate VLANs for HR, Finance, and Sales — isolating traffic and boosting security without needing separate physical switches.

Trunk Port and Access Port

Before diving into VLAN trunking, it’s important to understand the difference between a trunk port and an access port.

Access Port

Connects a switch to an end device (like a PC).

Carries traffic for only one VLAN.

Used primarily for client devices.

Trunk Port

  • Connects switches to other switches or routers.
  • Carries traffic for multiple VLANs simultaneously.
  • Uses VLAN tagging to identify the VLAN of each frame.

💡 Trunk vs Access Port is a common area of confusion. Remember: Access ports = single VLAN, Trunk ports = multiple VLANs.

What is VLAN Trunking?

VLAN trunking is the method of carrying traffic from multiple VLANs over a single physical link between networking devices. It’s essential in large networks where multiple switches need to communicate VLAN-tagged traffic efficiently.

Instead of using a separate cable for each VLAN, a trunk port allows one cable to carry traffic for several VLANs.

Why VLAN Trunking is Important

Efficient use of cabling

Simplifies network design

Supports inter-switch communication for VLANs

Essential for routing between VLANs (Inter-VLAN Routing)

VLAN Tagging Explained with Example

When traffic traverses a trunk link, each Ethernet frame is tagged with a VLAN ID (VID) so that the receiving device knows which VLAN it belongs to.

802.1Q Tagging

hen traffic traverses a trunk link, each Ethernet frame is tagged with a VLAN ID (VID) so that the receiving device knows which VLAN it belongs to.

802.1Q Tagging

802.1Q is the most widely used VLAN trunking protocol. It adds a 4-byte tag to the Ethernet frame containing:

  • TPID (Tag Protocol Identifier): Identifies the frame as 802.1Q-tagged.
  • VID (VLAN Identifier): Identifies the VLAN (range: 1–4094).
  • PCP (Priority Code Point): For Quality of Service (QoS).
  • DEI (Drop Eligible Indicator)

Native VLAN Explained

The Native VLAN is the VLAN that does not get a tag when traversing a trunk port. By default, the native VLAN is VLAN 1

Why Native VLAN Matters

Provides backward compatibility with devices that don’t understand tagging.

Misconfigurations in native VLANs can lead to VLAN hopping attacks — a security risk where attackers gain unauthorized access to VLANs.

Best Practice: Change the native VLAN from default (VLAN 1) to a non-production VLAN.

How to Configure VLAN Trunking on Cisco Switch

Now let’s get hands-on with the Cisco VLAN trunk setup using CLI.

Step-by-Step VLAN Trunking Tutorial

Switch(config)# vlan 10
Switch(config-vlan)# name HR
Switch(config-vlan)# exit

Switch(config)# vlan 20
Switch(config-vlan)# name Finance
Switch(config-vlan)# exit

Configure Trunk Port

Switch(config)# interface GigabitEthernet0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan 10,20
Switch(config-if)# switchport trunk native vlan 99
Switch(config-if)# exit

Explanation:

switchport mode trunk: Sets the port as a VLAN trunk port.

switchport trunk allowed vlan 10,20: Allows only VLAN 10 and 20 on the trunk.

switchport trunk native vlan 99: Changes the native VLAN for better security.

Use show interfaces trunk to verify trunk settings.

Common VLAN Trunking Mistakes and How to Avoid Them

Mismatch in trunk configuration between switches.

Incorrect native VLAN settings.

Forgetting to allow specific VLANs on trunk links.

Assuming access ports support multiple VLANs — they don’t!

Using VLAN 1 as native VLAN — a common security flaw.

How Trunk Ports Carry Multiple VLANs

Trunk ports use 802.1Q tagging to multiplex traffic from different VLANs. Each frame gets a tag added before being sent over the trunk, and the receiving switch reads the tag to route the frame appropriately.

VLAN Frame Flow:

  1. Host in VLAN 10 sends a frame.
  2. Switch tags the frame with VLAN 10 VID.
  3. Frame is sent across the trunk link.
  4. Receiving switch removes the tag and forwards based on VLAN.
  5. Trunk links handle Ethernet frames with tags, while access ports only handle untagged frames.

Thanks to VLAN trunking, you can connect switches over a single Ethernet cable and carry traffic for multiple VLANs like:

  • VLAN 10 (HR)
  • VLAN 20 (Finance)
  • VLAN 30 (Sales)
  • VLAN 40 (IT)

This dramatically reduces cabling, simplifies troubleshooting, and enhances scalability.

VLAN Trunking for Beginners: Quick Recap

ConceptDescription
VLANLogical grouping of devices for network segmentation.
Access PortConnects end devices; carries one VLAN.
Trunk PortConnects switches/routers; carries multiple VLANs.
VLAN TaggingAdds VLAN ID to Ethernet frames.
802.1QIndustry-standard VLAN trunking protocol.
Native VLANUntagged VLAN on a trunk port.
Allowed VLANsVLANs permitted on a trunk link.

VLAN Trunking Explained With Real-World Example

Imagine a company with four departments across three floors. Using VLAN trunking:

  • Each floor has a switch.
  • All switches are connected via trunk ports.
  • HR VLAN (10) exists across all floors.
  • Employees can move floors without changing their VLAN.
  • One trunk link = multiple VLANs = reduced cabling and better manageability.

VLAN Tagging and Security

Using VLANs and trunking enhances security by:

  • Isolating sensitive data (e.g., finance VLAN)
  • Reducing broadcast traffic
  • Preventing VLAN hopping attacks through proper configuration
  • Supporting QoS in VLAN environments via Priority Code Point (PCP) tagging

Final Thoughts: VLAN Trunking Best Practices

Use trunk links between switches — not for end devices.

Limit allowed VLANs on trunks to only what’s needed.

Always set a non-default native VLAN.

Regularly audit with show commands.

Document your VLAN to port mappings for easy troubleshooting

👉 For more information about networking, follow FaizanTech Core.