Sharing notes from my ongoing learning journey — what I build, break and understand along the way.
Switching to VLANs: Trunking, 802.1Q Tagging and STP Explained for Beginners
From Switching to VLANs: How Trunks, Tagging and STP Keep Networks Organized
As someone new to switching, the confusion usually starts at this point: “I plugged in the cable, the devices can see each other… so is the job done?” In a small home network, that’s often true. There’s a modem, a switch, two computers plugged into the same network, and they can access the internet. At this stage, a switch looks like nothing more than a “box that increases the number of ports.” But as the network starts to grow — for example, 20–30 devices in the same place, multiple switches, maybe an access point, a firewall, or a router — that simple picture changes quickly.
Because as the network grows, two things happen:
- Traffic increases.
- If there aren’t “rules that manage traffic properly,” the network starts to become chaotic.
My goal in this article is this: to anchor the basic logic of switching in place, and then explain why VLANs, trunking/tagging, and STP naturally appear as the next steps — all in a single flow. Not “VLAN out of nowhere,” but first understanding why we need it. Then we’ll look at where people most often make mistakes while building this structure. At the very end, I’ll make a short but meaningful transition to QoS, because QoS is often dismissed as an “advanced topic,” yet I think learning the core idea early is genuinely useful.
1) The switch’s real job: forwarding traffic selectively
The best way to understand a switch is to start with the question: “How does traffic move?” A switch is considered a Layer 2 (L2) device and essentially works with MAC addresses. That sentence alone may not mean much to a beginner — so let’s think about it practically:
When a computer (PC) sends something onto the network, that data arrives at the switch. The switch looks at it and tries to understand:
- “Who is this data coming from?” (source MAC)
- “Who is this data going to?” (destination MAC)
- “Do I know the destination, or not?”
Here’s what makes a switch different: it doesn’t want to send traffic randomly everywhere. If it knows the destination, it wants to forward the frame only out of the correct port. That way, the network doesn’t get filled with unnecessary traffic. For this, the switch has a MAC table (MAC address table / CAM table).
In simple terms:
- When a switch sees a frame, it learns the source MAC address as “on this port.”
- Then it looks at the destination MAC address:
- If the destination is in the MAC table → it sends it only to that port (unicast).
- If the destination is not in the MAC table → it spreads it out to many ports within the same network (flood).
And here comes the first critical idea:
For a switch to send traffic to the correct destination, it first needs to learn.
This learning is normally automatic and problem-free. But as the network grows and becomes more complex, issues that emerge in the “learning” part show up to users as “the internet got slow” or “the company network is acting weird.”
At that point, the first thing that comes into play to build a more organized network is: limiting the traffic area.
2) The natural problem when a network grows: everything mixes with everything
In a small network, everyone talks in the same “logical space.” This can seem good, because access is easy. But as it grows, the following start happening:
- Broadcast traffic increases (discovery packets, ARP requests, some service announcements).
- Devices from different teams become unnecessarily visible to each other.
- On the security side, the question “Who should access what?” becomes impossible to answer.
- When something breaks, the problem scope becomes huge: “Which device caused it?”
These are not “the switch is broken” problems. This is actually a “the network grew, but it still behaves like one big room” problem. This is where VLAN comes in.
3) VLAN: creating “rooms” on the same switch
VLAN (Virtual LAN) is essentially creating different logical networks using the same physical infrastructure. When I first learned VLANs, I thought of them as “for separating departments.” Yes, that’s a very common use — but the real power of VLANs is mainly in two areas:
A) Reducing the broadcast domain
A VLAN is, in practice, a broadcast domain. Broadcasts in VLAN 10 do not pass into VLAN 20. Which means: as the network grows, let “noise” not spread everywhere — split it into smaller, more controllable areas.
B) Drawing boundaries for control and security
Even if devices are plugged into the same switch, some of them should never see each other. Guest network, office network, server network, IoT/printer network — these separations exist for a reason. The nice part is: later, writing firewall rules becomes more logical too. Because instead of “put everyone into one network and then allow one-by-one,” you set the boundaries upfront.
Here’s an important truth:
VLANs do not talk to each other automatically.
So if a device in VLAN 10 wants to access a device in VLAN 20, it needs a “path” in between. That path is provided by routing (a router or a Layer 3 switch). This idea explains well why VLANs bring “order”: as you add VLANs, the network naturally becomes more rule-based.
But once we move from theory into implementation, we run into two port types. Without understanding these, VLAN knowledge always stays “half-complete”: Access and Trunk.
4) Access port: the door that carries “one VLAN” for end devices
Think of an access port as the type of port you use most often in daily life. End devices like PCs, printers, IP phones, and cameras typically connect to access ports. The logic is:
- For the device connected to this port, the switch says “you are in VLAN 10” (or VLAN 20).
- The device itself does not have to know anything about VLAN tags.
- The switch treats traffic coming from that port as traffic belonging to the assigned VLAN.
One of the most common beginner mistakes happens here:
The port the device is connected to is left in the wrong VLAN. Result? No IP address, not visible on the network, or the feeling of “it’s like there’s internet, but also not.” That’s why, while learning VLANs, which ports are assigned to which VLAN is absolutely critical.
So far, everything makes sense within a single switch. But in real networks, one switch is not enough. When there are multiple switches, we need to carry VLANs to the other switch as well. This is where trunk comes in.
5) Trunk port: carrying multiple VLANs over a single link
Imagine you connect two switches together. If we had to run a separate cable for each VLAN, things would quickly spiral out of control. For example, if you have VLAN 10 and VLAN 20 — would you run two cables between the switches? What if you had 10 VLANs?
That’s the reason trunk ports exist:
To carry multiple VLANs over the same physical connection.
A trunk port means: “Traffic from VLAN 10 can pass through this cable, and VLAN 20 as well.” But to avoid mixing them up, the switch must indicate which VLAN a frame belongs to. That’s where tagging comes in.
6) Tagging (802.1Q): putting a “label” on traffic
Frames traveling over a trunk link get VLAN information added to them. This is often explained as the 802.1Q standard. For a beginner, it’s easy to picture like this:
- You’re sending packages to two different cities with the same courier truck.
- If the package has no label, you can’t tell which city it should go to.
- If it has a label, sorting becomes easy.
Trunking works similarly: the VLAN tag tells which VLAN the frame belongs to, so the receiving switch can place the incoming traffic into the correct VLAN.
There’s a very common practical issue here: if trunk configuration is not compatible on both ends, the network behaves like it “partly works.” For instance, VLAN 10 passes but VLAN 20 doesn’t. On the user side, this looks like: “Some devices work, some don’t.” That’s why trunking is one of the most confusing but also most educational topics for beginners.
There is also the often-heard “native VLAN” topic. Without going too deep, it’s enough to know this:
- Some trunk links may accept traffic without a tag (untagged).
- Untagged traffic falls into the “default VLAN.”
- If that default VLAN differs on the two ends, traffic goes into the wrong VLAN and problems appear.
So far, the flow — switching → VLAN → trunk → tagging — has made sense. But there’s one more topic in networking that people usually only take seriously after they run into a problem: loops.
7) The loop problem: locking up the network while trying to build redundancy
Building redundancy seems logical. “I’ll run two cables between the switches so if one breaks, the other keeps working.” At first glance, that’s great. But in the Layer 2 world, uncontrolled redundancy can create a loop — and if it does, it can cause chaos that impacts the entire network.
What happens when a loop exists?
- Broadcast packets enter the loop and keep circulating endlessly.
- Traffic multiplies unnecessarily.
- Switch MAC tables become unstable (a MAC address appears on one port, then on another).
- Eventually the network seems “up,” but becomes unusable in practice: latency rises, packet loss occurs, services drop.
At this point, the reason STP exists becomes very clear:
STP keeps the network alive by controlling loops.
8) STP: the thing we get mad at for “blocking a port” is actually the network’s fuse
STP (Spanning Tree Protocol) is a mechanism where switches communicate with each other, evaluate the topology, and prevent loops from forming. The core logic of STP is:
- If there are multiple paths in the network, STP makes some paths “inactive.”
- This way, logically only one active path remains.
- If the active path fails, STP can bring a previously blocked path back into service.
That’s why STP usually works quietly in the background and goes unnoticed. But the day a port goes into “blocking” state, people get surprised: “Why did it shut down?” In reality, that port being blocked is not bad — the bad thing is the loop itself. STP is controlling that loop before it becomes a disaster.
For a beginner, the lesson here is extremely valuable:
In networking, some things are “intentionally restricted” so the system remains stable.
VLAN is like that. STP is like that. All of them exist to bring order.
9) QoS: setting “priority” inside the same network
Everything we’ve discussed so far was about “Is traffic in the right place, in the right VLAN, is there a loop?” QoS deals with a slightly different problem: traffic may be in the correct place, yet the user still feels it’s slow.
Because not all traffic is equally sensitive. For example:
- Voice/video calls are highly sensitive to delay.
- File downloads can be delayed and usually still “work.”
- Some critical applications are heavily affected by latency and jitter.
The main idea of QoS is this: when the network is busy, if you treat every packet equally, some critical services will break. QoS aims to preserve usability by giving priority to certain traffic. As a beginner, it’s enough to know this: QoS creates a kind of “traffic order” in network design, especially important if you have VoIP or real-time applications.
10) A small example connecting everything: growing without order is hard
When you combine all these topics into one small scenario, it becomes clearer:
- In the same office, there are two groups: office users and accounting.
- There are also printers and a few servers.
- One switch isn’t enough; there are two switches.
- For security, you don’t want everyone to access the servers.
At that point, the natural steps look like this:
- You build basic connectivity with switches (switching).
- You split things into sections using VLANs so traffic doesn’t mix (VLAN).
- You open a trunk between the switches to carry VLANs (trunk + tagging).
- You make sure STP works properly so redundancy or wrong cabling doesn’t create loops (STP).
- If you have voice/video traffic, you consider QoS so it doesn’t degrade under load (QoS).
The nice thing about this flow is: these topics aren’t “separate memorization.” A need appears, and the next topic is the solution. Once you understand switching, VLAN makes sense. Once VLAN exists, trunk becomes necessary. Once trunk and multiple links exist, loop risk appears. Loop risk makes STP mandatory. As the network grows and becomes busy, QoS comes up.
