8

Firstable, I looked up to several Q/A, i can ensure that the following points are fullfiled:

  • IGMP snooping isn't filtered by switch/router.

  • Bonjour services (mDNSResponder.exe) is granted and allowed on the firewall as well as UDP port 5353 (windows side).

  • Avahi config is correct (plus use of ipv6 is disabled) as well as nssitch.conf needed modifications have been done

    hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

  • Avahi-daemon is running as well as bonjour services.

  • windows side ipv6 is disabled on active network interface, also avahi-daemon is configured not to use ipv6: use-ipv6=no.

Issue with Pi's mDNS

After a while the hostname .local corresponding to the raspberry pi isn't resolved anymore after issuing a ping pi.local from windows, note that on startup it responded perfectly, and a restart of avahi-daemon will fix it temporary before the issue starts again.

Just after the mdns resolve fail I executed the following on the rasp avahi-resolve -n pi.local it shows it ipv6 (fe80::xxaa:yybb:zzde:ee) which is weird because as I mentionned I have disabled ipv6 in avahi configs, right just after i reexecute the same command this time i get ipv4 as an answer

pi.local 192.168.1.7

also ping seems to respond again.

P.S.

  • Running Linux pi 4.4.38-v7+ #938

  • Using Bonjour Print Services for Windows v2.0.2: https://support.apple.com/kb/DL999, and it's running as service.

  • Disabling ipv6 only the return of avahi-resolve -n pi.local command gives 192.168.1.7 instead of ipv6 but issue remains.

Nothing in /var/log/messages concerning Avahi.

Any thoughts about the root of the problem ?

syslog after a while from restarting avahi-daemon and sending resolve command above:

18:21:47 pi systemd[1]: Stopping Avahi mDNS/DNS-SD Stack...

18:21:47 pi avahi-daemon[427]: Got SIGTERM, quitting.

18:21:47 pi avahi-daemon[427]: Leaving mDNS multicast group on
interface wlan0.IPv4 with address 192.168.1.7.

18:21:47 pi avahi-daemon[427]: avahi-daemon 0.6.31 exiting. 
18:21:47 pi systemd[1]: Starting Avahi mDNS/DNS-SD Stack...

18:21:47 pi avahi-daemon[1143]: Process 427 died: No such process;
trying to remove PID file. (/var/run/avahi-daemon//pid)

18:21:47 pi avahi-daemon[1143]: Found user 'avahi' (UID 105) and group
'avahi' (GID 110).

18:21:47 pi avahi-daemon[1143]: Successfully dropped root privileges.

18:21:47 pi avahi-daemon[1143]: avahi-daemon 0.6.31 starting up.

18:21:47 pi avahi-daemon[1143]: Successfully called chroot(). 
18:21:47 pi avahi-daemon[1143]: Successfully dropped remaining
capabilities. 
18:21:47 pi avahi-daemon[1143]: Loading service file
/services/multiple.service.

18:21:47 pi avahi-daemon[1143]: Loading service file
/services/udisks.service.

18:21:47 pi avahi-daemon[1143]: Joining mDNS multicast group on
interface wlan0.IPv4 with address 192.168.1.7.

18:21:47 pi avahi-daemon[1143]: New relevant interface wlan0.IPv4 for
mDNS.

18:21:47 pi avahi-daemon[1143]: Network interface enumeration
completed.

18:21:47 pi avahi-daemon[1143]: Registering new address record for
fe80::f2f:3b5b:ab5b:35c1 on wlan0.*.

18:21:47 pi avahi-daemon[1143]: Registering new address record for
192.168.1.7 on wlan0.IPv4.

18:21:47 pi avahi-daemon[1143]: Registering HINFO record with values
'ARMV7L'/'LINUX'.

18:21:47 pi systemd[1]: Started Avahi mDNS/DNS-SD Stack.

18:21:48 pi avahi-daemon[1143]: Server startup complete. Host name is
pi.local. Local service cookie is 2501181696. 

18:21:49 pi avahi-daemon[1143]: Service "pi"
(/services/udisks.service) successfully established.
18:21:49 pi avahi-daemon[1143]: Service "pi"
(/services/multiple.service) successfully established.
mdns
  • 81
  • 1
  • 4

2 Answers2

2

Is your Pi connected wirelessly? In my case it was wlan0 power management that caused same issue. You can check that by running iwconfig.

$ iwconfig
wlan0     IEEE 802.11  ESSID: (...)
          (...)
          Power Management:on

I discovered that when I realized I don't have to restart avahi-daemon, despite it looked like it was helping. It was enough to just ssh into the box to wake up wlan and get mdns packets through.

I ended up adding iwconfig wlan0 power off to my /etc/rc.local and that resolved the problem permanently.

pamelus
  • 121
  • 3
  • Adding `/sbin/iw wlan0 set power_save off` to your `/etc/rc.local` is arguable better as it works even if the `wireless-tools` package isn't installed – Molomby Apr 25 '22 at 03:55
1

Here is my two bits on the query:

You are doing things right.

  1. Editing/Checking your /etc/nsswitch.conf

  2. Try adding search local in your /etc/resolv.conf file

  3. You can put search-ipv6=no in your /etc/avahi/avahi-daemon.conf

  4. You can also add the IP address of your Pi to your avahi/hosts file viz.

    sudo nano /etc/avahi/hosts
    #inside the file
    192.168.1.7 pi.local
    
  5. disabling ipv6 on the interface in /etc/sysctl.conf by adding the following line:

    net.ipv6.conf.wlan0.disable_ipv6=1
    
  6. Finally, a reboot is necessary.

Shan-Desai
  • 1,463
  • 2
  • 12
  • 28
  • 1) done, 2) i don't know how neither if it is necessary or it wouldn't slow down the resolution more, 3) is already not using ipv6 on config (see my question edit btw it's `use-ipv6=no` not `search-ipv6=no`) 4) What the point of using avahi then if ip is static? 7)already done – mdns Mar 07 '17 at 18:16
  • @mdns usually adding the ip and name in host is useful when your do not want to send out discovery packets on the wireless channel. It also can be useful for tools like `ssh`. However `hosts` thing is rather user defined. – Shan-Desai Mar 07 '17 at 18:19
  • How do I know what the X will be 192.168.1.x ? i can take any ip in the range 2-253 – mdns Mar 07 '17 at 18:20
  • `hosts` file is usually for machines which do not use `avahi` for static mapping. not all machines tend to use zeroconf/avahi on them. Also in terms of resolution you can try playing with `ratelimit-burst` and `ratelimit-interval-usec` in `avahi-daemon.conf` file. but beware, that more packets on the wireless network might cause congestion with increasing number of network devices. – Shan-Desai Mar 07 '17 at 18:28