✳ The reference desk / In practice

VLAN

A way to split one physical switch network into separate logical networks. Devices in different VLANs cannot reach each other without passing a router or firewall.

Virtual local area network

What it means

A switch normally forms one local network: a broadcast from any port reaches every other port. A VLAN divides that. Each port is assigned to a numbered VLAN, and the switch delivers frames only between ports in the same one. Links between switches, called trunks, carry several VLANs at once by adding a small tag to each frame that names its VLAN. The standard for that tag is IEEE 802.1Q.

A VLAN separates traffic. It does not encrypt it or inspect it. Traffic passes between VLANs only through a router or firewall, which is where rules belong. Devices inside one VLAN can still reach each other freely. VLANs are a building block for segmentation, not the whole of it.

The idea at a glance / Networks

A VLAN tag keeps networks apart on shared switches.

Follow one office frame across two switches. See where the tag is added, where it is removed, and which port never receives the frame.

Station South, two switches joined by one trunk link. A VLAN, or virtual LAN, splits a switch into separate networks. The VLAN numbers here are examples: 20 for office devices and 30 for the control room phones. An access port serves one device in one VLAN. A trunk carries several VLANs between switches, and marks each frame with a tag, a short field that names its VLAN. An office laptop sends one broadcast frame, a frame addressed to everyone on its network.

VLAN: Follow one office frame across two switches. See where the tag is added, where it is removed, and which port never receives the frame. The explanation below describes the relationships.Two VLANs · two switchesOffice laptop sends one broadcastAccess port · office laptopFrame arrives with no tagPort belongs to VLAN 20Trunk between switchesTag added: 0x8100 + VLAN 204 bytes added to the frameOther office portsVLAN 20 ports receive itTag removed before deliveryControl room phone portPort belongs to VLAN 30The broadcast is not deliveredSHARED SWITCHES · TWO NETWORKS

READ THE PICTURE

One frame, two VLANs

The switch marks the office frame with VLAN 20 on the trunk and delivers it only to VLAN 20 ports. The phone on VLAN 30 never receives it.

Keep in mindThe VLAN numbers are examples. A VLAN separates traffic. It does not encrypt it, and it does not filter what crosses between VLANs. That takes a router or firewall with rules. A badly configured trunk can let an attacker reach another VLAN, and devices inside one VLAN can still reach each other.

Read the complete example
  1. One frame, two VLANs. The switch marks the office frame with VLAN 20 on the trunk and delivers it only to VLAN 20 ports. The phone on VLAN 30 never receives it. The laptop sends an ordinary Ethernet frame with no tag. Its access port, a port that serves one device in one VLAN, belongs to VLAN 20, so the switch treats the frame as VLAN 20 traffic. To carry it over the trunk, the link that carries several VLANs between the switches, the first switch inserts a 4-byte IEEE 802.1Q tag after the source MAC address. The tag starts with the type value 0x8100 and ends with a 12-bit VLAN number, which allows numbers 1 to 4094. The second switch reads the tag, removes it, and delivers the frame only to its own VLAN 20 access ports. The phone port is in VLAN 30, so the broadcast never reaches it. For a packet to pass from VLAN 20 to VLAN 30 it must go through a router or firewall, and that is where rules can apply. Two known attacks cross VLANs without one: a device that negotiates a trunk for itself, and double tagging through the native VLAN, the one VLAN a trunk carries without a tag. Double tagging sends frames one way only, and only from a port in the native VLAN. Fixed access ports and an unused native VLAN number close both.

The VLAN numbers are examples. A VLAN separates traffic. It does not encrypt it, and it does not filter what crosses between VLANs. That takes a router or firewall with rules. A badly configured trunk can let an attacker reach another VLAN, and devices inside one VLAN can still reach each other.

Diagram references: IANA IEEE 802 Numbers: EtherType 0x8100, VLAN tag · RFC 3580: VLAN identifiers with IEEE 802.1X

AN ILLUSTRATIVE SCENARIO

A dental surgery

A dental surgery has one switch for reception computers, X-ray machines, card terminals and patient Wi-Fi. A payment audit asks why a phone on the guest Wi-Fi can see the card terminals. The installer creates four VLANs and assigns each port to one. A small firewall routes between them and allows only the X-ray machines to reach the imaging server on the reception VLAN. Guest Wi-Fi reaches the internet and nothing inside.

Put it to work

  1. List device types and decide which should never talk to each other. Give each group its own VLAN.
  2. Set every user-facing port as a fixed access port. Do not let ports negotiate a trunk.
  3. Carry only the needed VLANs on each trunk, and put the untagged native VLAN on an unused number.

How to check your work

From a device in one VLAN, try to reach a device in another by address. It should fail unless a rule allows it. Check that a broadcast sent in one VLAN does not appear on a port in another.

Connect the ideas

  • Network segmentation

    Splitting a network into zones by purpose and trust, with a check on each boundary. A compromise in one zone then cannot freely reach the others.

  • Firewall

    A device or program that sits between networks and allows or blocks traffic according to an ordered set of rules.

  • NAC

    Controls that check a device, and often its health, before the network lets it join, usually at the switch port or wireless access point.

  • ARP

    The protocol a device uses on its local network to ask which hardware (MAC) address holds a given IPv4 address.

Explore a field lesson

Find your next idea.

Tip: press / to open search. Escape closes this window.