I am trying to grasp the purpose of static versus dynamic addressing, specifically when applied to private network. I am using SSH to connect from my PC to RPi via Ethernet.

The RPi has static IP which I simply type as parameter to ssh like this:

os64@os64-desktop:~$ ssh [email protected] 

I have not figured out how to use DNS to name this connection. I do not see any such configuration in raspi-config to associate DNS with SSH.

How can this be accomplished with commands - using SSH as test bed?

2 Answers 2


On your local network you won't necessarily need to use DNS to access the Pi via a different host name. The .local domain, has been officially reserved as a Special-Use Domain Name (SUDN) specifically for the purpose of internal network usage. This way your custom local names don't conflict with existing external addresses.

This will require a service discovery process running on a local network via the mDNS/DNS-SD protocol suite. This could quite possibly already be running on your home router. If not you can install Apple's popular 'Bonjour' local network discovery service either on a Mac or on a windows machine. Of course you could always install it on the Pi as 'Avahi' using sudo apt-get install avahi-daemon

However, lets assume that there is a mDNS service already running, so straight out of the box the Pi should be able to be accessed using the host name raspberrypi. Because it is on your local network you would use raspberrypi.local

Therefore from your PC you would access it using;

ssh [email protected]

To change the host name for the Pi you can either edit /etc/hosts and /etc/hostname using sudo and nano, changing 'raspberrypi' for a name of your choice (then reboot for it to take effect);

sudo nano /etc/hostname
sudo nano /etc/hosts

... or you can do it via sudo raspi-config where you first select 'Network options' and then 'Hostname'.

  • Thanks. localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters pi
    – Jan Hus
    Aug 10, 2018 at 22:35

Posted here because it would not fit in as comment

Thanks for very comprehensive reply. Since I already had “host” name “pi” assigned in raspi-config it was just a matter of me using wrong syntax.

os64@os64-desktop:~$ ssh [email protected]

The authenticity of host 'pi.local (' can't be established.
ECDSA key fingerprint is SHA256:2hEjoJUeySW/Qqo3d+eV0DEAMX6Ob+9s8W/78/wG2jM.
Are you sure you want to continue connecting (yes/no)? Yes 
Warning: Permanently added 'pi.local' (ECDSA) to the list of known hosts.
[email protected]'s password: 

And this is my current contents of /etc/hosts       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters       pi

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