Tuesday, November 16, 2010

Avahi daemon on Redhat

/var/log/messages looks something like this, and if you are wondering what is this ?

Nov 16 19:44:21 server1 ntpd[28254]: synchronized to 10.418.5.205, stratum 2
Nov 16 19:45:43 server1 avahi-daemon[29476]: Invalid response packet.
Nov 16 19:47:39 server1 last message repeated 7 times
Nov 16 19:48:48 server1 last message repeated 49 times
Nov 16 19:50:49 server1 last message repeated 7 times
Nov 16 19:52:44 server1 last message repeated 7 times
Nov 16 19:53:54 server1 last message repeated 42 times
Nov 16 19:55:54 server1 last message repeated 7 times
Nov 16 19:57:50 server1 last message repeated 7 times
Nov 16 19:58:59 server1 last message repeated 35 times
Nov 16 20:00:29 server1 last message repeated 21 times
Nov 16 20:02:55 server1 last message repeated 14 times
Nov 16 20:03:04 server1 last message repeated 20 times
Nov 16 20:03:21 server1 ntpd[28254]: synchronized to 10.418.5.205, stratum 2
Nov 16 20:03:24 server1 avahi-daemon[29476]: Invalid response packet.
Nov 16 20:04:04 server1 last message repeated 35 times
Nov 16 20:06:04 server1 last message repeated 7 times
Nov 16 20:07:59 server1 last message repeated 7 times
Nov 16 20:09:09 server1 last message repeated 35 times
Nov 16 20:11:09 server1 last message repeated 7 times
Nov 16 20:13:04 server1 last message repeated 7 times
Nov 16 20:14:16 server1 last message repeated 35 times
Nov 16 20:16:13 server1 last message repeated 21 times
Nov 16 20:18:10 server1 last message repeated 7 times

Its Avahi !!
If you have not customized your kickstart script carefully, Avahi gets by default on Redhat. If this server is in your data center you don't need it.

# /etc/init.d/avahi stop
# chkconfig --level 012345 avahi off

Avahi runs mDNS and DNS-SD daemon (that is, multicast DNS plus DNS service discovery ) implementing Apple's ZeroConf architecture (also known as "Rendezvous" or "Bonjour").

Avahi-daemon interprets its configuration file /etc/avahi/avahi-daemon.conf and reads XML fragments from /etc/avahi/services/*.service which may define static DNS-SD services. If you enable publish-resolv-conf-dns-servers in avahi-daemon.conf the file /etc/resolv.conf will be read

Some very good explanation of mDNS and DNS-SD

Multicast DNS means that each equipped host stores its own DNS records. A multicast address (224.0.0.251) is used by clients wishing to get the IP address of a given hostname, and that host responds to the client request with its IP address.

DNS-SD uses the same technology, but in addition to regular DNS information, hosts also publish service instance information: they announce what services they provide and how to contact those services. All of this is intended to mean that hosts and services can connect to one another without requiring any user configuration: known as Zeroconf sharing. Great for those who aren't comfortable doing manual setup -- or who are just lazy!

In truth, as yet there isn't that much Linux software that really uses mDNS. Apple have made rather more use of it: their software is called Bonjour, and handles printer setup, music sharing via iTunes, photo sharing via iPhoto, Skype, iChat, and an array of other software services. However, in terms of the technical implementation, avahi is an excellent piece of software, and capable of doing everything that Bonjour does. It's been suggested that the Debian/Ubuntu dev teams are actually trying to help give mDNS a bit of encouragement with the inclusion of avahi.

So, what can you do with avahi on your Linux box? One possibility is to use it for networked music sharing. In particular, if some of your music is on laptops that appear and disappear from the network as they are moved around and shut down or booted up, auto music discovery is very handy. This is the same tech that Apple uses for iTunes. Since I have a Mac laptop and a couple of Debian desktops which live in another room, this sounded promising.

Unfortunately, it currently only works in one direction: rhythmbox can connect to an iTunes share but can't actually get at any of the music (this is due to a change in protocol from iTunes 7.0). This is enormously irritating and entirely Apple's fault. Sharing in the other direction works fine: use the "Plugins" menu to configure sharing via DAAP (remember to hit the "configure" button and then check the "share my music" box), and your share will be made available. It'll show up automatically in iTunes on a Mac; in rhythmbox you'll need to use the "Connect to DAAP share" option in the Music menu of rhythmbox, and give the hostname/IP address and port (3689) to connect to. If you add music it won't appear in the share until you either restart rhythmbox (client-side), or disconnect and reconnect the share in iTunes. (Note: if running a firewall, you'll need to open appropriate holes in it for outbound sharing, although not for inbound.)

No comments: