• Coble Bredahl posted an update 1 year, 3 months ago

    I tried to condense the countless hours I spent learning what VLANs are and how to implement them, trying to concentrate on the important information.

    What is a VLAN?

    A VLAN is short for Virtual LAN. A VLAN is an isolated broadcast domain. If it doesn’t mean anything to you, we are able to just call it an isolated segment or isolated section of a network, where devices on that segment can not "see" devices on other segments.

    One way that has helped me to grasp this idea is thinking of mDNS or DLNA devices (another little rabbit hole to go down, but for now stick to me). Think about a wireless printer or perhaps a Chromecast. These devices usually use technology which allows them to "magically" appear on your own phone if you’re linked to the same network. That is because your phone (or laptop) and the Chromecast or printer are in exactly the same broadcast domain or segment. If your laptop and your Chromecast were each in different segmented VLANs, it might be as though the Chromecast doesn’t exist so far as your laptop is concerned.

    Finally, a VLAN is not a subnet. This is imporant, we will touch on this in a future post about inter-VLAN routing.

    So it breaks my Chromecast. Why would I want to use it?

    While in the case of attempting to print to a radio printer from your work laptop, having each device in a different network segment will be annoying, there are various valid use-cases for VLAN segmentations in the homelab or home newtworking setups, including:

    Isolating work-from-home devices (just like a work laptop, printer) from personal devices

    Isolating "production" servers from "staging" or "development" servers in case you are running some type of application on your homelab

    Isolating IoT or untrusted devices – for example having all of your Alexa or smart home devices connected on an isolated VLAN so that they can’t "see" and spy on your own internal network

    Capability to finely control inter-VLAN routing – this is one we will touch on later on, as VLANs allow a network administrator to establish rules for how different VLANs can interact with each other and with the internet – for example a "kids" VLAN that doesn’t have access to a specific game after 10PM

    VLAN-aware Switches and Routers

    Before we move in to additional information about implementation, I would like to briefly discuss the hardware side. This will be a very high-level overview as there are plenty of resources for learning the actual "behind-the-scenes" of how VLANs work in networking hardware. I am aiming to make it easily understood for a newcomer or beginner.

    Remember: Part of setting up VLANs is learning the quirks of one’s particular equipment rather than to assume one vendor will undoubtedly be like another in their VLAN implementation. You will discover different manufactures could have slightly different implementations, however the overall concept remains exactly the same!

    Why can’t all routers and switches support VLANs, isn’t it only a software thing?

    Yes and no. By the end of the day, all a VLAN really is in practice is a tiny bit of extra information put into every "packet" of information traveling during your network. This information has to be interpreted and treated accordingly by your equipment. This is often done in software or hardware. BUT, remember that our routers and switches are often not very powerful in terms of software tasks.

    Network switches are low-power, efficient devices that a simple job really efficiently with hardware. That is why a Mikrotik CRS-328 can switch 63gbps of traffic when it has a single 800 mhz CPU. The minute it needs to utilize its CPU to route traffic, like routing traffic in one VLAN to another, that throughput number falls to under 500 mbps.

    There are 3 solutions to this problem:

    Throw more power at it: a powerful CPU can handle VLAN tagging without much issue – look at a Proxmox or other virtualization server, that may handle VLAN traffic

    Use hardware that is optimized for the task: find a "managed" switch that has Layer 2 capability in the event that you just need simple VLAN capability or Layer 3 Hardware capability if you want the switch to manage to route traffic between different VLANs

    Be OK with lower speeds or decreased efficiency. This is sometimes the answer, specifically for the homelab. For instance, my travel router, a GL-AR750s has OpenWrt installed and is able to do VLAN filtering through software. I am fine that this isn’t the most efficient setup possible and value the convenience and cost effectiveness more in this situation. This may apply to many beginners, who have a router that can you need to be flashed with OpenWrt and handle VLANs through its CPU. It’s still exactly the same VLAN goodness, just slower and cheaper!

    VLAN terminology glossary

    Listed below are some important terms and concepts to understand. These will let you grasp diagrams and examples of VLAN setups and translate them to your personal equipment:


    This is the number, 1-4095 of the VLAN. That is used by networking equipment to recognize and group members of exactly the same VLAN together. You should realize that the quantity is all that matters. In the event that you label VLAN 10 "Sally" on one switch and VLAN 10 "Jimmy" on another, the one thing the switches really care about is the VID


    power over ethernet

    A VLAN tag is a little piece of information put into a packet that tells networking equipment which VLAN that packet belongs to.


    When setting up a VLAN-aware switch, you’ll often come across the word tagged or untagged in the form of a checkbox or dropdown menu for every physical port on the switch or router (and sometimes the "CPU" is known as its own port, like in the case of OpenWrt or "bridge" in the case of Mikrotik – this is important for inter-VLAN routing which will be discussed later). When selecting "tagged" – you’re indicating to the switch that the traffic on that port with the VID you’re marking as TAGGED should keep its VLAN tag when it leaves/enters the switch.

    In case a VLAN is tagged on a port and you also connect a non-VLAN aware device, that traffic will be invisible to that device, while a VLAN-aware device can grab that traffic and filter it. This is useful for trunking (also defined in this list).

    Untagged (access port on Cisco)

    The inverse of the above, you’re telling the switch that traffic with the untagged VID will have its tag removed as it leaves the switch, so it will show to the connected device as if it is regular non-VLAN traffic.


    Here is the physical port VID. You can think of this because the "default" VLAN ID for the port, and therefore packets coming into/leaving the switch with no tag will be considered to be part of this VLAN. You might be confused by the point of the when you also have untagged/access ports. On Mikrotik if you select a PVID for a port it will automatically show that VID as untagged on that port, without you having to manually add it. On my TP-Link T1600G I had to choose a PVID for a port and select a port as untagged. From what I can tell reading on forums, some vendors separate egress/ingress via untagged/PVID respectively. Just know to make certain with your documentation which pattern your equipment follows.


    This is one of the best and what I think is the most powerful parts of VLANs, trunks. A trunk is formed when you tag multiple VIDs about the same port on one switch. This port may then be used to connect another VLAN-aware switch and also use the same VLANs on that switch too. A very real usage of this: I’ve 2 VLAN-aware switches in my network: a Mikrotik CRS-328 which is connected with a trunk port to a Mikrotik CRS-317. This allows me to use extend my network and have the extra 10G SFP+ ports on the second switch, while still keeping the same network segmentation.