TrueNAS Discovery currently has no supported way to exclude an individual network interface from mDNS, NetBIOS, or WS-Discovery

Problem/Justification

TrueNAS Discovery currently has no supported way to exclude an individual network interface from mDNS, NetBIOS, or WS-Discovery announcements.

On systems with multiple interfaces, truenas-discoveryd automatically includes every configured interface returned by interface.query in /etc/truenas-discovery/truenas-discoveryd.conf. This includes interfaces that are intentionally isolated from the primary LAN, such as:

  • Dedicated point-to-point replication links
  • Storage-only VLANs
  • Backup networks
  • VPN or tunnel interfaces
  • Other limited-scope management networks

In my configuration, two TrueNAS systems are connected by a dedicated 10 GbE DAC link using a small point-to-point subnet. This link has no gateway, DNS service, or access to the general LAN. Once this interface is included in the discovery configuration, macOS clients intermittently fail to resolve or connect to the TrueNAS system through smb://lir.local or Finder Bonjour browsing.

The generated configuration is created by:

middlewared/etc_files/local/truenas-discovery/truenas-discoveryd.conf.py

The relevant logic appears to include every interface without filtering:

interfaces = render_ctx['interface.query']
iface_names = [i['name'] for i in interfaces]

if iface_names:
    cp.set('discovery', 'interfaces', ', '.join(iface_names))

The current Service Announcement settings under Network → Global Configuration only allow mDNS, NetBIOS, and WS-Discovery to be enabled or disabled globally. There is no per-interface control and no supported allowlist or denylist.

Manually removing the point-to-point interface from truenas-discoveryd.conf and restarting truenas-discoveryd resolves the hostname-resolution problem. However, the configuration file is middleware-generated and is overwritten after a reboot or other configuration change, including SMB share changes.

The requested improvement is either:

  1. A per-interface setting to exclude an interface from service-discovery announcements, or
  2. A global interface allowlist or denylist for mDNS, NetBIOS, and WS-Discovery.

This would be similar to the interface-binding controls already available for services such as SMB and NFS.

Impact

This feature would benefit TrueNAS users who operate systems with multiple network interfaces serving different purposes.

Common examples include:

  • Direct links between TrueNAS systems for replication
  • Dedicated storage networks
  • Backup-only interfaces
  • Cluster or heartbeat networks
  • Isolated VLANs
  • WireGuard or other tunnel interfaces
  • Separate management and client-access networks

Service-discovery announcements should normally be limited to interfaces where client discovery is expected. Advertising the system on every active interface can produce incorrect or ambiguous discovery behavior, especially when an interface has no route back to normal LAN clients.

A supported interface-selection mechanism would:

  • Improve the reliability of SMB hostname resolution and network browsing
  • Prevent service announcements from appearing on isolated networks
  • Reduce unnecessary broadcast and multicast traffic
  • Avoid unsupported manual edits to middleware-generated configuration files
  • Eliminate the need for fragile startup scripts or configuration-repair jobs
  • Give administrators better control over multihomed TrueNAS systems

The main disadvantage would be additional configuration complexity. This could be minimized by retaining the existing behavior as the default and making interface selection an optional advanced setting.

User Story

As a TrueNAS administrator with separate LAN and replication interfaces, I want to restrict mDNS, NetBIOS, and WS-Discovery announcements to my primary LAN interface so that client hostname resolution remains reliable and isolated networks are not used for service discovery.

A possible workflow would be:

  1. Open Network → Interfaces or Network → Global Configuration.
  2. Open the Service Announcement interface settings.
  3. Select which interfaces are allowed to advertise TrueNAS services, or exclude specific interfaces.
  4. Save the configuration.
  5. Middleware regenerates truenas-discoveryd.conf using only the selected interfaces.
  6. truenas-discoveryd reloads or restarts automatically.
  7. The selection persists across reboots, SMB configuration changes, and other middleware configuration renders.

For example, an administrator could allow announcements on enp5s0, which is connected to the household LAN, while excluding enp6s0, which is a direct 10 GbE replication link to another TrueNAS system.

Wow, good timing! I second this request, because I think I stumbled across the same problem today, after I switched the DHCP server from ISC to KEA on my OPNsense home router.

I have two ip addresses on my TrueNAS server and my Windows 11 client received both, but it used the secondary one (i.e. the wrong one) and unfortunately there was no way to tell TrueNAS to not return that one. The consequence was that the network mappings on my Windows client no longer worked. After I disabled mDNS in TrueNAS, the network mappings started working again.

My upvote for this request is in! :+1:

There are a few bugs in truenas_pydiscovery that are getting fixed for the next beta. This is more of a bug than a feature request (weird to hear a developer swing that way), and I’m working on it (not choosing interfaces, but cases where it’s broken and previous code worked). If you’re adventurous you can try the codebase in our current repo (for WSD-related fixes). If either of you want to poke around at fixes in general you can PM me and I can give you some rolling updates as things are fixed so that we can make sure next BETA is OK for your particular cases. At the end of the day this repo is pure python (no deps) so replacing is trivial (no compiler required).

Thanks — I would be happy to test rolling updates against my setup.

My specific configuration is a normal LAN interface plus a dedicated point-to-point 10 GbE DAC connection between two TrueNAS systems. The DAC interface has no gateway, DNS, or route to the broader LAN. Once discovery advertisements appear on that interface, macOS clients on the regular LAN intermittently receive or cache the unusable address for the TrueNAS hostname, which causes Finder and smb://lir.local connections to fail.

I understand that interface selection is separate from the regressions you are currently fixing. I would still be interested in testing the updated truenas_pydiscovery code to determine whether the current fixes resolve the immediate failure mode.

I’ll send you a PM with the system details and can provide packet captures, logs, or repeatable test results as needed.