Instead of accessing a Raspberry Pi by it's IP address I find it easier to assign it a
I work on a Mac which comes with Bonjour. On the Raspberry Pi I use Avahi.
Fist update your pi:
$ sudo apt-get update
Installing Avahi is as simple as typing the following command from your RPI's terminal:
$ sudo apt-get install avahi-daemon
After installation you don't have to reboot the Raspberry Pi, it will answer to local network queries for its hostname at raspberrypi.local.
If you want to change the default hostname of your Raspberry Pi from raspberrypi to something else you need to first change the hostname.
Open the hostname file:
sudo nano /etc/hostname
Change raspberrypi to whatever you want- as an example I will use minipi.
The next step is to edit the
sudo nano /etc/hosts
And then, find the line that declares the hostname:
Change it to whatever you used before:
Next, we need to commit the changes:
NOTE: You might get an error after executing the previous command:
sudo: unable to resolve host raspberrypi
Validation, it can't resolve the old name since we changed it.
If you run the
hostname command you should see printed the new name in the terminal:
$ hostname minipy
And reboot the machine:
From your main computer, you can now you should be able to
ssh into the box using the local domain: