The goal

My home network carries very different kinds of devices: personal laptops and phones, a server running a dozen self-hosted services, security cameras, IoT gadgets, guests, and an intentionally vulnerable attack lab. On a flat network, any one of those being compromised puts all the others in reach.

I wanted the network built the way a small business should be: segmented by trust, default-deny between segments, and every exception narrow and deliberate.

The design

The network runs on a UniFi Dream Machine SE gateway, a managed PoE switch, and UniFi access points. I chose a modular stack over an all-in-one router specifically for proper VLAN tagging, inter-VLAN routing, and built-in IDS/IPS.

Traffic is divided into seven networks, each assigned to a firewall zone using UniFi’s zone-based firewall:

NetworkWhat lives therePosture
ManagementNetwork gear and core services, including Pi-hole DNSHighest trust. Other networks reach it only on the specific ports they need, starting with DNS.
LANTrusted personal devices and the main serversInternet access plus the shared services it needs
GuestVisitors’ devicesInternet only, blocked from everything internal
IoTSmart-home devicesInternet only, blocked from everything internal
CamerasSecurity cameras, recorded locallyNo internet. Reachable only from trusted devices.
LabKali and Metasploitable attack labBlocked from every other network. Only the Kali box may reach the internet.
Wireless labA separate Wi-Fi router for future wireless security testingKept apart from the trusted networks

Working at the zone level means a new device inherits the right policy the moment it lands on a VLAN, instead of relying on me to remember a per-device rule.

Isolating the attack lab

The lab is where I run deliberately vulnerable machines, so it had to be airtight. When I first checked, the lab network shared the Protected zone with the cameras, and that zone allowed traffic out to the internet and into the Internal zone. That was the opposite of what I wanted.

Rather than layer exceptions onto a shared zone, I gave the lab its own zone and set it to block all traffic to the internet and every other zone. The only thing left open is the gateway’s built-in DHCP and DNS so lab machines can get an address. Splitting it out also means a future change to the camera policy can never accidentally loosen the lab.

My first access path was a single allow policy, ordered above the zone-wide block and scoped to one admin device, not the whole trusted network. Testing caught two mistakes: the policy was first saved with the action still set to Block, and my Kali VM was on a VMware NAT network, so its traffic never touched the UniFi firewall at all. I later moved Kali inside the lab with one narrow rule letting only Kali reach the internet for updates. I reach it over its own Tailscale connection, so nothing on my trusted network needs a path in.

More detail is in the attack lab write-up.

Least-privilege exceptions

Segmentation is only as good as its exceptions. A good example: my dashboard app on the server needed to read stats from Pi-hole’s API, which lives in a different zone.

The lazy fix would have been allowing the server’s VLAN to reach the DNS VLAN. Instead, I wrote one policy:

  • Source: the server only, not its whole VLAN
  • Destination: the Pi-hole host only
  • Port: TCP 80/443 only
  • Action: Allow, with return traffic allowed, ordered above the inter-VLAN block

My first version didn’t match any traffic because I’d put the ports on the source side. Clients connect from a random high port to the server’s well-known port, so the port restriction belongs on the destination. That’s a small detail that’s easy to get wrong in any firewall, and fixing it made the rule do exactly what I meant.

On the application side, I moved the API credential out of the dashboard’s config file into an environment variable, and used a dedicated Pi-hole app password instead of the admin password, so a leaked config file doesn’t leak a real credential.

Tuning IDS/IPS with evidence

With IDS/IPS set to notify and block, the first thing I learned is that most alerts are noise, and the work is figuring out which.

  • Windows Delivery Optimization: A high-risk “P2P” alert from my laptop turned out to be Windows sharing update data with peers on port 7680 (ET rule 2022371). It’s legitimate but P2P-shaped, so the signature fires. Blocking it costs nothing, so I left the block in place and noted it as a known benign pattern.
  • Bitcoin node: Running a Bitcoin node flooded the threat log with “reconnaissance” alerts, because the node normally connects to peers all over the world. That noise made the log useless for spotting real attacks until I understood where it came from.
  • A real C2 alert: One alert was serious enough to work as a full incident. That’s its own write-up.

Data-driven geo-blocking

I already blocked a standard list of high-risk countries and wondered whether to add more. Instead of copying a generic list, I looked at what was actually hitting me.

The gateway’s threat log was dominated by Bitcoin peer traffic, so it was the wrong source. My public-facing services sit behind Cloudflare, so I used Cloudflare’s security events instead. Everything there was already blocked by Cloudflare’s managed WAF: a React RCE exploit attempt, a WordPress webshell tool, and scanners probing for leftover wp-config.php backups.

The pattern that mattered was that the attackers were mostly on rented cloud infrastructure (Google Cloud in the US and Germany), not residential traffic from the countries involved. Blocking more countries wouldn’t stop them and would block legitimate services. The data also showed nobody was targeting my real services, only the bare domain and generic paths.

So I kept the country list as it was and focused on controls that match the threat: Bot Fight Mode, a robots.txt that disallows all crawling, and blocking the WordPress paths that don’t exist on my setup anyway.

IPv6: a deliberate decision

When my gateway reported IPv6 was available, I treated it as a security decision, not a checkbox. IPv6 removes the accidental protection NAT gives on IPv4, since devices get globally routable addresses, and every IPv4 isolation rule would need an IPv6 equivalent. I weighed enabling it on trusted networks only. For now I’ve left it off everywhere, because the benefit is small for my use and doing it right means maintaining a second, parallel firewall ruleset. Separately, a test on my server showed how easy it is to expose a host by accident with IPv6 (details), which reinforced that decision.

Takeaways

  • Default deny, then earn every exception. Each allow rule names a specific source, destination, and port.
  • Test the blocked path, not just the allowed one. Several of my mistakes only showed up because I tried traffic that should fail.
  • Use the right data source. The gateway’s log was the wrong place to make geo-blocking decisions. The edge WAF was the right one.
  • Controls should match the actual threat. Cloud-hosted scanners call for WAF and bot rules, not bigger country lists.

Skills demonstrated

VLAN design · zone-based firewall policy · least-privilege rule writing · IDS/IPS alert triage and tuning · Cloudflare WAF and bot management · secrets handling · IPv6 security planning