This is part of a series of posts on the design and technical steps of creating Himblick, a digital signage box based on the Raspberry Pi 4.
We now have little box that can connect to the wifi, and we can easily give it
a name like "front_entrance
" or "room3_ceiling
".
It would be nice if people who need to manage media on the display, could be able to connect via sftp or a web interface to a box given its name. Thankfully it's 2019 (almost 2020) and this doesn't require tinkering with interfacing the DHCP server with the local DNS anymore.
Enter mDNS:
- name: "Make machine ssh-discoverable"
copy:
remote_src: yes
src: /usr/share/doc/avahi-daemon/examples/ssh.service
dest: /etc/avahi/services/
That's it: copy /usr/share/doc/avahi-daemon/examples/ssh.service
to
/etc/avahi/services/
, and from any other machine in the local network you can
ssh into the box simply by name.
This is taken care of by Avahi.
There are a couple of packages of interest:
libnss-mdns
that allows any unix program to transparently resolve names via mDNSavahi-utils
, that provides command line tools useful for debugging.
I particularly found it useful to use avahi-resolve
to test direct and
reverse resolution to see if everything was working, and everything generally
was, provided, of course, that
the Pi's monitor was set to the correct resolution.
More can be done with this. We're quite interesting in reopening this chapter in the future, in order to make the devices able to discover each other. One interesting idea would be to make it so that displays could be grouped, and that updating media in any one display could automatically propagate to all the other displays in the group.