1

I'm trying for 2 days to get the Avahi to work. I want to publish my web application on SBC with Debian 10.13 (kernel 5.10.77) but when I do avahi-browse -a -r -t I always get:

+   eth1 IPv4 My application                                Web Site             local
Failed to resolve service 'My application' of type '_http._tcp' in domain 'local': Timeout reached
Failed to resolve service 'My application' of type '_http._tcp' in domain 'local': Timeout reached

Otherwise I see other mDNS devices in network (e.g. printers).
Avahi version: 0.7

What I did for installation:

sudo apt install avahi-daemon avahi-autoipd libnss-mdns  
sudo nano /etc/avahi/services/web.service

content of the web.service:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

<!-- See avahi.service(5) for more information about this configuration file -->

<service-group>

  <name>My application</name>

  <service protocol="ipv4">
    <type>_http._tcp</type>
    <domain-name>local</domain-name>
    <host-name>myapp.local</host-name>
    <port>80</port>
  </service>

</service-group>

What I tried/checked:

journalctl of avahi-daemon:

May 15 08:34:50 G100-sn1112 systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Process 391 died: No such process; trying to remove PID file. (/run/avahi-daemon//pid)
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Found user 'avahi' (UID 106) and group 'avahi' (GID 112).
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Successfully dropped root privileges.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: avahi-daemon 0.7 starting up.
May 15 08:34:50 G100-sn1112 systemd[1]: Started Avahi mDNS/DNS-SD Stack.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Successfully called chroot().
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Successfully dropped remaining capabilities.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Loading service file /services/web.service.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Joining mDNS multicast group on interface eth1.IPv4 with address 169.254.5.245.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: New relevant interface eth1.IPv4 for mDNS.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::c8ea:18ff:fe7d:364e.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: New relevant interface eth0.IPv6 for mDNS.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Joining mDNS multicast group on interface eth0.IPv4 with address 172.20.100.113.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: New relevant interface eth0.IPv4 for mDNS.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Network interface enumeration completed.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Registering new address record for 169.254.5.245 on eth1.IPv4.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Registering new address record for fe80::c8ea:18ff:fe7d:364e on eth0.*.
May 15 08:34:50 G100-sn1112 avahi-daemon[826]: Registering new address record for 172.20.100.113 on eth0.IPv4.
May 15 08:34:51 G100-sn1112 avahi-daemon[826]: Server startup complete. Host name is G100-sn1112.local. Local service cookie is 2396255796.
May 15 08:34:52 G100-sn1112 avahi-daemon[826]: Service "My application" (/services/web.service) successfully established.

In /etc/avahi/avahi-daemon.conf

use-ipv6=no
publish-resolv-conf-dns-servers=yes

In /etc/systemd/resolved.conf

MulticastDNS=no

systemd-resolved is disabled.

In /etc/dnsmasq.conf

local=/local/
domain=local
expand-hosts
server=/local/

I tried also to disable dnsmasq service

Checked /etc/nsswitch.conf

files mdns4_minimal [NOTFOUND=return] dns

I tried also to install libnss-resolve
I tried to use mdns (not minimal) in nsswitch.conf and create /etc/mdns.allow with

.local.
.local

host -t SOA local returns: Host local not found: 3(NXDOMAIN)

Output of ps aux | grep [a]vahi

avahi-a+   704  0.0  0.2   2176  1356 ?        S    08:33   0:00 avahi-autoipd: [eth1] bound 169.254.5.245
root       705  0.0  0.0   2036    88 ?        S    08:33   0:00 avahi-autoipd: [eth1] callout dispatcher
avahi      826  0.0  0.6   6132  3412 ?        Ss   08:34   0:00 avahi-daemon: running [G100-sn1112.local]
avahi      827  0.0  0.3   5868  1552 ?        S    08:34   0:00 avahi-daemon: chroot helper

The SBC has two ethernet ports. It's configured as "router" with NAT (eth0 is DHCP client, eth1 is static. I do masquarade from eth1 to eth0). The avahi is automatically configured only on port eth1, but I need it on the port eth0...
Output of ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.100.113  netmask 255.255.255.0  broadcast 172.20.100.255
        inet6 fe80::c8ea:18ff:fe7d:364e  prefixlen 64  scopeid 0x20<link>
        ether ca:ea:18:7d:36:4e  txqueuelen 1000  (Ethernet)
        RX packets 22948  bytes 4738293 (4.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15524  bytes 6667160 (6.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 39  

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether ca:ea:18:7d:36:4f  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 38  

eth1:avahi: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 169.254.5.245  netmask 255.255.0.0  broadcast 169.254.255.255
        ether ca:ea:18:7d:36:4f  txqueuelen 1000  (Ethernet)
        device interrupt 38  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 22539  bytes 1328129 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22539  bytes 1328129 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

For some reason avahi-autoipd bind LL IP first for eth1. After that binding for eth0 fail (autoipd is in sleep state) because "Routable address already assigned, sleeping.". Running avahi-autoipd eth0 --force-bind -D creates LL IP also on eth0, but resolving still doesn't work.

I also found that resolving of hostname.local (in my case g100-sn1112.local) works. But myapp.local not.

2
  • Do you really need avahi-autoipd at all? It has no relevance to mDNS resolution. Commented May 15, 2023 at 14:43
  • I wasn't sure, but I had weird problem, that after reboot the avahi publish didn't work at all and I had to restart avahi-daemon service manually. I will try more tests.
    – Daniel
    Commented May 16, 2023 at 6:33

1 Answer 1

0

It looks like I finally found the problem. For using mDNS hostname other then computer hostname, it's not enough to configure it in the service file. After setting host-name=myapp in /etc/avahi/avahi-daemon.conf I can finally resolve locally the myapp.local.

But still I don't see this mDNS name on network (from notebook). UPDATE: This problem looks like problem in the network intself. After connecting directly to SBC, the mDNS works fine.

P.S. the avahi-autoipd is really not necessary.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .