Run Zeroconf for Linux in a Snap

Enterprise Networking Planet content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

The fond dream of computer users everywhere is to plug in their
computers and watch as networking automagically sets itself
up. Computers are connected and give themselves IP addresses. Network
resources are available without having to lift a finger: wireless
devices, printers, local Web sites, image galleries, music
collections, the boss’s greatest inspirational speeches collection,
the rude body noise collection — anything that is network-able. Apple
users have long been able to do this with Bonjour (formerly
Rendezvous). No messy hassles with DHCP, DNS, smbclient, or NIS; no
horrid kludges to enable interoperability with cliquish platforms like
Windows that hate to share with non-Windows systems.

Gnarly old network admins who are accustomed to keeping a tight grip
on their realms tend to be resistant to the whole idea — why, it’s as
free-for-all as ad-hoc wireless networking or NetBIOS, with users
running rampant and sharing everything and no one is in charge. The
security implications are obvious; Zeroconf is not suitable for sites
that need tight controls, or to use over untrusted networks. But it’s
great for home and small business users, small groups inside the
enterprise, and get-togethers like business meetings and trade
shows. Some consumer devices like Tivo already use it, as well as a
whole world of Apple printers and network devices.

Don’t Get Happy Yet
Zeroconf is coming to
Linux, but it has a way to go. For all of that happy automagic to
happen a lot of work has to go into infrastructure. Networking,
applications, and devices have to be Zeroconf-enabled, which means
more work for developers. Linux uptake has been very slow, possibly
because of patent issues (see the Aunt Tillie thread in Resources),
and possibly because Linux developers haven’t been very interested in
it. Fortunately the KDE team has been working hard on implementing
Zeroconf, so it’s coming at last. Gentoo and SUSE are reported to have
excellent Zeroconf support.

Finding any coherent or up-to-date documentation is difficult. If you
want to start testing Zeroconf, the easy way is to use a Linux
distribution that already has it built-in. In this article I’ll stick
to rassling Kubuntu Dapper, and refrain from boring you with my
heroic, but losing adventures with other distributions.

Kubuntu Dapper
You can test Zeroconf on any
existing LAN, even if it already has a full complement of networking
services running, so don’t worry about making any special
preparations. On Kubuntu Dapper Zeroconf is supported in KDE, but not
enabled out of the box. I got it working by installing
the avahi-daemon package. But before you install anything,
check to see if it’s already in place and working by
entering zeroconf:/ in the Konqueror location bar. This is a
good thing to see:

An error occurred while loading zeroconf:/:
The
Zeroconf daemon (mdnsd) is not running.

That means all you need to do is install Avahi. Older howtos
will tell you to get Apple’s mDNSresponder package. Don’t do
that. Avahi is written for Linux, is licensed under the LGPL, and
performs very nicely.

$ sudo apt-get install avahi-daemon

Now try browsing zeroconf:/ again. This time you
should get a blank Konqueror window. Or, if you happen to have some
Zeroconf-aware service running somewheres, it will appear. This
confirms that you can use Konqueror to discover and browse
Zeroconf-enabled services.

Something that had me darn near homicidal was documentation that
referred to using zeroconf:/ ioslave as though that were the
literal URI, which is all wrong and does not work, because it’s not
the literal URI. It’s just shorthand for “the zeroconf ioslave”, and I
call a pox upon all writers who do this.

I/O slaves are small specialized KDE programs that manage individual
protocols. These are the little magic genies that allow Konqueror to
support just about every protocol there is. You might already be
familiar with common ones
like smb:/, file:/, man:,
and vnc:/. You’ll find a complete list in kinfocenter,
Protocols. The syntax is a bit inconsistent; usually it’s
name-colon-forward slash, but sometimes it’s two forward slashes, and
sometimes no slash at all, so the Protocols list will help with this.

Now install mdns-scan. This works independently of KDE to
browse Zeroconf services, so you’ll be able to tell if it’s a KDE or
Zeroconf problem when something doesn’t work:

$ sudo apt-get install mdns-scan

Then simply run mdns-scan. When no Zeroconf services
are available, it looks like this example, which shows that two hosts
are up, but not broadcasting any services:

$ mdns-scan
+ xena
[00:03:6d:00:83:cf]._workstation._tcp.local
+ stinkpad
[00:0a:e4:40:8b:fd]._workstation._tcp.local
Browsing ... -

It continues to scan the network until you stop it with
Ctrl+C.

Setting Up Zeroconf Services
An easy way to
see Zeroconf in action on KDE is to use the Public File Server
applet. Right-click on the panel, click Add Applet to Panel, and
select Public File Server. Set up a New Server by right-clicking on
the Public File Server icon. Give it a descriptive name, like in
Figure 1.


Figure 1.
(Click for a larger image)

The final message should be “Successfully published this new service
to the network (Zeroconf).” Now when mdns-scan is run it looks
like this:

$ mdns-scan
+ xena
[00:03:6d:00:83:cf]._workstation._tcp.local
+
xena-vacation-pics._http._tcp.local
+ stinkpad
[00:0a:e4:40:8b:fd]._workstation._tcp.local
Browsing ...


Figure 2.
(Click for a larger image)

Konqueror should display the share, and let you browse and
download files from it. You can access the share
via http://[hostname]:8001, which is the old-fashioned way that
requires you to know the address, or use the newfangled Zeroconf way,
which automatically browses all available resources, and you just
click on the ones you want, like in Figure 2.

No Zeroconf For You
You don’t want Konqueror
to show you this message:

An error occurred while loading zeroconf:/:
KDE has
been built without Zeroconf support

This means you’ll have to download and compile Avahi from
sources, and then recompile kdelibs to include Zeroconf
support.

The Dream
Zeroconf is a lightweight, fairly
simple set of cross-platform protocols that can work on any system-
Linux, Unix, Macintosh or Windows. But currently Windows is the odd
one out, as Microsoft is showing little inclination to play with
the rest of us, and are more interested in its own service discovery
protocol, uPNP. But it works great on Apple devices and services, so
someday this could be a good tool for easily integrating Macintosh
hosts with your Linux machines, and leaving the unsociable Windows
hosts to mutter amongst themselves in a damp corner.

Resources

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends, and analysis.

Latest Articles

Follow Us On Social Media

Explore More