I have connected a raspberry pi 4 running ubuntu 20.04 to my local LAN over wifi.
From my laptop I can SSH to the raspberry just fine with:
$ ssh ubuntu@192.168.0.47
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1022-raspi aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
...
Instead of having to type that IP each time I would like to be able to SSH to it using the hostname: rasp01
. I have found this guide:
https://thepihut.com/blogs/raspberry-pi-tutorials/19668676-renaming-your-raspberry-pi-the-hostname
that I have followed. After I have rebooted the raspberry pi and logged into it I have this:
ubuntu@rasp01:~$ hostname
rasp01
ubuntu@rasp01:~$ cat /etc/hosts
rasp01 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
ubuntu@rasp01:~$ cat /etc/hostname
rasp01
But when I try to use that hostname when I SSH to the raspberry from my laptop on the same LAN (also running ubuntu) I get:
$ ssh ubuntu@rasp01
ssh: Could not resolve hostname rasp01: Name or service not known
$ ssh ubuntu@rasp01.local
ssh: Could not resolve hostname rasp01.local: Name or service not known
$ ssh ubuntu@rasp01.local.
ssh: Could not resolve hostname rasp01.local.: Name or service not known
What am I missing?