avahi-publish
Register mDNS/DNS-SD services and address mappings
TLDR
Register a service on the local network
SYNOPSIS
avahi-publish -s [options] name service-type port [TXT data ...]
avahi-publish -a [options] hostname address
DESCRIPTION
avahi-publish is a command-line utility for registering mDNS/DNS-SD services or hostname-to-address mappings through the Avahi daemon. It enables network service advertisement and hostname resolution on local networks using mDNS (Multicast DNS) and DNS-SD (DNS Service Discovery) protocols.
The tool operates in two primary modes:
Service Registration Mode (-s): Registers a network service by specifying a DNS-SD service name (e.g., "Web Server"), a service type (e.g., http.tcp), and an IP port number. Optional TXT record strings can be appended to provide additional service metadata like path, version, or configuration parameters.
Address/Hostname Registration Mode (-a): Registers a mapping between a fully qualified hostname and an IPv4 or IPv6 address, enabling name resolution via mDNS.When started, avahi-publish connects to the Avahi daemon and maintains the registration until the process is terminated. The registration is automatically withdrawn when the process exits.
Service types follow the DNS-SD naming convention: _service._proto where service identifies the application protocol (http, ssh, ftp) and proto is either tcp or udp. For example, _http._tcp for HTTP services or _ssh._tcp for SSH.
By default, services are published in the .local domain, but this can be changed using the --domain option. The tool also supports service subtypes via --subtype, allowing additional service categorization.
PARAMETERS
-s, --service
Register a service (requires name, service type, and port)-a, --address
Register hostname-to-address mapping-v, --verbose
Enable verbose output with detailed information-H, --host=HOSTNAME
Specify remote host name for the service-d, --domain=DOMAIN
Publish in specified domain (default: .local)--subtype=SUBTYPE
Add subtype registration to the primary service type (repeatable)-R, --no-reverse
Skip publishing reverse (address-to-name) entry-f, --no-fail
Continue and reconnect if daemon becomes unavailable-h, --help
Display help information-V, --version
Show version information
CAVEATS
Requires avahi-daemon to be running. The registration persists only while the avahi-publish process is active; terminating the process removes the service advertisement. For persistent service registration, use service definition files in /etc/avahi/services/.
SEE ALSO
avahi-publish-service(1), avahi-publish-address(1), avahi-resolve(1), avahi-browse(1), avahi-daemon(8)
