Notes on network printing with cups

by Martin Monperrus
Cups is a printing software system that supports network printing. For instance, if a machine Timoleon is connected to a USB printer, one can access Timoleon over the network to print on the USB printer. The network printing facility also holds for network printers. If a machine Timoleon is connected to a network printer OCEANE, one can access Timoleon to print on OCEANE (instead of connecting to OCEANE directly). This enables admins to encapsulate configuration and to provide printing across different network boundaries and firewalls.

This sounds great, but there are many issues along the way.

Solution #1 with client.conf

Requirements: a cups server on cups.mydomain.com
Create a file ~/.cups/client.conf containing:
ServerName cups.mydomain.com

Warning: If your cups client software is version >1.6 and the cups server is <1.6, you have to write:
ServerName cups.mydomain.com/version=1.1

Note that in this case, you don't even have to have a running cups on your machine (on localhost).

The documentation is at http://www.cups.org/documentation.php/doc-1.6/ref-client-conf.html. The /version refers to the version of the IPP protocol (IPP/x.y, e.g. IPP/1.1 or IPP/2.0, see the wikipedia page)

Solution #2, with BrowsePoll and cups version <1.6

If timoleon answers to the CUPS Browse Protocol, add the line in file /etc/cups/cupsd.conf (on localhost):
BrowsePoll timoleon:631

This solution requires client applications to regularly poll for new printers. For instance, OpenOffice/LibreOffice gets the printer list at startup, hence if a printer XX appears after application startup (which often happens with mobile laptops), you have to restart OpenOffice in order to print on XX.

Solution #3, with BrowsePoll and cups version >=1.6


In cups version >=1.6, BrowsePoll is no longer supported by cupsd. Instead, there is a new daemon called cups-browsed that is responsible for it. Install cups-browsed $ apt-get install cups-browsed and add the line in file /etc/cups/cups-browsed.conf (on localhost):
BrowsePoll timoleon:631

Make sure that both cups and cups-browsed are started ($ service cups start && service cups-browsed start).

Other interesting configuration options are BrowseInterval and BrowseTimeout, this is not yet documented on http://cups.org, see https://cs.uwaterloo.ca/twiki/view/CF/CupsOnLinux instead)

To troubleshoot cups-browsed, $ cups-browsed --debug.
cups-browsed: Reading config: BrowseRemoteProtocols dnssd
cups-browsed: Reading config: BrowsePoll cups.mydomain.com
cups-browsed: Adding BrowsePoll server: cups.mydomain.com
cups-browsed: browse polling cups.mydomain.com
Warning:
If your cups client is version >1.6 and the cups server is <1.6, cups-browsed fails:
cups-browsed: browse poll failed for server cups.mydomain.com: Bad Request

In this case, you have to use an older version of cups or use solution #1.

Solution #4: using IPP directly

Let us assume that a machine Timoleon is connected to a network printer OCEANE. Timoleon runs cups.

To print to OCEANE, you first have to get its IPP URL (IPP means Internet Printing Protocol). This is normalized and simply is:
ipp://timoleon/printers/OCEANE

Then you have to get tte printer driver of OCEANE as a ppd file by simply downloading the content of the URL:
http://timoleon:631/printers/OCEANE.ppd

Then you simply add to your local cups installation (http://localhost:631, then "Add printer") a printer connected to ipp://timoleon/printers/OCEANE with the downloaded PPD file.
Tagged as: