IPP and mDNS via avahi on Debian

I tried to set up a remote printer at home this morning. It was easier than last time, but still a bit of a pain in the neck. So I’m posting this in the hopes that someone else will benefit from my work.

There are a few prerequisites necessary which I’m going to list, but not elaborate on (yet). First, you will need to have your printer working in CUPS, and accepting remote connections (and accepting remote print jobs via IPP). Second, you will need to have avahi-daemon installed. It worked “out-of-the-box” for me (i.e., apt-get install avahi-daemon).

In any case, once you get avahi-daemon installed, you need to configure the service file for your printer. I’m a littler perturbed that there wasn’t even a simple example of a printer mDNS config file; that was the hardest part of all this. The avahi.service(5) man page is very descriptive, and I suppose that if I’d hammered my way through it (or even read anything besides the opening paragraph) this would’ve been easier for me. But I didn’t, so I had to hack things up a bit (using Bonjour Browser and enabling Print Sharing on my iBook to see how the mDNS advertisement should look). In any case, here’s the ipp.service file that I’m currently using (it goes in /etc/avahi/services/). Note that this config file will only work as-is for a Lexmark Optra E312 printer installed as “Printer” in CUPS, but with a bit of modification it should work for any properly-installed printer.

Modifications that definitely need to be made:

rp= should be the path to your printer via CUPS (leaving off the hostname and port portion)
ty= should reflect your printer type
product= should also reflect your printer.
printer-type= is a mystery to me; I'd recommend Google as a good place to start.

After installing the ipp.service file (appropriately modified for your hardware), restart the avahi daemon (/etc/init.d/avahi-daemon restart), and you should see the printer advertised via Rendezvous (Bonjour?).

If you have trouble with this, please don’t contact me; I’d recommend either the cups or avahi sites as good starting places to begin troubleshooting any issues.

Published by

devlogic

I write stuff on this blog. All of the stuff.

2 thoughts on “IPP and mDNS via avahi on Debian”

  1. Thank you SO much, been wasting 2 full evenings with this… first trying to get it working with netatalk (it didn’t… despite cupsauotadd and such) and after that directly though avahi, which now actually works thanks to you ;). How did you know it was the txt records? They are nowhere explained in detail and I guess you have to know your way around DNS yourself… would love to know what those mean though. Did you change anything in the cupsd.conf?

  2. update: I just discovered, that CUPS nowadays (that is v. 1.3.8) comes with built-in avahi support. So if you specify this

    # Enable printer sharing and shared printers.
    Browsing On
    BrowseOrder allow,deny
    BrowseAllow @LOCAL
    BrowseAddress @LOCAL
    BrowseProtocols dnssd
    BrowseLocalProtocols dnssd
    BrowseRemoteProtocols dnssd

    in your cupsd.conf, all your CUPS printers will get published by default. The downside however is, that if you – like me – have afp netatalk file shares residing on your server, you still have to run a standalone avahi server to publish those. Unfortunately the built-in and the standalone one seem to interfere with each other: if I restart avahi, my cups printers disappear… guess they perturb each other, depending on the time they’ve been started up :'(. Would be sweet if anyone knew how to make them play along, because the natively shared CUPS printers seem to be very tightly integrated, i.e. you don’t even have to install drivers at your side but can use the ones on the server side.

Comments are closed.