A smart TV, a doorbell camera and a work laptop usually share one flat home network, and every one of them can see every other. A VLAN splits that network into separate ones without buying a second switch or pulling a second cable. The whole mechanism rests on four bytes added to an Ethernet frame. Below, those four bytes are built by hand, written to a capture file and decoded with tcpdump, so the tag can be seen exactly as a switch sees it.
One switch, several networks
Broadcast domains
An ordinary switch forwards a broadcast frame out of every port. That is how a device finds its router with ARP, how DHCP requests reach the DHCP server and how a printer announces itself, and it is also why any device on the network can see every other one.
A VLAN changes the boundary. The University of Aberdeen’s networking course notes describe VLANs, defined in the IEEE 802.1Q standard, as a way for a network to be divided into a set of broadcast domains, each of which can carry its own independent IP network. Broadcast frames, in the same notes, are only sent to ports that belong to the same VLAN ID.
One physical switch then behaves like several separate switches that happen to share a box.
What people put on them at home
The notes give the purpose in a single line: VLANs are typically used to provide traffic separation, either to improve performance or to provide security. In a house that usually means three or four groups:
| VLAN | Typical devices |
|---|---|
| Main | Laptops, phones, the NAS |
| IoT | Smart plugs, bulbs, TVs, speakers |
| Cameras | Doorbells, security cameras |
| Guest | Visitors’ phones |
The grouping is a choice, not a rule. The point is that a compromised smart plug on the IoT network cannot reach the laptop on the main one unless the router allows it.

The tag itself
Four bytes
The Aberdeen notes on the tag format say the 802.1Q standard defines a 4 byte “tag” field, and that its presence is signalled by the Ethertype value 0x8100. The tag holds a user priority from 0 to 7, called the 802.1p value, and the VLAN ID. The trunk section of the course gives the ID its size: a 12-bit VID field.
Twelve bits allow 4,096 values. Switch documentation such as HP’s A6600 manual lists the range as 0 to 4095, with 0 and 4095 reserved, which leaves 1 to 4094 for real VLANs. An ID of 0, per the Aberdeen notes, means the tag carries only priority information.
Built by hand
To see the tag in a real decoder, a short Python script assembled three Ethernet frames, each carrying the same kind of ping, and wrote them to a standard pcap file:
- An ordinary untagged frame on 192.168.1.x
- The same frame tagged for VLAN 10, on 192.168.10.x
- A frame tagged for VLAN 20 with priority 5, on 192.168.20.x
tcpdump 4.99.4 read the file back with tcpdump -e -nn -r vlan.pcap:
02:00:00:00:00:0a > 02:00:00:00:00:0b, ethertype IPv4 (0x0800), length 74:
192.168.1.10 > 192.168.1.1: ICMP echo request
02:00:00:00:00:0a > 02:00:00:00:00:0b, ethertype 802.1Q (0x8100), length 78:
vlan 10, p 0, ethertype IPv4 (0x0800), 192.168.10.10 > 192.168.10.1: ICMP echo request
02:00:00:00:00:0a > 02:00:00:00:00:0b, ethertype 802.1Q (0x8100), length 78:
vlan 20, p 5, ethertype IPv4 (0x0800), 192.168.20.50 > 192.168.20.1: ICMP echo request
The untagged frame is 74 bytes. Both tagged frames are 78. Four bytes, exactly as specified.
The bytes themselves
Here are the first 16 bytes of the untagged frame and the VLAN 10 frame, from tcpdump -XX:
untagged: 0200 0000 000b 0200 0000 000a 0800 4500
VLAN 10: 0200 0000 000b 0200 0000 000a 8100 000a 0800 4500 ...
The first twelve bytes are the destination and source MAC addresses, identical in both. In the untagged frame, the next two bytes are 0800, which means IPv4. In the tagged frame, 8100 appears in that position instead, which tells the receiver a tag follows. Then comes 000a: priority 0 in the top three bits and VLAN ID 10 (hexadecimal a) in the bottom twelve. Only after the tag does 0800 appear, and the IP packet starts as before.
The VLAN 20 frame’s tag reads a014. In binary, the top three bits of a0 are 101, priority 5, and 014 is decimal 20.
Filtering on it
tcpdump can select by tag: tcpdump -nn -r vlan.pcap vlan 20 returned just the third frame. The same filter on a live trunk port shows a single VLAN’s traffic.
Access ports and trunk ports
Who sees the tag
Most devices never see a tag at all. A switch port is configured in one of two modes, which the Aberdeen notes describe:
| Mode | VLANs on the port | Frames on the wire |
|---|---|---|
| Access | One | Untagged; the switch assigns them to the port’s VLAN internally |
| Trunk | Several | Tagged with the VLAN ID |
A smart plug plugged into an access port in VLAN 30 sends ordinary frames. The switch knows that port belongs to VLAN 30, tags the frames internally if they need to leave on a trunk, and strips the tag again before delivering anything back to the plug. The device has no idea VLANs exist.
Trunk ports are for links that carry more than one VLAN: switch to switch, switch to router, and switch to a Wi-Fi access point that broadcasts several network names.
The native VLAN
A trunk can also carry untagged frames. The notes state that a frame arriving with no tag is associated with the default VLAN ID, and that some equipment lets that native VLAN be set per interface. In practice this is where home setups go wrong. If the router expects VLAN 1 untagged and the switch sends VLAN 1 tagged, or the two disagree about which VLAN is native, devices on that VLAN get no DHCP lease and the rest of the network works fine.

Getting between VLANs
A router has to be involved
A switch alone will not pass traffic from one VLAN to another. That separation is the whole point. The Aberdeen notes say a router connected through a trunk port can be configured to forward packets between VLANs, and that when a router receives a tagged frame it does not carry the tag onto its outgoing interface.
This is the setup sometimes called router-on-a-stick: one cable from the switch to the router, carrying every VLAN tagged, and the router holding one virtual interface per VLAN. Each VLAN gets its own subnet, such as 192.168.10.0/24 for the main network and 192.168.30.0/24 for IoT, and its own DHCP scope.
The firewall rules are the real security
Putting the IoT devices on their own VLAN only separates them if the router’s firewall says so. A router that routes freely between all its interfaces has made separate subnets that can still talk to each other. The usual pattern is:
- Main network may start connections to IoT (to control a smart plug).
- IoT may not start connections to main.
- IoT and Cameras may reach the internet; Cameras may also be blocked from it entirely if recording is local.
- Guest reaches the internet and nothing else.
What breaks
Separating devices breaks some things that relied on broadcast. Casting from a phone to a TV and finding a network printer typically use multicast discovery, which by design stays inside one broadcast domain. When the phone and the TV sit on different VLANs, the TV disappears from the cast menu. Home routers that support VLANs generally offer an mDNS or multicast relay option to forward just those discovery packets between chosen VLANs.
On Linux
A VLAN interface
Linux can join a trunk directly. The ip-link manual page gives the command to create a tagged sub-interface:
ip link add link eth0 name eth0.10 type vlan id 10
That creates eth0.10. Anything sent on it leaves eth0 tagged with VLAN 10, and tagged frames for VLAN 10 arriving on eth0 appear on eth0.10 untagged. ip link delete dev eth0.10 removes it. The protocol option accepts 802.1Q, the default, or 802.1ad, the double-tagging used by service providers, which the Aberdeen notes identify by the tag value 0x88a8.
This is how a home server or NAS can sit on several VLANs over one cable, for example offering file shares on the main network and a media server on the IoT network.
Why the frames came from a script
The sandbox where the frames above were built does not have the kernel’s VLAN support enabled: ip link add ... type vlan returned “Unknown device type.” That is why the frames were assembled in Python and decoded from a file rather than captured from a live interface. The bytes and the decoder are the same ones a live capture would use.

What it takes at home
Equipment
- A router or firewall that supports VLAN interfaces and inter-VLAN firewall rules.
- A managed or “smart” switch. Unmanaged switches either strip tags or pass them blindly; neither assigns ports to VLANs.
- Access points that can map each wireless network name to a VLAN, if the IoT devices are on Wi-Fi, which most are.
An order that avoids lockouts
Change the management side last. Create the new VLANs and their subnets on the router, set the trunk ports on the switch, move one test device to an access port in the new VLAN, and confirm it gets an address and internet access. Only then move the rest. The quickest way to lose access to a switch is to put the port the laptop is plugged into on a VLAN the laptop’s address does not belong to.
Sources
- Gorry Fairhurst, University of Aberdeen, “Virtual LANs (VLANs)”: https://erg.abdn.ac.uk/users/gorry/course/lan-pages/vlan.html
- Gorry Fairhurst, University of Aberdeen, “VLANs: Advanced topics”: https://erg.abdn.ac.uk/users/gorry/course/lan-pages/vlan-advanced.html
- HP A6600 switch documentation, VLAN tag format (via ManualsLib): https://www.manualslib.com/manual/1328483/Hp-A6600.html?page=96
- ip-link(8), Linux manual page, man7.org: https://man7.org/linux/man-pages/man8/ip-link.8.html
