Differences

Compared

VLAN vs subnet

A VLAN splits a switch into separate networks at the link layer, by a tag in each frame. A subnet is a block of IP addresses at the network layer. They usually go together, one subnet for each VLAN, but they are different things: the VLAN decides who hears whose frames, the subnet decides which addresses a device treats as its own network.

Side by side

VLANSubnet
Layer Link (2)Network (3)
Defined by An 802.1Q tag in the frame: a VLAN ID from 1 to 4094An address and a prefix length: 10.0.1.0/24
Set on The switch, port by portEvery device's card, and the router's
Separates Broadcast domains: who hears whose frames and broadcastsWhich addresses a device reaches directly, and which it sends to its gateway
Between two of them Through a routerThrough a router
See it with bridge vlanip addr, ip route

Each one explained

VLAN
Several separate networks on one switch, kept apart by a tag in each frame.
Subnet and prefix length
A block of addresses on one network, written as address/length: 10.0.1.0/24 holds 256 addresses.
Trunk
One link that carries several VLANs, each frame tagged with its VLAN, usually between switches.
Broadcast domain
The set of devices a broadcast reaches: one network at the link layer.

See the difference on real machines

Each lab is a small network of real Linux machines in your browser.

Open VLANs: one switch, two networks that can't hear each other

Sources

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab