Avahi - Goodbye, IP addresses! date: 2014-10-28 02:03:42+00:00 categories: - Linux
Avahi is a package for UNIX-like systems that implements ZeroConf functionality, which allows the use of .local addresses to work with machines on the local network. What this means is that, without having to manually modify /etc/hosts or anything else, I can for instance type
ssh clunkyserver.local and my system will find the machine named clunkyserver on the local network and shell into it. I have successfully configured this on Mint, Arch, and Debian-on-Android.
Mint was pretty easy; the package was installed on my box already, so it just took
sudo service start avahi-daemon to enable the service, and
sudo update-rc.d avahi-daemon defaults 99 to make it persist after rebooting (I hope).
Arch was a very little bit more complex;
sudo systemctl start avahi-daemon && sudo systemctl enable avahi-daemon is the equivalent way to turn the service on and add it to the system startup, but in order to find .local addressed machines, I had to install the nss-mdns package, then per the wiki edit
/etc/nsswitch.conf and change
hosts: files dns myhostname to
hosts: files mdns_minimal [NOTFOUND=return] dns myhostname.
Debian on Android
This was the most messy of all. As mentioned in previous posts, I run a Debian system on top of Android, so the same packages will work there, but being I ran into some issues along the way. First, I had to install avahi-daemon, then I installed mdns-scan, which may not have been strictly needed but I was trying to pull in nss-mdns without knowing the package name thereof (looks like it's in libnss-mdns, BTW, although I'm not ruling out other packages as involved). Then, to fix errors, I followed the advice of forum posts and edited
/etc/avahi/avahi-daemon.conf to add
disallow-other-stacks=yes. Then, avahi-daemon requires D-Bus, so I ran
/etc/init.d/dbus start. And finally, at long last, the daemon itself is invoked with
avahi-daemon --no-drop-root -D; this keeps the daemon as root to fix socket permission errors and backgrounds the process. I also edited
/etc/hostname to give the tablet a reasonable name, because it defaults to "android-%s", where %s is a very long alphanumeric sequence that is not helpful as a .local name/address. Now I just need a web server, and I can have my own websites on tablet.local/ :D