Is there a way to set up Avahi to implement "anycast name resolution" on a LAN?

Trent Lloyd here, one of the authors of the Avahi project.

This is in theory possible, but it is not easy to do. Unfortunately the default mechanism for publishing a hostname in Avahi, also published a reverse-DNS record which is listed as exclusive. Thus if you try and publish 2 hostnames pointing at the same IP, you get a conflict on the reverse DNS record.

It is possible to do this if you use the Avahi API to manually publish an A record, and mark it as non-exclusive. You would have to write a small background process for each server in Python, C or similar.

The API call to use is avahi_entry_group_add_record, and you need to pass AVAHI_PUBLISH_ALLOW_MULTIPLE into the flags field. This should then work.

An alternative is to use the service discovery in the way it was intended, and have each client publish a HTTP service, and use a firefox plugin or similar to browse announced web services. Or some other kind of service browser.

Bonjour used to include a plugin for Internet Explorer to do this like a bookmarks bar, I am not sure if it still does.