Troubleshooting bonjour devices on LAN

tools network

Since purchasing a NAS that supports DAAP streaming, I've been trying to get it to play to my Airport Express in the living room. I also couldn't get PulseAudio on my ubuntu laptop to find that device, so I knew something must be wrong. Searching around, I found a quick script based on Net::Bonjour, which would do a scan for advertised devices. Since it was aimed at finding a misbehaving printer, I've updated it a bit to scan for misbehaving audio devices as well.

The first thing was to install Net::Bonjour from the ubuntu repositories:

sudo apt-get install libnet-bonjour-perl

I also poked a hole in my firewall to accept connections from port 5353, which is how most of the service discovery works. This may or may not have been necessary.

Bonjour Discovery script source

Here is my modified script:

use Net::Bonjour;
my @services = qw(raop daap airport
   pdl-datastream riousprint printer http mpd
   ftp ssh afpovertcp ipp upnp uddi smb ipp);

foreach my $service ( @services )
    print "Trying $service...\n";
    my $resource = Net::Bonjour->new($service, 'tcp');
    foreach my $entry ( $resource->entries )
        printf( "%s %s:%s\n", $entry->name, $entry->address, $entry->port );
exit 0;

The response I got back shows that the airport express has chosen a random IP address ( rather than playing nice with my network, and everything but apple devices can't connect. Because iTunes either uses OSX's builtin networking or the bonjour for windows userspace libraries, it can apparently handle routing to a random address.

Update: Apparently this wasn't necessary, and there's a program as part of the avahi package that does the exact same thing (and more). You can run it to show all mDNS listeners like so:

avahi-browse -a

Digging a little bit further, it seems like it's okay that the APEX is advertising on a link-local port, so it must be something else.

Fist I checked that my laptop (and the NAS) were able to send packets to the subnet that the APEX is advertising:

route -n | grep 169.254

If that outputs a line, then there's a route set up, which is good. Mine did, which means that there's just something wrong with the Airport Express.

I ended up doing a full factory-reset of the Airport Express by holding down the reset button for 10s. That made it forget all of its network settings, so I had to do the following:

  • wait for the airport express to come back up
  • connect to the APEX's "Apple f23455" wireless network from my laptop
  • run the Airport Utility using wine: wine APUtil.exe
  • select File -> Configure Other…
  • log into the APEX using the default IP address ( and password ("public")
  • tell it to load the default settings/profile
  • set the base station name
  • set the admin password
  • tell it to Join an existing wireless network
  • specify the SSID and make sure it's using DHCP to connect
  • hit the Update button
  • wait for it to reboot

Details on using the Airport Utility from linux

For whatever reason, that made the Ariport Express start appearing in my PulseAudio Volume Control (pavucontrol) under "output devices", which is enough to play from Rhythmbox.

SSHing into the NAS and running avahi-browse -a shows that the airport express is showing up for it as well. Checking the routing says that should work as well. But sorting that connection problem out can wait for another day.