My impression is that Ubuntu 22.04 comes with avahi preinstalled. How do I most easily check whether the machine I'm using has a .local address, and if so, what that address is? I'm asking under the assumption that the common case is a single .local address for a machine, which is the case I'm interested in.
In macOS, for instance, I would open system settings and look at the Network Settings panel which would tell me the address, which by default is automatically derived from the device's name. I can also customize it there.
The closest I've found in Ubuntu is About in Settings which tells me the Device Name, but not any potentially derived .local address.
Update
Requested information:
libnss-mdns is installed.
$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (enp3s0f2)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 3 (wlp2s0)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: [...]
DNS Servers: [...]
DNS Domain: domain.name
avahi-browse -aand this should return local services and the name in the format of+ (network device) (IPV type) (name) . . .etc. Your address would be<name>.localIn this example, "device name" refers to the network device (e.g, wlp1s0, eth0, etc) and "name" refers to the name of your computer or machine. It looks like this is the same default format as MacOS if I understand correctly. – mchid Jun 03 '22 at 21:26systemd-resolvedservice. – mchid Jun 03 '22 at 21:32libnss-mdnsinstalled? I think this may be needed if you are using the avahi method. Also, you can installmdns-scanalthough, running this command will typically show just about the same information (or less) asavahi-browse -a– mchid Jun 03 '22 at 21:42avahicommands. If you simply need your local hostname, you can runavahi-resolve-host-name -afollowed by your local IP address. For example: if your IP is 192.168.1.99,avahi-resolve-host-name -a 192.168.1.99– mchid Jun 03 '22 at 21:44avahiand then press TAB twice – mchid Jun 03 '22 at 21:44avahi-resolve -nex.avahi-resolve -n "$(hostname).local"– steeldriver Jun 03 '22 at 22:06systemd-resolveor not. Would need to runsystemd-resolve --statusto find out. This answer has more info on that. Without using systemd, you would need to installlibnss-mdnsin addition to avahi and then make surefiles mdns4_minimal [NOTFOUND=return] dns myhostnameis listed afterhostsin/etc/nsswitch.confsimilar to this description. – mchid Jun 04 '22 at 03:13hostname.localformat. Only once I have seen a deviation in a Raspberry Pi OS where avahi somehow (wrongly) determined the hostname raspberrypi was already taken and assignedraspberrypiNNN.local, where NNN was a number. The problem fixed itself on reboot of the Pi. This happened when I was switching between two versions of the OS in two SD cards where both OS had the same hostname. – user68186 Jun 06 '22 at 21:49