0

On a local LAN, I am trying to ssh into a freshly installed Raspberry Zero WH, by host name. I am connecting from an Ubuntu box.

The Rasbperry Pi does boot, and connects to the Wifi. I can see it in my PfSense firewall/router page "Status: DHCP leases" as up and running with it's IP address and host name. It's online and the lease type is static.

Now when I do

$ ssh pi@raspberrypi-zero-wh

I immediately get

ssh: connect to host raspberrypi-zero-wh port 22: Connection refused

However, I can ping it successfully ping it with this host name and immediately get a response.

$ ping raspberrypi-zero-wh
PING raspberrypi-zero-wh.my.lan (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.029 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.063 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.064 ms

I can also ssh into it by IP:

$ ssh [email protected]
[email protected]'s password: 

Why does ssh work by IP, but no by host name?

Note:

2 Answers 2

2

You think that raspberrypi-zero-wh is that name of your Raspberry Zero WH, but as can be seen in the output of the ping command, that name resolves to 127.0.0.1.

So you don't try to connect to the Raspberry Zero WH, you try to connect to the computer running the ssh command.

It seems to be a problem with the assignment of the DNS name.

2
  • Good spot. The name is given by the pfSense, which is NOT my immediate DNS resolver. As mentioned, a PiHole is, which uses the pfSense upstream. I'll look into the PiHole log to find more.
    – Marcel
    Commented Jul 2, 2019 at 6:55
  • It was indeed a problem with DNS. In my DNS server (phihole), I had to whitelist the qualified domain raspberrypi-zero-wh.my.lan. Without that it had been blocked by my quite strict rules.
    – Marcel
    Commented Jul 3, 2019 at 19:54
0

raspberrypi-zero-wh Which I assume is your hostname is meaningless.

Try raspberrypi-zero-wh.local which should be resolved by zero-conf on a standard Raspbian and is supported by most Linux distributions.

2
  • Does your suggestion assume I am connecting from a Raspberry? I am connecting from an Ubuntu box TO a Raspberry.
    – Marcel
    Commented Jul 2, 2019 at 6:54
  • I made no assumption, other than assuming zero-conf was on both platforms
    – Milliways
    Commented Jul 2, 2019 at 7:03

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.