evan_tech

Previous Entry Share Next Entry
08:32 am, 9 Nov 05

zeroconf, avahi

I've been looking at Avahi again now that I have some time. I also saw a talk by one of the zeroconf developers that was pretty good. So here are some hastily-written notes.

All You Need to Know About Zeroconf
The goal is autoconfiguration on a local network, and the trick is that on a local network you can just broadcast to find things. (Think AppleTalk, NetBIOS, but based on IP.)

Three pieces, oversimplified:
  1. IP autoconfiguration: choose an IP, ARP for it, and grab it if you didn't see anyone else ARPing for it
  2. multicast DNS: broadcast DNS queries to get localnet-wide responses; choose name with a backoff protocol like the IP one
  3. service discovery: a special DNS hierarchy with "hostnames" like _ssh._tcp, where the DNS response includes hostnames supporting that protocol

The talk had all sorts of the nice demos you'd expect, like being able to hit "open ssh connection" in his terminal and seeing a list of ssh-able hosts nearby, or plugging in a webcam and getting its configuration page in Safari's browser links. I especially liked how he emphasized simplicity: he kept making references to maxims like "you know it's done when you can't remove anything more", and how it's getting implemented on tiny embedded devices.

All You Need to Know About Avahi
Apple has an open source implementation, but it's apparently non-free according to Debian(?). Avahi is an LGPL reimplementation of the spec. I asked Stuart (the speaker) what he thought about it and he seemed pretty excited, saying the Avahi devs had helped find bugs in other people's implementations.

The Avahi daemon answers requests and caches responses (so, for example, if some other computer queries the network for available printers, your computer can cache the response and not make the same request of its own). Services can be registered with the daemon via a file in a directory in /etc or via an IPC call. They use DBUS for IPC. There are a bunch of cute supporting apps (like service-discovery-applet, a Gnome panel applet) and simple programs to talk to the daemon, so running avahi-publish-service "Desktop SSH" _ssh._tcp 22 makes an entry "Desktop SSH" immediately appear in the drop-down list on the applet.

Avahi on Ubuntu installation instructions (some apt-gets and some daemon restarts).

Why Evan Cares
Two applications:
  1. Home network uses DHCP, so maybe I can use mDNS to connect my laptop. Roommates use Windows and Macs, and I'd like to share files (iTunes?) with them.
  2. On the bus to work I've been thinking about how it'd be neat to do some sort of local IM or game; the internet connection sucks but local wireless ought to be fast. I have lots of social get-togethers involving laptops where there ought to be some neat sorts of exchanges.
And more broadly, I've been thinking about this because it's a framework for local presence. I think there are a lot of neat apps that require presence (see, for example, Gobby -- SubEthaEdit clone) that haven't really happened yet because they each needed their own presence management. In theory we ought to be communicating over Jabber ("as a platform") but I haven't seen it happen yet...