Understanding how CUPS works

Jephe Wu - http://linuxtechres.blogspot.com

Environment: CentOS 6.2, cups
Objective: setting a network printer(HP JetDirect at

How does it work? - http://www.cups.org/documentation.php/overview.html
Printing procedure diagram: - http://upload.wikimedia.org/wikipedia/commons/thumb/6/64/Cups_simple.svg/150px-Cups_simple.svg.png

Accoring to http://en.wikipedia.org/wiki/CUPS

user data(image or webpage) -> MIME(/etc/cups/mime.types and /etc/cups/mime.convs) -> PostScript data-> PostScript filter(prefilter: PPD) to add printer specific options like page range etc -> CUPS backend(if postscript printer) or CUPS-raster format(by Foomatic or Ghostscript)-> CUPS backends

user data(image or webpage) -> MIME(/etc/cups/mime.types and /etc/cups/mime.convs) -> diretly raster data -> final filter to printer specific data -> CUPS backends

printer-specific format (ls -l /usr/lib/cups/filter) then send to backends which are parallel, serial, USB ports and network backends via IPP, JetDirecdt(AppSocket), line printer daemon(LPD) and SMB protocol.


1. find out remote printer's IP address by one of methods below:

a. on printer's control panel
b. printing printer's configuration or status page
c.For Mac address, get it by printer test page or at the bottom of the printer server.
then you can manully configure IP address in DHCP server like this:

host hostname {
  hardware ethernet mac-address;
  fixed-address ip-address;

2. network protocols in CUPS - http://www.cups.org/documentation.php/network.html
In order to support network printers in CUPS, the following protocols are used:

AppSocket protocol(JetDirect protocol)
Note: it's generally the most reliable network protocol used for printers, it's on port 9100 and use socket URI

Internet Printing Protocol(IPP)
Note:IPP is the only protocol that CUPS supports natively and is supported by some network printers and print servers. However, since many printers do not implement IPP properly, only use IPP when the vendor actually documents official support for it. IPP printing normally happens over port 631 and uses the http and ipp URI schemes:

Line Printer Deamon (LPD) Protocol
Note: LPD is the original network printing protocol and is supported by many network printers. Due to limitations in the LPD protocol, we do not recommend using it if the printer or server supports one of the other protocols. LPD printing normally happens over port 515 and uses the lpd URI scheme:

3. printer discovery
Whenever you view the administration web page or a list of supported device URIs, the snmp backend will probe the local network(s) using Simple Network Management Protocol (SNMP) broadcasts use snmp to discover your printers:

default community string is 'public', if your printer is not using default one, change

run 'CUPS_DEBUG_LEVEL=2 /usr/lib/cups/backend/snmp 2>&1 | tee snmp.log' to find out what kind of printer you have at the specified address in /etc/cups/snmp.conf
 1  INFO: Using default SNMP Address @LOCAL
 2  INFO: Using default SNMP Community public
 3  DEBUG: Scanning for devices in "public" via "@LOCAL"...

If you don't see your printer listed, or the wrong information is listed, then you need to gather more information on the printer.

The easiest way to do this is to run the snmpwalk command:

snmpwalk -Cc -v 1 -c public | tee snmpwalk.log

look for the following information:

HOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP LaserJet 4000 Series

4. configure Axis and Linksys print servers - http://www.cups.org/documentation.php/network.html

5. How to configure printer from web interface http://localhost:631
After you choose a HP printer and its model and click the 'add printer', CUPS will put the coresponding PPD file under /etc/cups/ppd directory.

5.a From command line CLI - to configure a printer

# lpadmin -p printer1 -v usb:/dev/usb/lp0 \
  -P /usr/share/cups/model/Epson-LP-S3000-eplaser-jp.ppd -E 

5.b [root@devdb ppd]# lpstat -p -a
printer 2 is idle.  enabled since Sat 12 May 2012 02:52:19 PM EST
printer hp4300_7 is idle.  enabled since Sat 12 May 2012 03:10:23 PM EST
printer test is idle.  enabled since Sat 12 May 2012 02:50:21 PM EST
2 accepting requests since Sat 12 May 2012 02:52:19 PM EST
hp4300_7 accepting requests since Sat 12 May 2012 03:10:23 PM EST
test accepting requests since Sat 12 May 2012 02:50:21 PM EST

5.c enable cups printer queue.

# /usr/bin/cupsenable lps3000
# /usr/sbin/accept lps3000

5. References:

With Samba installed, users can address printers on remote Windows computers and generic PostScript drivers can be used for printing across the network.