LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

avahi-resolve

Resolve mDNS hostnames and addresses

TLDR

Resolve a hostname to an IP address
$ avahi-resolve -n [hostname.local]
copy
Resolve a hostname to an IPv4 address only
$ avahi-resolve -4 -n [hostname.local]
copy
Resolve a hostname to an IPv6 address only
$ avahi-resolve -6 -n [hostname.local]
copy
Resolve an IP address to a hostname (reverse lookup)
$ avahi-resolve -a [ip_address]
copy
Resolve several names at once
$ avahi-resolve -n [host1.local] [host2.local]
copy

SYNOPSIS

avahi-resolve [OPTIONS]

DESCRIPTION

avahi-resolve translates between mDNS/DNS-SD hostnames and IP addresses using the Avahi daemon. It supports two resolution modes: forward lookup (--name) resolves a hostname like myhost.local to its IP address, while reverse lookup (--address) resolves an IP address back to its mDNS hostname.The tool queries the local network using multicast DNS rather than traditional unicast DNS servers. Resolution is limited to the local network segment where mDNS traffic is visible. Results can be filtered to IPv4 only (-4) or IPv6 only (-6).

PARAMETERS

-n, --name hostname

Resolve hostname to IP address
-a, --address ip
Resolve IP address to hostname (reverse lookup)
-4
Resolve to IPv4 addresses only
-6
Resolve to IPv6 addresses only
-v, --verbose
Enable verbose output

INSTALL

sudo apt install avahi-utils
copy
sudo dnf install avahi-tools
copy
sudo apk add avahi-tools
copy
sudo zypper install avahi-utils
copy

CAVEATS

Only works with mDNS-enabled hosts (typically using .local domain). The Avahi daemon must be running. Network firewalls may block mDNS traffic (port 5353/UDP).

HISTORY

avahi-resolve is part of the Avahi package, providing mDNS/DNS-SD name resolution on Linux.

SEE ALSO

RESOURCES

Copied to clipboard
Kai