I've got a Raspberry Pi Zero V1.2 that is plugged into a powered USB hub that in turn is plugged into my router via Ethernet cable. (Basically like this.)
On my desktop computer, running Arch Linux, when I try running ssh pi@raspberrypi to connect to the Pi, I get this error: ssh: Could not resolve hostname raspberrypi: Name or service not known.
On the Pi, when I run hostname or cat /etc/hostname, the output is raspberrypi.
And here's the output of cat /etc/hosts:
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi
On my Arch Linux computer, I can connect to the Pi Zero using its IP address on my network by running ssh pi@192.168.1.7.
What must I do to SSH into my Pi using its hostname too?
update
The output of cat /etc/hosts on my Arch machine is this...
# Static table lookup for hostnames.
# See hosts(5) for details.
ssh pi@raspberrypi.localon my Arch Linux computer gets the same error. I've got theavahipackage already installed on my Arch Linux. I'm not sure exactly what you mean about my router. But when I navigate to 192.168.1.1 in my browser and log into the router, then click "Attached devices" I see a table showing the Pi's IP address, device name and MAC address, – Username Aug 03 '20 at 22:05ssh 192.168.1.4, I get this error:ssh: connect to host 192.168.1.4 port 22: Connection refused. – Username Aug 05 '20 at 03:33avahi-daemonis already installed on the Pi if that's what you're asking. – Username Aug 08 '20 at 21:26