Resolve hostname with Arch linux on a Raspberry Pi

Note: you can change your hostname by editing: /etc/hostname

Install the following packages on your Raspberry Pi:

sudo pacman -S avahi nss-mdns  

Start the avahi daemon:

sudo systemctl enable avahi-daemon.service  
sudo systemctl start avahi-daemon.service  

Edit /etc/nsswitch.conf

sudo vim /etc/nsswitch.conf  

Change the line:
hosts: files myhostname dns
hosts: files myhostname mdns_minimal [NOTFOUND=return] dns


From now on you will be able to access your Pi through your hostname (don’t forget to add .local).
For example:

ssh archuser@arch-pi.local  
ping arch-pi.local