In Level One, you learned that a switch sends data only to the right device. Now it's time to level up: what if one switch could serve many separate mini-networks at once — like separate group chats inside one big class? That's the magic of VLANs. Let's dive in! 🚀
A switch is like a smart post office. It keeps a list — the MAC address table — that maps each device's unique MAC address to the physical port it's plugged into. When data arrives, the switch looks up the destination MAC and sends it out the right door. 🚪
| MAC address | Port | Device |
|---|---|---|
| AA:BB:CC:11:22:33 | Port 1 | Laptop |
| DD:EE:FF:44:55:66 | Port 2 | Printer |
| 11:22:33:AA:BB:CC | Port 3 | Smart TV |
At first the table is empty. The switch learns by watching where packets come from. It's called MAC learning. 🧠
Imagine one big school building (the switch). Without VLANs, everyone hears everything — chaos. With VLANs, each classroom is separate: only students in the same class talk to each other. 🏫
One big group chat would be a mess. Instead, we make separate groups — Family, Gaming Squad, School Project. Each is a VLAN! 💬
VLANs add security (guests can't reach your files), less noise (fewer broadcast storms), and flexibility (move a device without rewiring). 🎯
A single physical switch can be divided into several logical networks. Here's a common setup:
Teachers' laptops and office devices. Tightly controlled.
Student devices. Can access the internet, but not staff files.
Visitors. Internet only — no access to any internal resources.
Because each VLAN is its own little network, traffic can't cross between them unless a router allows it. That's isolation! 🔒
When a frame travels over a trunk, the switch adds a tiny 4‑byte tag (called an 802.1Q tag) that says which VLAN it belongs to. Without it, the receiving switch wouldn't know where to forward it.
By default, VLANs can't talk to each other. That's good for security — but sometimes they need to share data. The trick? A router with a single cable connected to a trunk port on the switch. The router has a sub-interface for each VLAN, like a little doorway for each one. 🚪🚪🚪
Why "on a stick"? Because it looks like the router is skewered on a single cable — one physical link, but multiple logical interfaces. 🍢
Switch> enable Switch# configure terminal Switch(config)# vlan 10 Switch(config-vlan)# name STAFF Switch(config-vlan)# exit Switch(config)# vlan 20 Switch(config-vlan)# name STUDENTS Switch(config-vlan)# exit ! Assign an access port to VLAN 10 Switch(config)# interface FastEthernet0/1 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 10 ! Configure a trunk port Switch(config)# interface GigabitEthernet0/1 Switch(config-if)# switchport mode trunk
Don't worry if this looks scary — it's just telling the switch which ports belong to which VLAN. You'll practice this in Packet Tracer! 🖥️
You just learned: MAC address tables, what VLANs are & why they're useful, access vs trunk ports, 802.1Q tagging, and router‑on‑a‑stick inter‑VLAN routing.