I suggest the following method without avahi installation. But using usual dns client.
Install dig. and make the query
# dig -4 @224.0.0.251 -p 5353 debian12-c1.local
it will tell the error but it doesnt matter
;; communications error to 224.0.0.251#5353: timed out
at the second terminal launch tcpdump like so
# tcpdump -n 'udp port 5353' -i enp0s3
07:25:12.670775 IP 172.16.10.12.36417 > 224.0.0.251.5353: 41633+ [1au] A (QM)? debian12-c1.local. (58)
07:25:12.672696 IP 172.16.10.11.5353 > 172.16.10.12.36417: 41633*- 1/0/0 A 172.16.10.11 (51)
you can clearly see the answer
debian12-c1.local. has IP=172.16.10.11
===
Another way to make mdns queries without avahi installation is clumsy but usually doesnt need to install anything in addition. If you use systemd-resolved for dns resolution then it has mdns server+mdns client. You just need to activate it.
Step one
check if mdns is activated in global section
# resolvectl status | grep Global -A1
Global
Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
we see +mDNS
if it differs then create a file
# cat /etc/systemd/resolved.conf.d/global.conf
[Resolve]
MulticastDNS=yes
and restart the daemon, check again
Step Two
You need to activate mdns on an interface, for instance enp0s3
# resolvectl mdns enp0s3 yes
check the setting
# resolvectl status | grep enp0s3 -A1
Link 2 (enp0s3)
Current Scopes: DNS mDNS/IPv4 mDNS/IPv6
we see mDNS in "Current Scopes"
This setting survives the daemon restart but does not survive pc restart.
If everything okay we will have two things:
first one - ip multicast address appears on enp0s3
# ip -4 maddr show dev enp0s3
2: enp0s3
inet 224.0.0.251 <=====
inet 224.0.0.1
the second one, "systemd-resolved" starts listening the socket * UDP 5353
# lsof -n -P -p $(pidof systemd-resolved) | grep UDP | grep 5353
UDP *:5353
UDP *:5353
Everithyng is ready.
Now you can make mdns queries by using systemd-resolved via general dns clients:
# resolvectl query debian12-c2.local
debian12-c2.local: 172.16.10.12 -- link: enp0s3
or
# dig -4 @127.0.0.53 debian12-c2.local
..
..
;; ANSWER SECTION:
debian12-c2.local. 80 IN A 172.16.10.12
or
# getent ahostsv4 debian12-c2.local
172.16.10.12 STREAM debian12-c2.local
As for my knowledge, it is not possible to set systemd-resolved to work in mdns client-only mode. It works in mdns client+server mode or doesnt work at all.