A smart home accumulates WiFi devices — plugs, bulbs, ESP32 boards, a robot vacuum, and a depressing number of things that have no business being on the internet but insist on trying. By default they all sit on the same flat network as the laptops, phones, and the NAS that holds the family photos.
Our test home runs UniFi with the smart devices on their own network. This post covers a segmentation setup on UniFi, the things that break immediately, the mDNS rabbit hole, and what it costs to keep running.
Why bother segmenting at all
Three reasons:
You can see what is phoning home. Before segmentation, IoT traffic is mixed into everything else and effectively invisible. Once the devices are on their own network, the UniFi traffic stats become legible: a smart plug making constant DNS lookups stands out, and so does a device that was retired to a shelf but never unplugged and is still attempting connections to a server in another country.
Blast radius. The realistic threat isn’t a movie-style hacker targeting your house. It’s that one of these devices ships with a vulnerable firmware, gets swept up in a botnet, and starts scanning whatever network it sits on. On a flat network, “whatever network it sits on” includes the NAS, the laptops, and every unlocked service you run. On a segmented network it includes the other IoT devices and nothing else.
Chatty devices degrade the network for everything else. A handful of devices doing constant multicast and broadcast traffic is background noise at 10 devices and a real airtime tax at 80. Moving them to their own SSID lets you tune that network differently (more on that below) without punishing the devices you actually care about being fast.
The network layout
The design is boring, which is the point. This is the general shape, shown as a generic example (network names are illustrative and VLAN numbers are left out on purpose):
| Network | Who lives here |
|---|---|
| Trusted | Laptops, phones, NAS, Home Assistant |
| IoT | Smart devices |
| Cameras (if you have them) | IP cameras and recorder traffic |
| Guest | Visitors’ devices |
Two decisions worth calling out:
Home Assistant belongs on the trusted side, not the IoT VLAN. You’ll see people put HA on the IoT network “with the devices it talks to.” That’s backwards. HA is the most trusted, most capable box in the whole system — it holds credentials for everything. It belongs on the trusted side, reaching into the IoT VLAN through firewall rules, not sitting among the devices it supervises.
IP cameras are worth their own VLAN rather than sharing the IoT one. Camera traffic is high-bandwidth and continuous, and cameras are often the least trustworthy hardware on a network. Splitting them out lets you set one internet policy for the whole camera network without writing per-device exceptions, and their traffic doesn’t drown out the stats for everything else.
Wireless networks get their own SSID per VLAN. For the IoT SSID, a 2.4GHz-only network with band steering off and conservative minimum data rates suits cheap radios, because a bargain-bin plug with a terrible radio doesn’t respond well to aggressive airtime policies. Check WPA3 support before enforcing it there: plenty of budget devices still fail to join a WPA3-only network.
The firewall rules that make it work
The core policy is one sentence: trusted can reach IoT, IoT cannot reach trusted, and established connections can answer back.
In UniFi’s zone-based firewall this comes out to roughly the following. (The zone matrix also has an auto-allow-return-traffic option for some zone pairs; the rules are written out explicitly here so the logic is visible, and the exact UI differs between Network application versions.)
1. ALLOW LAN (Trusted) → IoT # HA, laptops can reach devices
2. ALLOW IoT → LAN (established/related only)
3. ALLOW IoT → IoT # devices can talk to each other
4. BLOCK IoT → LAN # everything else, dropped
5. BLOCK IoT → Gateways/Router UI # no config pages for you
Rule 2 is the one people miss, and its absence produces the most confusing failure mode: HA can send a command to a device (rule 1 allows the outbound packet), the device turns on, and then its state in HA shows unavailable — because the return traffic and the device-initiated updates are being dropped by rule 4. Lights that obey commands while showing as dead in the dashboard. If you see that exact symptom, it’s your established/related rule.
The order matters. Allow rules before block rules, and the “block IoT from reaching the gateway’s management interfaces” rule earns its place the first time you realize your smart TV can otherwise browse to your router’s login page.
ESPHome devices deserve a specific note: the ESPHome native API is HA-initiated — HA opens a TCP connection to the device, by default on port 6053 (ESPHome docs). That flows through rule 1 and works with no special handling. With MQTT instead, the devices initiate connections toward a broker; if that broker sits on the trusted LAN you need a pinhole rule for port 1883.
mDNS: where the time goes
The firewall rules are the quick part. Multicast discovery is where the time goes.
mDNS (the thing behind Chromecast discovery, HomeKit, AirPlay, and ESPHome’s .local hostnames) is link-local by design. It does not cross VLANs. The moment the devices move, every phone in the house loses the ability to cast.
UniFi’s answer is mDNS reflection (under Settings → Networks, as a per-network multicast DNS / mDNS proxy setting; the label and location vary by Network application version, and it needs a UniFi gateway). Turn it on for the pair of networks that need to discover each other, and the gateway repeats mDNS announcements across them. Three quirks:
-
Reflection is not instant or reliable for every service type. Some services show up quickly; others can take multiple announce cycles to appear after a restart. If discovery seems broken, wait before you start changing settings, or you’ll be debugging two changes at once.
-
Reflection announces the device, but the follow-up connection still needs a firewall path. Discovery tells your phone the Chromecast exists at some IP; the actual cast session is a unicast connection to the Chromecast. Phone is on trusted, Chromecast on IoT, rule 1 allows it. But if you’re trying to make guest network casting work, you need both reflection and an allow rule from guest to those specific hosts — and at that point it’s reasonable to decide guest casting isn’t worth the exception.
-
Don’t reflect more than you need. Turn on mDNS everywhere and the trusted network’s service browser fills with every IoT device’s announcements — exactly the multicast chatter segmentation is meant to contain. Reflect between the two networks that need it and leave the camera and guest VLANs out of it.
ESPHome’s .local hostnames stop resolving from a laptop on the trusted network until reflection is on. HA itself doesn’t notice if the ESPHome devices were added by static IP, which leads to: give every IoT device a fixed IP reservation. When discovery is flaky — and cross-VLAN, it will occasionally be — static addressing is what keeps the automation layer indifferent to it.
Who gets internet, and who doesn’t
Segmentation makes a second policy possible: per-group internet access. A group of IoT devices can have no internet access at all, enforced by a block rule on a UniFi device group.
Blocked entirely, works perfectly: all ESPHome boards (local API only), Zigbee and Z-Wave devices never touch IP anyway, robot vacuums that keep their map on the device, and most smart plugs after their firmware is current.
Needs internet, grudgingly: devices whose only integration path is a cloud API (many thermostats, for example), anything with a voice assistant in it, and the TV — which technically works offline but degrades into nagging.
The test method: block the device, use it normally for a week, see what breaks. The failure modes are usually loud (app shows device offline) or silent-but-fine (device keeps doing local automation and simply stops reporting to its mothership, which is the goal). Some devices react badly to a long stretch without their cloud, up to resetting themselves. Hardware like that is a candidate for replacement with ESPHome-flashable devices rather than for getting its internet back.
What it buys you
Real observability. One screen shows exactly which IoT device is talking, how much, and to where.
A meaningful security boundary. A compromised bulb can scan the other bulbs. The NAS, the laptops, the HA credentials — different network, default-deny.
A calmer trusted network. Multicast noise from the device swarm stays on the IoT side.
Cleaner WiFi tuning. IoT SSID tuned for cheap 2.4GHz radios, trusted SSID tuned for throughput. Before segmentation those goals fight each other on one network.
What it costs
Every device onboarding gets slower. New device setup apps assume your phone and the device share a network. The dance becomes: join phone to IoT SSID, run setup, assign the IP reservation, move phone back. A few extra minutes, every device, forever. With a lot of devices and a steady churn of replacements, this is the tax you feel most.
Cloud-first devices misbehave in creative ways. Devices that assume phone-and-device-on-same-LAN for ongoing control (not just setup) either need the phone app to fall back to cloud relay — slower, sometimes broken — or need a firewall exception. Keep a short, documented list of pinhole rules and audit it now and then. It rarely gets shorter.
You will debug discovery again. After a UniFi Network application update, check that casting still works. If it doesn’t, toggling mDNS reflection off and on is the first thing to try.
Complexity has a maintenance cost. The firewall rules, the reservations, the device groups — that’s all state that has to live in a notes file. Flat networks have no such file.
Is it worth it
Yes — but do it in one go instead of letting it sprawl, and write the device inventory first. The single most useful artifact from the whole project isn’t a firewall rule; it’s the spreadsheet of every device, its MAC, its reserved IP, and whether it needs internet. Segmentation forces you to make one.
If you’re on the fence: start with just two networks, trusted and IoT, with the three rules from above. Cameras-on-their-own-VLAN and per-device internet policies can come later. The 80/20 of the whole project is IoT-can’t-reach-LAN plus established/related — an afternoon of work, most of a flat network’s risk retired.
Related guides: Fixing an unreliable Zigbee mesh · Monitoring the smart home with Uptime Kuma