tiny-mdns-ann is a lightweight shell utility to announce device's .local hostname and network services via mDNS.
Hostname can then be resolved by any machine supporting mDNS/Avahi LAN discovery.
tiny-mdns-ann only depends on netcat, as found in busybox, or other standalone implementations.
It merely sends unsolicited UDP announcement packets, and does not answer queries.
It is a best-effort lightweight announcer, and is not intended as a replacement for fully compliant mDNS responder.
- hostname LAN IP address resolution
- optionally advertises
httpandsshservices - IPv4 and IPv6 support
- OpenRC and Systemd services
- extremely small footprint
- runs under POSIX shell
- compatible with busybox's
nc - leverages
socatif available, for more robust announcements
Make script executable and run tiny-mdns-ann on device as follows:
usage: tiny-mdns-ann [OPTIONS]
Announce HOSTNAME.local over mDNS on active interfaces.
Options:
--help Show this help.
--host NAME Host name to announce in the .local domain.
--http[=PORT[,PATH]] Advertise HTTP, default port 80, path /.
--ssh[=PORT] Advertise SSH, default port 22.
Environment:
INTERVAL Announcement interval in seconds, default 60.
ADVERTISE_IPV6 Enable IPv6 announcements, default 1.
DEBUG_LOG Log each announcement, default 0.
Main execution steps are logged: grep tiny-mdns-ann /var/log/messages.
OpenRC and Systemd services files are provided to run tiny-mdns-ann as a boot service.
A complete Alpine Linux package is also in the works.
Note & limitations:
- As
ncdoes not allow multicastttl/hop-limitcontrols, announcements do not set mDNS-required value of 255, but work just fine in most cases. - If
socatis available, it is used in place ofncto send announcements withttl/hop-limit255. - hosts with advanced networking routing setup or firewall may need to adapt settings to let mdns port 5353 free for sending announcements.