Welcome to HomeKitLab · a home lab that leans toward Apple Home · everyone is welcome, whatever you run at home · Ring cameras, go2rtc, and Home Assistant · best viewed in Netscape Navigator 4.0 at 800×600 ·

How to Make Apple Home Work Across VLANs (mDNS, Avahi, and the HomeKit Ports)

NEW!

Splitting the house into VLANs is a good idea. Cameras on one, the server on another, phones and the HomePod on a third. Then Apple Home says No Response, and the bridge you just built is gone from the Add Accessory screen. The traffic that announces HomeKit accessories does not cross VLANs on its own. This page is how to let it through, and only it.

It is the last line of the troubleshooting section in the Ring guide, given room to breathe.

The page is dressed like a 1998 personal site. The VLAN numbers and addresses below are placeholders. Router menus differ by brand, so the router part is described, not clicked through.

What you need
  • Home Assistant with a HomeKit Bridge, on one VLAN. The examples use 192.168.20.0/24.
  • Apple home hubs and iPhones on another VLAN. The examples use 192.168.10.0/24.
  • Admin access to the router or firewall between them.

1 Why it breaks

HomeKit accessories announce themselves with multicast DNS, the thing Apple calls Bonjour. A HomeKit accessory, including a Home Assistant bridge, advertises a _hap._tcp service. The packets go to 224.0.0.251 on UDP port 5353, or ff02::fb on IPv6.

That address is link-local. Routers do not forward it. So a HomePod on VLAN 10 never hears the bridge on VLAN 20, even when normal traffic between them is allowed.

mDNS
How the Home app and the hub find the bridge. UDP 5353. Stops at the VLAN edge.
HAP
The HomeKit connection itself, after discovery. Plain TCP to the bridge port, 21063 for the first Home Assistant bridge. Routes fine if the firewall allows it.

2 Pick a fix

  • Same VLAN. Put Home Assistant and the home hubs on one VLAN. Nothing to reflect. Simplest, if it fits your plan.
  • The router’s mDNS reflector. Many routers and firewalls have a setting called mDNS, Multicast DNS, mDNS repeater, or Bonjour gateway. Turn it on for just the two VLANs. Check your router’s docs for the exact name.
  • Avahi on a Linux box. If the router cannot do it, a Linux machine with an interface in each VLAN can. Step 3.

Use one reflector, not two. Two reflectors between the same networks bounce mDNS packets back and forth.

3 Avahi as a reflector

This needs a Linux box with a network leg in both VLANs, usually tagged VLAN interfaces on one port. The interface names below, eth0.10 and eth0.20, are placeholders. Use yours from ip -br addr.

terminal
sudo apt install avahi-daemon avahi-utils
ip -br addr
sudo cp /etc/avahi/avahi-daemon.conf /etc/avahi/avahi-daemon.conf.bak

Then set these lines in /etc/avahi/avahi-daemon.conf. allow-interfaces keeps Avahi on just the two VLANs. enable-reflector repeats mDNS between them.

avahi-daemon.conf
[server]
allow-interfaces=eth0.10,eth0.20

[reflector]
enable-reflector=yes
reflect-ipv=no

reflect-ipv=no is the default and keeps IPv4 and IPv6 mDNS apart. There is also a reflect-filters option that limits which services get reflected. Leave it out until everything works.

terminal
sudo systemctl restart avahi-daemon
systemctl status avahi-daemon

Running Home Assistant in Docker without host networking? Same Avahi reflector on the Docker host, plus advertise_ip on the bridge set to the host’s LAN address. The HomeKit Bridge guide has that snippet.

4 Open the HomeKit ports

Discovery is only half. After the hub finds the bridge, it opens a TCP connection to it. From the hub and phone VLAN to the Home Assistant address, allow:

  • UDP 5353, mDNS. Needed if the reflector or the server firewall filters it.
  • TCP 21063, the first HomeKit Bridge.
  • TCP for every extra bridge or accessory-mode camera, each on its own port, like 21064 and 21065.
  • With HomeKit Secure Video, a random TCP port per camera that changes on every start. Allow all TCP from the home hubs to Home Assistant.
firewall-rules.txt
# from 192.168.10.0/24 (hubs and phones) to 192.168.20.50 (Home Assistant)
allow udp 5353
allow tcp 21063-21070
# HomeKit Secure Video only
allow tcp any from HOME_HUB_IPS

This is a note of the rules, not a config for any one firewall. Translate it into your router’s rule screen.

5 Check that the bridge is visible

From a Linux machine on the hub and phone VLAN, browse for HomeKit services. Each Home Assistant bridge and accessory-mode camera should be listed.

terminal
avahi-browse -rt _hap._tcp

On a Mac on that VLAN, the built-in tool does the same. It keeps running until you stop it with Ctrl+C.

terminal
dns-sd -B _hap._tcp

Listed but still No Response? Then discovery works and the TCP port is blocked. Go back to step 4.

6 Troubleshooting

The bridge never shows up on Add Accessory

Pair with the iPhone on the same VLAN as Home Assistant first. Home Assistant’s docs say the phone needs to be on the same local network for pairing. Once it is paired, move it back.

It works, then drops to No Response

Check for a second reflector, for example the router’s setting and Avahi both on. Restart the home hub after any change.

The hub tries the wrong address

A server with several interfaces can advertise an address the hub cannot reach. Set advertise_ip on the bridge to the address on the server VLAN, and ip_address if the bridge binds to the wrong interface.

Some cameras work, some do not

Each accessory-mode camera listens on its own port. A rule that only opens 21063 covers the first bridge and nothing else.

Back to the guides Home

Comments

Loading comments…