img implementing vlans in your home lab setup

Implementing VLANs in your home lab setup

Mastering VLANs: A Practical Guide to Segmenting Your Home Network

I set up VLANs in my home lab to cut noise and improve network security without buying a forklift of kit. This guide walks through the practical steps I took. No theory rabbit holes. Clear examples, exact subnets, sample commands and firewall rules you can copy. Read the short intro, then jump to any section.

Getting Started with VLANs

Understanding VLAN Basics

VLANs create separate Layer 2 domains on the same physical network. Think of them as virtual switches. Devices on VLAN 10 cannot see devices on VLAN 20 unless a router or firewall allows it. VLAN IDs run from 1 to 4094; VLAN 1 is the default on many switches, so avoid using it for important groups.

I use simple naming and fixed ID ranges. Example plan:

  • VLAN 10 — IOT, 192.168.10.0/24
  • VLAN 20 — HOME-OFFICE, 192.168.20.0/24
  • VLAN 30 — GUEST, 192.168.30.0/24

Keep VLANs small and logical. One function per VLAN makes firewall rules easier to read and safer to manage.

Setting Up Your Home Lab

Start with a minimal topology. I use a single managed switch and a router with VLAN-aware interfaces. DHCP runs on the router or a dedicated server via DHCP-relay. Key steps:

  1. Pick VLAN IDs and subnets as above.
  2. Configure DHCP scopes on the router: one scope per VLAN.
  3. Tag trunk links between router and switch with the VLANs you plan to carry.
  4. Put access ports into the correct VLAN for wired devices.

For wireless, create SSIDs mapped to VLANs. Use WPA2/WPA3 for security. Avoid placing admin Wi‑Fi on the guest VLAN.

Choosing the Right Equipment

Don’t overspend. For a small home lab:

  • A managed switch with 802.1Q support and per-port VLAN settings. Cheap managed switches work fine.
  • A router or firewall that can route between VLANs and run firewall rules. Open-source options like pfSense or OPNsense are common in lab setups, as are commercial gateways.
  • A wireless AP with VLAN support if you want SSID-to-VLAN mapping.

I favour kit that shows per-port status and supports trunking. If you buy second-hand enterprise switches, check the CPU/flash space and default config quirks. Label ports and keep a spreadsheet with port-to-VLAN mapping.

Configuring VLANs for Network Segmentation

Creating VLANs on Your Switch

Exact commands vary by vendor, but the intent stays the same: define VLANs, assign access ports, and configure trunks.

Cisco IOS example:

  • vlan 10
    name IOT
  • interface range gigabitEthernet0/2-4
    switchport mode access
    switchport access vlan 10
  • interface gigabitEthernet0/1
    switchport mode trunk
    switchport trunk allowed vlan 10,20,30

If using a consumer-friendly controller (UniFi, for example), create the VLANs in the controller, tag the LAN on the gateway port, and set each port to access or trunk in the switch layout.

Make one port a management port on a dedicated VLAN. Keep your management IP off VLAN 1. That way the switch UI and SSH are reachable only from a known subnet.

Implementing Firewall Rules

Network segmentation is useless without firewall controls between VLANs. I set rules on the router that default to deny, then allow specific flows.

Simple rule set:

  • Allow VLAN 20 (HOME-OFFICE) to access WAN.
  • Allow VLAN 10 (IOT) to access WAN.
  • Block VLAN 10 to VLAN 20 (no device-to-device access).
  • Allow VLAN 20 to reach specific services on VLAN 10 if needed (for example, to a smart-home bridge), using permit rules with source, destination and port.
  • Allow VLAN 30 (GUEST) only to WAN, block access to LAN subnets.

Rule examples in plain logic:

  • Action: allow. Source: 192.168.20.0/24. Dest: any. Port: any. Purpose: internet.
  • Action: deny. Source: 192.168.10.0/24. Dest: 192.168.20.0/24. Log: yes.
  • Action: allow. Source: 192.168.30.0/24. Dest: any. Port: 80, 443. Optional: block all local subnets.

If the firewall supports stateful rules, add an allow for established/related traffic. If using pfSense, place rules on the VLAN interface itself. Put the deny rules above broader allow rules so they take effect.

Be strict with multicast and mDNS. I block mDNS between VLANs and offer an explicit mDNS reflector or a discovery proxy only where needed. That stops printers on the guest network from advertising services to the home office.

Testing Your Configuration

Test in stages. I follow this checklist:

  1. Verify VLAN membership on the switch for each port. Check interface status and VLAN tag.
  2. Confirm DHCP on each VLAN by plugging a laptop into an access port. Confirm the IP and gateway match the intended subnet.
  3. Ping the gateway from a client on each VLAN.
  4. From a HOME-OFFICE host, attempt to ping an IOT device. It should fail if rules block it.
  5. From an admin host, run traceroute or tcpdump on the router to confirm traffic paths and that reject rules are firing.
  6. Test internet access from each VLAN.

Use logs. If a device cannot reach a service, check the firewall logs to see which rule matched. Adjust the rule order if needed. For wireless devices, test roaming and SSID-to-VLAN mapping too.

Practical tips from my lab

  • Use consistent VLAN naming and a simple numbering scheme. It saves time when debugging.
  • Keep one maintenance port on each switch for emergency access.
  • Avoid putting cameras and IOT devices on the same VLAN as the home office.
  • If a device needs access across VLANs, prefer one narrow port-and-protocol rule rather than broad allowances.
  • Regularly export firewall rules and switch configs to a backup location.

Finish by documenting. Write the VLAN map, IP ranges, DHCP scopes and firewall rule intent in a single file. That file is the fastest way to restore function after a config change or outage.

Last takeaway: VLANs reduce blast radius and tidy traffic. Set them up with clear IDs, enforce inter-VLAN rules on the router, test methodically and keep the rules minimal and explicit.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prev
Building a multi-boot USB with Ventoy and Linux
img building a multi boot usb with ventoy and linux ventoy usb drive

Building a multi-boot USB with Ventoy and Linux

Unlock the power of your homelab by creating a versatile Ventoy USB drive

You May Also Like