—This issue is for comments on the blog post layout: default-post title: “Discovering your Raspberry PI on the local network” tags: linux guide githubDiscussionID: 26 —
I wanted to be able to SSH into my Raspberry PI without configuring my SSH config with the IP address. Although I have statically assigned it, I think it would be nice to not worry about this detail. All that I really want to be able to do is SSH into the device by its hostname, but we’ll go further and broadcast the SSH service itself.
We may have remembered we had a Raspberry PI after a few months in which case we need to discover where it is in the network:
With the IP address we can manually SSH in using some credentials (that we surely stored within a password manager).
Services can be broadcast and discovered on the local network using Avahi which implements a number of different protocols around local networks.
nss-mdnswhich provides host name resolution.
avahi-daemon.service- you may need to restart
/etc/nsswitch.confwhich usually controls the sources from which to obtain name-service information. From Arch: “Insert
cp /usr/share/doc/avahi/ssh.service /etc/avahi/services.
avahi-browse -alrtfrom another local machine.
And we are done - we can simply SSH into the displayed domain name/port!
Arch has fantastic documentation around Avahi with further information and examples.