Find extensive documentation about the LPRng printing system in the LPRng-Howto in /usr/share/doc/packages/lprng/LPRng-HOWTO.html and on the CUPS printing system in the CUPS Software Administrators Manual in /usr/share/doc/packages/cups/sam.html.
Print server refers to a complete, dedicated printing host with the required CPU power, memory, and hard disk space.
Print server box refers to a computer with relatively limited resources, which is equipped with both a TCP/IP network link and a local printer port. This includes router boxes with a built-in printer port.
A network printer is a printer device with its own TCP/IP port. Basically, it is a printer with an integrated print server box. Network printers and print server boxes are handled in essentially the same way.
There is an important distinction to be made between a network printer or a print server box on the one hand and a true print server on the other. As a somewhat special case, there are large printer devices that have a complete print server included with them to make them network-capable. These are treated like print servers because clients will talk to the printer only through the server and not directly.
An LPD server is a print server that is addressed with the LPD protocol. This is the case if the print server runs the LPRng and lpdfilter print system (lpd, to be precise) or the CUPS print system configured in a way that the machine can be addressed with the LPD protocol (cups-lpd, to be precise).
An IPP server or CUPS server is a print server that is addressed with the IPP protocol. This is the case if the print server runs the CUPS print system (cupsd, to be precise).
The term CUPS network server refers to a CUPS server that was specifically configured to share its queues with other network hosts via UDP broadcast (via UDP port 631).
Usually, client machines in a network do not have any locally connected printers. Rather, the client sends print jobs to a print server. If you have a print server and an additional local printer is connected to the client, you need a client configuration as well as a configuration for the local printer. The print system on the client machine should be selected in accordance with the print system on the print server.
If there is no CUPS network server in the network, but only an LPD server, use the LPRng and lpdfilter print system on the client. In this case, the client machine does not require any further configuration, as even remote queues can be addressed directly when using the LPRng spooler.
However, this is only possible if the LPD server was configured to allow the client to print to its queues. To print from applications, enter lpr -Pqueuename@printserver in the application. However, no file name is specified.
Some applications are preconfigured to use CUPS and must be switched to LPRng. Especially KDE and the KDE printing program kprinter must be set to . If this is not done, it will not be possible to enter the print command.
If the print server is a CUPS network server, start the YaST printer configuration module, click
then and select one of the following options:If no printer is connected locally, no local queue was configured with YaST2. In this case, cupsd is not started automatically, Activate the
service to start cupsd (normally for the runlevels 3 and 5).The client machine does not require any further configuration, as a CUPS network server broadcasts its queues to all network hosts at regular intervals. Therefore, the queues of the network server will automatically be available on the client machine after a short time.
However, this is only possible if the broadcasting function is enabled on the CUPS network server, the broadcast address used is suitable for the client machine, and the client machine is permitted to print to the queues of the CUPS network server.
If you merely want to print via the queues of the CUPS network server, CUPS can be run in client-only mode. In the YaST2 client-only printer configuration, specify the name of the CUPS network server.
In this mode, the client machine does not run cupsd and the file /etc/printcap does not exist. However, applications that cannot be configured to use CUPS only offer the queues listed in the local /etc/printcap. In this case, it is advisable to run CUPS in server mode, as the local cupsd will automatically generate an /etc/printcap containing the queue names of the CUPS network server.
The following lists the different methods that can be used to implement printing on a TCP/IP network. The decision of which one to use does not so much depend on the hardware, but more on the possibilities offered by each protocol. Accordingly, the YaST printer configuration asks you to select a protocol and not a hardware device when setting up network printing.
Nevertheless, the first step in the printer configuration with YaST is the selection of the hardware category for printing (e.g., via CUPS network server, via LPD network server, or direct printing on a network printer or print server box). Accordingly, available protocols are offered for selection. The protocol that should work in most cases is preselected. If only one protocol is possible, there is no selection. Examples:
Print via CUPS Network Server
IPP protocol (single option)
Print via LPD-Style Network Server
LPD protocol (single option)
Print directly on a network printer or using a print server box
TCP socket
LPD protocol
IPP protocol
Data can only be transmitted from the sender to the recipient if both parties support the respective protocol. The software running on the sender and recipient must support the respective protocol.
Ultimately, it does not matter which kind of hardware and software is used, as long as both the sender and the recipient support the respective protocol. Depending on the protocol, print jobs or raw data are transmitted.
Apart from the print data, a print job contains additional information, such as the user on whose host the print job was generated, as well as any special print options (such as the paper size to use for printing, duplex mode, and so on).
The sender sends a print job to a queue on the recipient via the LPD protocol. According to the LPD protocol, the recipient is expected to receive print jobs on port 515. Therefore, a service receiving the print jobs on port 515 (normally this service is called lpd) and a queue in which received print jobs can be placed are needed on the receiving host.
LPRng supports sending via the LPD protocol using lpd. On the sender host, a queue is needed from which the lpd of the sender takes the print job and forwards it to the lpd of the recipient.
LPRng also supports sending via the LPD protocol without a local lpd. Using the LPD protocol, the lpr program in the lprng package can directly forward the print job to the lpd of the recipient.
CUPS supports sending via the LPD protocol using the CUPS daemon (cupsd). On the sender host, a queue is needed from which cupsd takes the print job and forwards it to the lpd of the recipient.
Sending via the LPD protocol is not supported by the CUPS client print system.
As the LPD protocol is very old, all operating systems should support this protocol at least as the sender. If the support is not available by default, suitable software may need to be installed.
LPRng supports reception via the LPD protocol using lpd.
CUPS supports reception via the LPD protocol using the cups-lpd. cups-lpd must be activated by means of inetd or xinetd.
The CUPS client print system does not support reception via the LPD protocol.
As the LPD is very old, every normal print server, print server box, and network printer should support this protocol.
For print server boxes and network printers, the name of the queue varies from model to model or there are several queues with different characteristics.
The sender sends a print job to the queue on the recipient via the IPP protocol. According to the IPP protocol, the recipient is expected to receive print jobs on port 515. Therefore, a service receiving the print jobs on port 631 (in CUPS, this service is called cupsd) and a queue in which received print jobs can be placed are needed on the receiving host.
LPRng does not support the IPP protocol.
CUPS also supports sending via the IPP protocol without a local cupsd. The programs lpr or lp from the cups-client package, the program xpp, and the KDE program kprinter can forward the print job directly to the recipient via the IPP protocol.
The IPP protocol is relatively new, so support may not be available in all cases.
LPRng does not support the IPP protocol.
CUPS supports reception via the IPP protocol using cupsd. On the receiving host, a queue is required in which cups-lpd can place the print job received from the sender.
The CUPS client print system does not support reception via the IPP protocol.
The IPP protocol is relatively new, so support may not be available in all cases.
With this method, no print job is sent to a remote queue, as there is no protocol (LPD or IPP) that can handle print jobs and queues. Rather, the raw data is sent directly to a remote TCP port via TCP socket. Usually, this approach is used for sending printer-specific data to print server boxes and network printers. In many cases, the TCP port 9100 is used for this purpose.
LPRng supports sending directly via TCP socket using lpd. On the sender host, a queue is needed from which the lpd of the sender takes the print job and sends the print data to the TCP port of the recipient.
With LPRng, this also works without a local lpd. Using the -Y option, the lpr program from the lprng package can send the print data directly to the TCP port of the recipient via TCP socket. Refer to the man page of lpr.
CUPS supports sending directly via TCP socket using cupsd. On the sender host, a queue is needed from which cupsd takes the print job and sends the print data to the TCP port of the recipient.
The CUPS client print system does not support direct sending via TCP socket.
Nevertheless, data can be sent to a port on a host using a command such as the following:
cat <filename> | netcat -w 1 <host> <port>
No print system is required for receiving directly via TCP socket and there is no print system that supports this directly, as it makes little sense to send raw data when there is a print system that supports real print jobs and a suitable protocol (LPD or IPP).
Nevertheless, in the CUPS print system data can be received via port 9100 and forwarded to a queue by entering in /etc/inetd.conf:
9100 stream tcp nowait lp /usr/bin/lp lp -d <queue>
If filtering is not wanted, append -o raw as an option.
You can emulate the properties of a print server box that receives data via port 9100 and directly forwards them to the printer. To do this, append a line such as the following in /etc/inetd.conf:
9100 stream tcp nowait lp /bin/dd dd of=/dev/lp0
The support status varies from case to case.
The port depends on the model. For HP network printers and HP JetDirect print server boxes, the default port is 9100. For JetDirect print server boxes with two or three local printer ports, the ports are 9100, 9101, and 9102. The same ports are used by many other print server boxes. If you are not sure, ask the manufacturer or consult the printer manual to find out which port is used to address the printer directly. Additional information about this can be found in the /usr/share/doc/packages/lprng/LPRng-HOWTO.html (especially under /usr/share/doc/packages/lprng/LPRng-HOWTO.html#SECNETWORK,
/usr/share/doc/packages/lprng/LPRng-HOWTO.html#SOCKETAPI and /usr/share/doc/packages/lprng/LPRng-HOWTO.html#AEN4858
Several workstations, one print server, and one or more print server boxes or network printers:
The workstations should also use the LPRng print system.
A special queue is available on the print server for every network printer or every printer connected to a print server box.
Via the LPD protocol, the workstations send the print jobs to the print server queue associated with the printer.
Depending on which print server box or network printer supports which protocol, the print server uses the LPD protocol or direct data transmission via TCP socket for sending the print data to the print server box or network printer.
The workstations should also use the CUPS print system. In this case, the CUPS client print system is sufficient.
A special queue is available on the print server for every network printer or every printer connected to a print server box.
Via the IPP protocol, the workstations send the print jobs to the print server queue associated with the printer.
Depending on which print server box or network printer supports which protocol, the print server uses the LPD protocol or direct data transmission via TCP socket for sending the print data to the print server box or network printer.
A few workstations, no print server, and one or several print server boxes or network printers:
A special queue is available on each workstation for every network printer or every printer connected to a print server box. As all queues must be configured on all workstations, this only makes sense if there are only a few workstations.
Depending on which print server box or network printer supports which protocol, the print server uses the LPD protocol or direct data transmission via TCP socket for sending the print data to the print server box or network printer.
If several workstations concurrently send data to the same print server box or network printer, data loss and other problems may occur, especially if the LPD protocol is used for the data transmission. The implementation of the LPD recipient in the print server box or network printer is often inadequate, as there is usually not enough storage space for buffering several print jobs. If, however, the data transmission is performed exclusively via TCP socket, the system can be quite reliable, depending on the print server box or network printer.
The previous section described how print jobs or raw data are transmitted from the workstation to the printer. The filtering process (the conversion of the original data to printer-specific data) is yet another subject. The conversion to printer-specific data for network printing occurs in the same way as for a printer locally connected to a stand-alone system. The print filter for network printing and a stand-alone system is identical, although the data flow from the workstation to the printer is more complicated and goes through several stages such as the following:
Workstation -> Print Server -> Print Server Box -> Printer
At this point in the chain, the source file must be converted into the format that the printer is able to print (PostScript, PCL, ESC/P). The conversion is handled by a print filter which should run on a machine with sufficient computing power and storage space — on the workstation or on a print server, but not in a print server box or network printer. Usually, print server boxes and network printers do not have any built-in print filter. Thus, they can only receive printer-specific data and forward it to the printer or printing unit.
A queue can configured with or without a filter. In the YaST printer configuration, the first step is the selection of the Hardware category for printing (e.g., via CUPS network server, via LPD network server, or direct printing on a network printer or print server box). Therefore, the default setting (with or without filtering) should normally work. If necessary, the default setting can be changed in the YaST printer configuration.
The default settings are as follows:
no filtering (as this is usually done on the CUPS network server)
no filtering (as this is usually done on the LPD network server)
Filtering
If the queue is configured with filtering, the original data is buffered in the queue and subsequently filtered on the host on which the queue is located. Then the converted data is sent to the recipient (see Figure 5.2. “Overview of the Filtering Procedure”).
The following paragraphs describe the filtering options for the above examples.
Several workstations, one print server, and one or more print server boxes or network printers:
The easiest and most suitable configuration is shown in Figure 5.3. “Configuration 1”.
For every queue with filtering on the print server, a queue without filtering can be configured on every workstation. Thus, the print jobs can be buffered in the workstation in the event of a temporary print server failure or overload. In this way, printouts can always be generated on the workstations without having to wait until the print server is available. The disadvantage of this approach is that all queues have to be configured on all workstations (though without filtering) and certain modifications of the queues on the print server (such as renaming, addition, or deletion of queues) require an adaption of the configurations on all workstations. Changes in the filtering process do not require any adaption.
This rather sophisticated configuration is shown in Figure 5.4. “Configuration 2”.
Theoretically, the filtering process could take place on the individual workstations. In this case, the only function of the print server would be the transmission of the printer-specific data to the print server boxes or network printers. However, this would degrade the print server to an oversized print server box, which is usually not very practical, unless the print server's performance is not sufficient for filtering. The disadvantage of this approach is that all queues must be configured on all workstations (with filtering) and all changes would require the adaption of the configurations on all workstations. Figure 5.5. “Configuration 3” shows this configuration.
A few workstations, no print server, and one or several print server boxes or network printers:
The only possible configuration is to have a queue with filtering for each printer on every workstation. The disadvantage of this approach is that all queues must be configured on all workstations (with filtering) and all changes would require the adaption of the configurations on all workstations. Figure 5.6. “Configuration 4” shows this configuration.
If you consider the above cases in reverse order, see the development from the configuration on a stand-alone system with a locally connected printer to a high-level configuration for several workstations with a print server for several print server boxes or network printers.
The previous constellations looks almost the same as the configuration for a stand-alone system with a locally connected printer. Figure 5.7. “Configuration 5” shows the configuration for a stand-alone system.
First, make sure everything is in order with the TCP/IP network in general, including name resolution.
Connect the printer to the first parallel port of your computer. To test the connection, initially set it up as a local printer to exclude any network-related problems. If the printer works locally, you have found the correct Ghostscript driver and other configuration options.
The following command tests whether lpd can be reached via TCP on port 515 of host:
netcat -z <host> 515 && echo ok || echo failed
If lpd cannot be reached in this way, it is either not running at all or there is some basic network problem.
This way you can get a (possibly very long) status report about the queue on the host, if lpd is running and the host is reachable. As root, enter the following command:
echo -e "\004<queue>" \ | netcat -w 2 -p 722 <host> 515
If lpd does not respond, it is either inactive or there are basic network problems. If lpd responds, the response should indicate why queue on host cannot be used for printing. Examples:
Example 5.1. Error Message of lpd
lpd: your host does not have line printer access lpd: queue does not exist printer: spooling disabled printer: printing disabled
If you receive such a response from the lpd, the problem is caused by the remote lpd.
By default, a CUPS network server broadcasts its queue every thirty seconds via the UDP port 631. Thus, the following command can be used to test if a CUPS network server exists in the network:
netcat -u -l -p 631 & PID=$! ; sleep 40 ; kill $PID
By default, CUPS network servers broadcasts its queues via port 631 at thirty-second intervals. After waiting for forty seconds, the output should appear as follows if a broadcasting CUPS network server exists:
The following command tests whether cupsd can be reached via TCP on port 631 of host:
netcat -z <host> 631 && echo ok || echo failed
If cupsd cannot be reached in this way, it is either not running at all or there is some basic network problem.
lpstat -h <host> -l -t
With this command, get a (possibly very long) status report about all queues on host, provided cupsd is running and the host is reachable.
echo -en "\r" \ | lp -d <queue> -h <host>
This command sends a print job consisting of a single carriage return character to test if the queue on host accepts any print jobs. This test command should not print out anything or only cause the printer to eject an empty page.
To test the basic operability of an SMB server, enter:
echo -en "\r" \ | smbclient '/<HOST>/<SHARE>' '<PASSWORD>' \ -c 'print -' -N -U '<USER>' \ && echo ok || echo failed
For HOST, enter the host name of the Samba server. For SHARE, enter the name of the remote queue (i.e., the name of the Samba share). For PASSWORD, enter the password string. Replace USER with the user name. This test command should not print out anything or only cause the printer to eject an empty page.
The following command displays any shares on the host that are currently available. Details on this can be obtained from the manual page of smbclient.
smbclient -N -L <host>
Spoolers on print server boxes often become unreliable when having to deal with relatively high printing volumes. As the cause of this lies with the server-side spooler, there is mostly no way to fix this. As a workaround, however, circumvent the spooler on the print server box by using TCP sockets to directly stream data to the printer connected to the host.
This turns the print server box into a mere data converter between the two different data streams (TCP/IP network and local printer line), which effectively makes the printer behave like a local printer although it is connected to the print server box. Without the spooler acting as an intermediary, this method also gives much more direct control over the printer device in general. To use this method, you need to know the corresponding TCP port on the print server box. If the printer is switched on and properly connected, you should be able to determine the TCP port a minute or so after booting the print server box with the program nmap. Running nmapIP-address on the print server box may return an output similar to this:
Port State Service 23/tcp open telnet 80/tcp open http 515/tcp open printer 631/tcp open cups 9100/tcp open jetdirect
This output means:
You can log in on the above print server box with telnet to look for important information or to change basic configuration options.
The above print server runs an HTTP daemon, which can provide detailed server information or allow you to set specific printing options.
The print spooler running on the print server box can be reached over the LPD protocol on port 515.
The print spooler running on the print server box can also be reached over the IPP protocol on port 631.
The printer connected to the print server box can be accessed directly via TCP sockets on port 9100.
By default, nmap only probes a number of common ports, as listed in /usr/share/nmap/nmap-services. To have all ports probed, use the command nmap -p from_port-to_port IP-address — which, however, might take quite some time. To learn more about this, have a look at the manual page with man nmap.
With a command like:
echo -en "\rHello\r\f" | netcat -w 1 <IP-address> <port> cat <filename> | netcat -w 1 <IP-address> <port>
send entire strings or files straight to a given port, which is helpful when testing whether a printer can be addressed through that port.
By default, the CUPS daemon only supports the IPP protocol. However, the program /usr/lib/cups/daemon/cups-lpd from the cups package enables the CUPS server to accept print jobs sent to port 515 via the LPD protocol. For this purpose, the respective service must be activated for xinetd. This can be done with YaST or manually by activating the respective line in the file /etc/xinetd.d/cups-lpd.
There may be situations where you want to run both LPRng and lpdfilter and CUPS on one system, maybe because you want to enhance the functionality of LPD with some CUPS features or because you need the LPRng and lpdfilter system as an add-on for certain special cases.
Running the two systems together on the same system leads to a number of problems, however. Below, we list the most important of these and briefly explain the limitations resulting from them. The topic is too complex to describe them in any greater detail here. There are several ways to solve these issues, depending on the individual case.
You should not rely on YaST for configuration if you install both printing systems. The printer configuration module of YaST has not been written with this case in mind.
There is a conflict between lprng and cups-client, because they contain a number of files with identical names, such as /usr/bin/lpr and /usr/bin/lp. You should, therefore, not install cups-client. This, however, means that no CUPS-based command-line tools are available, but only those included with LPRng. You are still able to print through CUPS print queues from the X Window System with xpp or kprinter, however, as well as from all application programs with built-in support for CUPS.
By default, cupsd creates the /etc/printcap file when started and writes the names of CUPS queues to it. This is done to maintain compatibility with applications that expect queue names in /etc/printcap to offer them in their print dialogs. With both printing systems installed, disable this cupsd feature to reserve /etc/printcap for exclusive use by the LPRng and lpdfilter printing system. As a result, applications that get queue names only from /etc/printcap can use only these local queues, but not the remote queues made available by CUPS through the network.