How-To: Address Linux-Based SBCs By Hostname Over Network
One of the little annoyances of addressing Linux-based SBCs (and even Linux-based desktop and laptop systems) is getting their host names to respond over the network.
Thanks to a pointer in Daniel Lemire's blog, there is a simple way to get this to work:
sudo apt update
sudo apt install avahi-daemon avahi-dnsconfd avahi-discover avahi-utils libnss-mdns
sudo service avahi-daemon start
Throw in the ‘ssh-copy-id’ command and you can log in without typing a password.
If your choice of Linux distribution uses a package manager other than apt or apt-get (i.e. pacman, etc.), there may be some tweaking of the commands necessary.
At this point, you can test from another machine on the network to see if it is accessible:
- Type 'cat /etc/hostname' on your Linux system to find out what your system's name is
- From another machine on the network, try 'ping hostname.local' replacing 'hostname' by the name of the machine determined in step 1
- If it doesn't work, try rebooting the Linux system and giving it another shot (it worked on our test systems without a reboot, but your results may vary)