VLAN 10 192.168.10.0/24VLAN 20 192.168.20.0/24.10.20Vlan10Vlan20tag 10tag 20permit ✓
White envelope: the IP packet, the same from end to endColoured tray: the Ethernet frame; orange = VLAN 10, pink = VLAN 20Striped trunk: one cable carrying both VLANs, every frame taggedShield: the ACL that decides what may crossA PC in VLAN 10 (192.168.10.10) prints to a printer in VLAN 20 (192.168.20.20). The switch keeps the VLANs apart, so the packet must be routed. The white envelope is the IP packet and never changes. The coloured tray is the Ethernet frame: on the trunk it wears an 802.1Q tag (10 going up, 20 coming down), and the router replaces it with a new one, so both MAC addresses change. Addresses are examples: 192.168.10.0/24 and 192.168.20.0/24 are private ranges (RFC 1918); MAC addresses are documentation values (RFC 7042, 00:00:5e:00:53:xx).

Two VLANs

  1. A VLAN (virtual LAN) splits one switch into separate LANs. The PC's port is in VLAN 10, the printer's in VLAN 20. The switch never passes a frame from one VLAN to the other.

Router on a stick

Layer 3 switch

The headers, field by field

;; step 1/10 · two-vlans · local
;; at switch + pc + printer
switch port   mode     VLAN
  1           access   10   (PC)
  2           access   20   (printer)
  24          trunk    10, 20  (router)
VLAN 10 = subnet 192.168.10.0/24
VLAN 20 = subnet 192.168.20.0/24
a frame is only ever sent out of ports in its own VLAN (IEEE 802.1Q)

The PC already knows the gateway’s MAC and the router already knows the printer’s from earlier ARP exchanges, so ARP is not shown. Both subinterfaces use the router port’s single MAC address, as most routers do. A VLAN ID can be 1 to 4094; 0 and 4095 are reserved (IEEE 802.1Q). A trunk can carry one VLAN untagged, the native VLAN (often VLAN 1). VLANs 10 and 20 are not native here, so their frames are tagged.