Avahi not honoring its own /etc/avahi/hosts on the same machine
1
vote
1
answer
1656
views
# scenario
I want to use a mostly relatively light-weight way of associating IP addresses with hostnames.
For this, I've installed Avahi and mdns/nss on my Fedora distro.
I've like to use the pseudo-tld ".o" as a local domain, and not the default ".local".
In
/etc/nsswitch.conf
I've made sure that mdns4
is set:
hosts: files myhostname mdns4 [NOTFOUND=return] resolve [!UNAVAIL=return] dns
In /etc/avahi/avahi-daemon.conf
I changed one line and left everything unchaged:
domain-name=o
As my host name is desk
this should make the domain desk.o
available. That's my understanding, anyway.
Finally, in /etc/avahi/hosts
, I've set one IP-hostname relation:
192.168.0.1 router.o
# expected behavior
Assuming my machine's name is desk
, I'd expect the domain desk.o
to be available.
Furthermore, I have machines in my network, which are unable to have their own Avahi running on them, so I'd use /etc/avahi/hosts
to annouce those IP addresses, etc. One reason being, I have a pretty old network printer, which simply can't run Avahi, and I just have to use either the IP or something like Avahi (or just an entry in /etc/hosts
).
So with the hosts
file above, I'd expect router.o
to be resolved to 192.168.0.1, etc.
# observed behavior
I've restarted Avahi after making any changes (systemctl restart avahi-daemon.service
), but the way thing work is a little strange:
When running getent hosts desk.local
I get this:
2a02:xxxx:xxxx:xxxx:xxxx:xxxx:8878:583d desk.local
fe80::f990:519a:4ba5:9f22 desk.local
*(first IP partially obfuscated. Where there's an x
, there were just hex digits)*
I'm fine with this (mostly), I wouldn't expect to desk.local
be still available, but I'm assuming it's some sort of default that I can't get rid of (for now).
When running getent hosts desk.o
I get:
127.0.0.1 desk.o
This is fine, as long as it's only on this machine, but it's a little odd to me, the FQDN hostname resolved to this.
When running getent hosts router.o
I get nothing. Just no output.
# questions
So, apparently Avahi is ignoring /etc/avahi/hosts
? I've restarted Avahi after making changes to that file, so I was assuming it'd be re-read.
Is Avahi not "publishing" the set hostnames to itself?
How to make Avahi and my system behave as I'd expect? Or am I having a fundamental thinking error here?
----
Ideally, an Avahi-hostname file would be somewhere in my $HOME
, such that I don't have to adjust a system-wide hostname file for Avahi, if that makes sense. If that won't work, it's fine, since that'd go against the way hostname resolution works in principle, I suppose.
What kinda surprised me a little, is that desk.o
is getting resolved (not as I'd expect it, really), but at least it resolves to *something* so it's at least partially working.
Asked by polemon
(11921 rep)
Sep 16, 2022, 12:20 AM
Last activity: Aug 29, 2024, 09:15 AM
Last activity: Aug 29, 2024, 09:15 AM