VLANs
One switch, several broadcast domains, drawn in software
A VLAN is a separate broadcast domain on shared switches. Each VLAN is its own IP subnet.
Without VLANs, every port on a switch is one broadcast domain. With them, you assign each port to a VLAN. Ports one to six are Sales, VLAN ten. Ports seven to twelve are Engineering, VLAN twenty. Each has its own subnet. A Sales PC sends a broadcast. It reaches the other Sales ports. And not one Engineering port. As far as traffic is concerned, these are two different switches.
VLANs · Going deeper
Access ports, voice VLANs and VLAN ranges
An access port carries one VLAN untagged; a voice VLAN adds tagged phone traffic on the same port. Usable IDs run from 1 to 4094.
802.1Q trunks
A 4-byte tag lets one link carry many VLANs
A trunk carries frames from many VLANs, each with an 802.1Q tag holding a 12-bit VLAN ID.
VLANs usually stretch across many switches. Rather than one cable per VLAN, two switches share one trunk link. To keep the VLANs apart, the sending switch inserts a four-byte tag into each frame, right after the source address. The tag starts with the value eight one hundred in hex, which marks it as a tag, then three bits of priority, one drop bit, and a twelve-bit VLAN number. The far switch reads it, strips it, and delivers the frame only within that VLAN.
802.1Q trunks · Going deeper
Native VLAN, allowed VLANs and DTP
The native VLAN crosses a trunk untagged and must match at both ends. Set it to an unused VLAN, prune the allowed list, and disable DTP.
Inter-VLAN routing
VLANs cannot talk until something routes between them
Route between VLANs with a router on a stick (subinterfaces on a trunk) or a layer 3 switch with one SVI per VLAN.
Separate VLANs means separate subnets, so they need a router to talk. The cheap way is a router on a stick: one trunk to a router, with a subinterface per VLAN. Traffic goes up and comes back down the same cable. The usual way is a layer three switch. Each VLAN gets a virtual interface that acts as its gateway, and the switch routes between them in hardware. The oldest way, one router port and cable per VLAN, does not scale past a few.
Inter-VLAN routing · Going deeper
Configuring subinterfaces and SVIs
encapsulation dot1Q ties a subinterface to a VLAN; ip routing and interface vlan make a layer 3 switch route.
Spanning tree
Ethernet has no time to live, so a loop runs until a port is blocked
A switching loop causes a broadcast storm. Spanning tree blocks one port per loop and unblocks it if the active path fails.
Engineers add redundant links between switches so one failure does not cut anyone off. But that creates a loop. A broadcast goes round the triangle. Each switch floods it on, copies it, and nothing ever removes it, because Ethernet frames have no time to live. In seconds the links are full and the network is down. Spanning tree prevents this by blocking one port in every loop. The spare link sits idle until it is needed.
Spanning tree · Going deeper · 1 of 2
Electing the root and choosing which port blocks
The lowest bridge ID becomes root bridge. Each switch picks a root port, each link a designated port; the rest block.
Spanning tree · Going deeper · 2 of 2
Rapid PVST+: roles, states and guards
Rapid PVST+ runs one rapid tree per VLAN. PortFast and BPDU guard on host ports; root guard and loop guard protect the design.
EtherChannel
Bundle links so spanning tree sees one, but a flow still rides one member
An EtherChannel joins up to 8 links into one logical interface; LACP negotiates it and hashing spreads flows across members.
Four links between two switches look like extra capacity, but spanning tree would block three of them. Bundle them into one port channel and the switches treat them as a single four-gigabit interface. Nothing is blocked, and losing one cable only lowers capacity. Traffic is spread by flow. A hash of the addresses picks one member per conversation, so many flows share the bundle nicely, but any single flow tops out at one gigabit.
EtherChannel · Going deeper
LACP and PAgP modes: which combinations form a channel
LACP active forms with active or passive; passive with passive never forms. PAgP desirable forms with auto. “On” is static.
Lesson complete
You finished “VLANs and spanning tree”
Nicely done.