using Avahi/Bonjour to automatically find things to ssh intoOctober 9, 2013
We've got more and more boxes on the network at London Hackspace. I wanted a way to find them all automatically and give me a menu to ssh into them.
It turns our that it's pretty easy to do with avahi, on the servers - apt-get install avahi-daemon, and then drop this into /etc/avahi/services:
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_ssh._tcp</type> <port>22</port> </service> <service> <type>_sftp-ssh._tcp</type> <port>22</port> </service> </service-group>
Then on your laptop install install avahi-ui-utils and run bssh for a list of things to connect to.
There is one annoyance, if you get an entry for ipv4 and ipv6, and if you have both ethernet and wifi you get an entry for each, so each host is repeated 4 times!