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@
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:


that I have followed. After I have rebooted the raspberry pi and logged into it I have this:

ubuntu@rasp01:~$ hostname

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 

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?

  • Unfortunately, questions about host/server configurations and protocols above OSI layer-4 are off-topic here. You could try to ask this question on Super User.
    – Ron Maupin
    Dec 11, 2020 at 23:32

1 Answer 1


The Super User section of Stack Exchange is focused on power users. It's a good resource for SOHO networking questions such as yours. This site is for network engineering professionals, so your question is actually not on-topic here.

However, there are several ways to do what you want, among them:

  • Add an entry to /etc/hosts on your workstation mapping rasp01 to
  • Configure your SSH ~/.ssh/config file, adding a host entry
  • Setup a DNS service for your home LAN, especially if your router supports integration with its DHCP server

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