9.4 Network Printers
A network printer can support various protocols, some of them even
concurrently. Although most of the supported protocols are standardized,
some manufacturers expand (modify) the standard because they test systems
that have not implemented the standard correctly or because they want to
provide certain functions that are not available in the standard.
Manufacturers then provide drivers for only a few operating systems,
eliminating difficulties with those systems. Unfortunately, Linux drivers
are rarely provided. The current situation is such that you cannot act on
the assumption that every protocol works smoothly in Linux. Therefore,
you may have to experiment with various options to achieve a functional
CUPS supports the socket,
LPD, IPP, and
Socket refers to a connection in which the data
is sent to an Internet socket without first performing a data
handshake. Some of the socket port numbers that are commonly used are
9100 or 35. The device URI (uniform
resource identifier) syntax is
for example, socket://192.168.2.202:9100/.
- LPD (Line Printer Daemon)
The proven LPD protocol is described in RFC 1179. Under this
protocol, some job-related data, such as the ID of the printer queue,
is sent before the actual print data is sent. Therefore, a printer
queue must be specified when configuring the LPD protocol for the data
transmission. The implementations of diverse printer manufacturers are
flexible enough to accept any name as the printer queue. If necessary,
the printer manual should indicate what name to use. LPT, LPT1, LP1,
or similar names are often used. An LPD queue can also be configured
on a different Linux or Unix host in the CUPS system. The port number
for an LPD service is 515. An example device URI is
- IPP (Internet Printing Protocol)
IPP is a relatively new (1999) protocol based on the HTTP protocol.
With IPP, more job-related data is transmitted than with the other
protocols. CUPS uses IPP for internal data transmission. This is the
preferred protocol for a forwarding queue between two CUPS servers.
The name of the print queue is necessary to configure IPP correctly.
The port number for IPP is 631. Example device URIs
are ipp://192.168.2.202/ps and
- SMB (Windows Share)
CUPS also supports printing on printers connected to Windows shares.
The protocol used for this purpose is SMB. SMB uses the port numbers
137, 138, and 139.
Example device URIs are
smb://user:[email protected]/printer, and
The protocol supported by the printer must be determined before
configuration. If the manufacturer does not provide the needed
information, the command nmap, which comes with the
nmap package, can be used to guess the protocol.
nmap checks a host for open ports. For example:
nmap -p 35,137-139,515,631,9100-10000 printerIP
9.4.1 Configuring CUPS with Command Line Tools
Apart from setting CUPS options with YaST when configuring a network
printer, CUPS can be configured with command line tools like
lpadmin and lpoptions. You need a
device URI consisting of a back-end, such as parallel, and parameters.
To determine valid device URIs on your system use the command
lpinfo -v | grep ":/":
# lpinfo -v | grep ":/"
With lpadmin, the CUPS server administrator can add,
remove, or manage class and print queues. To add a print queue, use the
lpadmin -p queue -v device-URI -P PPD-file -E
Then the device (-v) is available as
queue (-p), using the
specified PPD file (-P). This means that you must know
the PPD file and the device URI to configure the printer manually.
Do not use -E as the first option. For all CUPS
commands, -E as the first argument sets use of an
encrypted connection. To enable the printer, -E must be
used as shown in the following example:
lpadmin -p ps -v parallel:/dev/lp0 -P \
The following example configures a network printer:
lpadmin -p ps -v socket://192.168.2.202:9100/ -P \
For more options of lpadmin, see the man page of
During printer setup, certain options are set as default. These options
can be modified for every print job (depending on the print tool used).
Changing these default options with YaST is also possible. Using
command line tools, set default options as follows:
First, list all options:
lpoptions -p queue -l
Resolution/Output Resolution: 150dpi *300dpi 600dpi
The activated default option is identified by a preceding asterisk
Change the option with lpadmin:
lpadmin -p queue -o Resolution=600dpi
Check the new setting:
lpoptions -p queue -l
Resolution/Output Resolution: 150dpi 300dpi *600dpi
When a normal user runs lpoptions, the settings are
written to ~/.cups/lpoptions. However,
root settings are written