Howto setup a print server for Windows (and others) using CUPS and zeroconf

Now that CUPS 1.3 has built in zeroconf support, it is easier than ever to provide print service to Windows machines. You don’t even need Samba anymore.

Here’s a quick way to setup a CUPS print server and a Windows client:

On the server side

First you need to install CUPS 1.3 or higher on your print server and setup the printer (the web interface makes this task dead easy).

Zeroconf isn’t enabled by default so you have to browse the CUPS admin page (http://localhost:631/admin if you’re running it on localhost) and enable the “Share published printers connected to this system” option. “Change Settings” will restart CUPS and your printer should be instantly visible to zeroconf-aware applications in the local network.

If you can’t or don’t want to use the web interface (which is the easiest way though), you can edit /etc/cups/cupsd.conf and replace the line

Listen localhost:631

with

Port 631

and add the line

BrowseAddress @LOCAL

Now save the changes and restart CUPS and you’re done.

On the client side

Since most Linux distributions and MacOS support zeroconf out of the box, I’ll just explain how to setup the Windows client.

On the Windows side you’ll need to install Bonjour for Windows which is freely available on apple.com.

Bonjour for Windows will enable Multicast DNS (mDNS) and DNS based Service Discovery (DNS-SD) on your Windows machine. Once it is installed, you can start the printer helper application provided by bonjour which will guide you through the process of installing the network printer. The only problem here was that although it correctly identified my printer, it only let me chose between a generic postscript and a PCL driver. Both were not working correctly so I had to manually change the driver for this printer to HP LaserJet 4 Plus (which is my printer) after the setup via the printer properties, where all other printer drivers where available again.

That’s it! Now you should be able to print on every zeroconf aware operating system connected to your network. Oh, one final warning: With this setup, everybody in the LAN will be able to print without prior authentication. This should be what you want in most cases when running a home LAN or a small business LAN anyways, but it’s certainly not so cool when strangers have access to your network.

The whole setup process took like 15 minutes today. I remember me a few years ago, not being very experienced with Samba and CUPS wasting a whole weekend to achieve the same result. Thanks apple for making life a bit easier again!

Tags:

6 Responses to “Howto setup a print server for Windows (and others) using CUPS and zeroconf”

  1. Hrw Says:

    Thx - it is really easier then Samba way ;)

  2. Sam Morris Says:

    You don’t necessarily need to install Bonjour on the client. Windows (since 2000 I think) has been able to print directly to an Internet Printing Protocol printer.

    You merely have to add a printer at the right URL (e.g., http://10.0.0.1:631/Deskjet_940C and tell Windows to use a driver that outputs Postscript (e.g., MS Publisher Imagesetter).

    The Bonjour way is nice for its automatic discovery of printers however. Of course, it wouldn’t be necessary at all if Windows had the ability to listen to CUPS broadcasts. ;)

    BTW, according to CUPS documentation, dns-sd (dns service discovery AKA Bonjour) is disabled by default and needs to be enabled by adding a BrowseLocalProtocols directive to your cupsd.conf. If you didn’t have to do this yourself, do you know if enabling dns-sd is a Debian-specific modification, or if the documentation is just wrong?

  3. Bastian Says:

    CUPS’ documentation is currently a bit broken (just some small typos and missing words). Under the point “Browse Protocols”, they say that “The default protocol is CUPS dnssd for BrowseLocalProtocols and for BrowseRemoteProtocols.”

    Thanks for the hint that Windows understands IPP. But I wish I wouldn’t have to use a post script diver, since the windows printer drivers give usually much better results. Unfortunately Windows seems to make a difference between local and remote printers, since the same LaserJet driver lacks some basic features (like printing several pages on one) when used with a remote printer :(.

  4. OSX Troubleshooting: PrintJobMgr exited unexpectedly with code 105 | Rick Tech Says:

    [...] You’ve just setup a brand new network between your Windows and Macintosh computers and now want to print to a single printer that is either shared or directly on the network. Setting up the network was easy as pie. Installing the printer went smoothly and without a hitch. Then you try to print. The job turns for a few seconds then pops up this error. [...]

  5. Top Unix News » Howto setup a print server for Windows (and others) using CUPS and zeroconf Says:

    [...] read more | digg story [...]

  6. DaRoost » Blog Archive » Cups vs Avahi vs Mac Says:

    [...] so much. Total PITA. However in my searching, I found this article. First you need to install CUPS 1.3 or higher on your print server and setup the printer (the web [...]

Leave a Reply