Skip to main content
IT BIBLESign in

Forum / Security / Network & Endpoint Security

Default-deny for an IoT VLAN on OPNsense, but mDNS still has to work

RackGhostDwayne OP
#1

The question: how do you set default-deny between an IoT VLAN and everything else, and still let casting and discovery work for the two or three devices that need it? I have a method, but I would like to compare it with yours.

The problem is that discovery does not cross subnets. mDNS is multicast to 224.0.0.251 on UDP 5353, and routers do not forward it by design. Put a phone on the main LAN and a speaker on the IoT VLAN, and the phone never sees the speaker. Firewall rules alone will not fix that. Think of shouting down a hallway when the door is shut. Opening the door is a different job from deciding who may walk through.

My order of work:

  1. Build the deny first. On the IoT interface, allow DHCP and DNS to the firewall, then block IoT to all private networks, then allow the rest to the internet. Rule order matters, because OPNsense evaluates top down and the first match wins.
  2. Add the reverse direction narrowly. The trusted LAN may start connections to specific IoT hosts. Return traffic is handled by state, so IoT does not need a rule back.
  3. For discovery, I use the mDNS repeater plugin and limit it to the two interfaces involved. I do not remember every menu, so check your own version.
  4. Then read the capture. If the query goes out and the answer never comes back, a rule is blocking it, not the repeater.

The cost is that a repeater reflects every announcement, so you are trusting it to be boring. Some casting still fails, because the stream itself comes from the device back to the phone on high ports. That is where I have not found a clean rule yet, and I end up opening a few narrow ones.

What do you do for casting devices, a repeater or a rule that pins them to the main LAN? And have you found a way to keep the return-stream rules tight?

Sign in to reply.