I am using a Raspberry Pi Zero 2W for some development, and am having trouble with headless operation through SSH.

The usual method is via "ssh [email protected]". This is on and off functional for me, and I often have to resort to connecting a monitor etc. to find the IP address.

The error when ".local" doesn't work is "ssh: Could not resolve hostname ccp.local: name or service not known".

I have found this guide about using Bonjour and Avahi, which I implemented at least a year ago, and still get the exact same problem here and there.

I have also tried this and this guide regarding setting up ssh over USB, then attempting ssh via both command line and PuTTY, which again results in the above error when using command prompt, and the error "Unable to open connection to raspberrypi.local. Host does not exist".

Using the IP address instead of raspberypi.local seems to always work, but the intended use case for the pi is rather reliant on headless being functional upon startup.

Does anyone know why this is so unreliable?

  • Feels like raspberry unrelated question and should be asked in networking community. Have you tried to check if the issue affects other hosts in your network? Are there other Pis in your network?
    – Vadim
    Apr 10, 2023 at 18:28

3 Answers 3


This happens occasionally. The .local resolution works by sending a broadcast message.

The problem is not with the Pi (it affects other devices) and appears to be related to address caching.

The only reliable solution is to restart the router and occasionally the target device.

arp probing can explore the issue and may resolve it.

  • This is at an office that I believe has several repeaters or access points, and has occurred over the course of at least a year, likely a year and a half in varying degrees. Is arp probing then a good method of finding the IP of the connected RPI? Thanks for the tip though, I'll certainly give it a try. Apr 14, 2023 at 9:48

My experience has been mostly similar to Milliways. However, I have found that one thing seems to help:

Your hostname is stored in /etc/hostname; in my case /etc/hostname contains the following:

$ less /etc/hostname

Make sure that the file /etc/hosts contains at least this reference to as the final entry:       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters       raspberrypi3b.local

Note that you can add additional hostnames here, so I always put this in for the final line of /etc/hosts:

...       raspberrypi3b.local raspberrypi3b

I've found that this gives me more reliable name resolution under avahi.

  • Had a look at the hosts file, and it seems like it's identical to your example, save that the last line is " raspberrypi" rather than " raspberrypi.local", if that is of any significance? In any case I have appended it as suggested and will give that a try. Apr 14, 2023 at 10:02
  • @DanielGodø-Dempsey: It might be significant; the bit is unique to Debian-based distros AFAIK, and the documentation is not entirely clear. It seems to have helped in my case.
    – Seamus
    Apr 15, 2023 at 0:30

In addition to the suggestions by other commenters, I found a thread discussing what seemed to be a fairly similar problem, where installing the package called "Samba" was suggested for Windows users. This solved the immediate issue for me.

Here is the thread I found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.