Home Lab Networking for Engineers: VLANs, WireGuard and a Safe Way In

Home Lab Networking for Engineers: VLANs, WireGuard and a Safe Way In

The fastest way to turn a fun home lab into a security problem is to forward a port “just for a minute”. A little network design up front lets you experiment freely without putting the rest of your home at risk.

Goals

  • Lab machines can’t reach your family’s laptops and phones.
  • Smart-home and IoT devices can’t reach anything important.
  • You can reach the lab from anywhere, without exposing services to the internet.

Step 1: Split the network with VLANs

A VLAN-capable router or firewall (OPNsense, pfSense, or many prosumer routers) plus a managed switch lets you create separate networks on the same hardware:

  • Home: personal devices.
  • Lab: servers, GPUs, experiments.
  • IoT: TVs, cameras, smart plugs.
  • Management: switch and router admin interfaces.

Then write firewall rules: home may reach the lab; the lab may reach the internet but not home; IoT reaches only the internet.

Default-deny between VLANs, then allow specific traffic. It’s easier to open one port than to find out later what you forgot to close.

Step 2: Remote access with WireGuard

WireGuard is a small, fast VPN. Instead of exposing services, you expose one UDP port for the VPN, and nothing responds unless the client has the right key.

A minimal server config (/etc/wireguard/wg0.conf):

[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <server-private-key>

[Peer]
# laptop
PublicKey = <laptop-public-key>
AllowedIPs = 10.8.0.2/32

Generate keys with wg genkey | tee privatekey | wg pubkey > publickey, start it with wg-quick up wg0, and allow the VPN subnet to reach only the lab VLAN. If you’d rather not manage keys and ports yourself, mesh tools built on WireGuard, such as Tailscale, handle that for you.

Step 3: DNS and names

Run a local DNS resolver (Pi-hole, AdGuard Home or your router) so services get names like llm.lab.home instead of IP addresses. It makes everything easier to remember, and lets you block ad and tracking domains while you’re at it.

Step 4: Expose web services the safe way

If something genuinely must be public, put it behind a reverse proxy with TLS and authentication, or use a tunnel service, rather than forwarding ports straight to a server. Keep anything with admin access (dashboards, model UIs like Open WebUI, SSH) on the VPN only.

Why it matters for AI experiments

A self-hosted model is powerful and usually unauthenticated by default. Putting it on a lab VLAN behind WireGuard means you can self-host an LLM and reach it from anywhere without anyone else reaching it too. And if you’re still deciding whether a home lab is worth it, The Home Lab as a Developer’s Soul makes the case.

FAQ

Do I need VLANs for a home lab?

Not to start, but separating lab and IoT devices from personal ones is the single biggest safety improvement you can make.

Is WireGuard better than port forwarding?

Yes for private services. One VPN port with key-based access exposes far less than many forwarded application ports.

What hardware do I need for VLANs?

A router or firewall that supports VLANs and a managed (VLAN-aware) switch.