How to configure a "two-tier" CUPS printing architecture using BrowsePoll in RHEL.
Environment
- Red Hat Enterprise Linux 6.3
Issue
- What I need is to print to queues on server1 that are shared from server2 or server3 and deliver them
finaly to network shared printers on server2 or server3. - How to create a "master" print server that shares printers already shared by other "slave" print servers.
-
I'm trying to create a printing architecture like this:
Clients ----------> Master ----------> Print -------------> Printers Server Servers +------- printer2a client1a ----+ +------- printer2b client1b ----+ +----- server2 ----+------- ... client1c ----+ | +------- printer2z ... ----+----- server1 ----+ client1z ----+ | +------- printer3a +----- server3 ----+------- printer3b +------- ... +------- printer3z
Resolution
It is not possible to "re-share" printers that have already been shared using the Internet Printing Protocol (IPP).
However, there is a workaround available. By using the LPD protocol between the "master" server and the "slave" print servers it is possible to configure a print architecture where the clients use the BrowsePoll method to detect printers shared by master server. The master server then sends the print jobs to the print servers, which actually send them to the printer.
To diagram this architecture in ASCII, it would look like the following (the network protocols used to communicate between the servers are shown in parenthesis):
Clients -> (IPP) -> Master -> (LPD) -> Print -> (socket) -> Printers
Server Servers (or lpd)
+------- printer2a
client1a ----+ +------- printer2b
client1b ----+ +----- server2 ----+------- ...
client1c ----+ | +------- printer2z
... ----+----- server1 ----+
client1z ----+ | +------- printer3a
+----- server3 ----+------- printer3b
+------- ...
+------- printer3z
To configure this, perform the following steps:
Print Server Configuration
-
Install, enable, and start the
cups-lpdservice with the following commands:yum install cups-lpd chkconfig cups-lpd on chkconfig xinetd on service xinetd start -
Modify
/etc/cups/cupsd.confas follows.-
Change "
Listen localhost:631" to "Listen *:631" so that CUPS listens for print requests from other servers. -
Change "
Browsing On" to "Browsing Off" to disable browsing on this server. Since we can't re-share printers, we'll need to explicitly add them on the master server. -
Add "
Allow from all" in the "<Location />" section, so that it looks like:<Location /> Order allow,deny Allow from all </Location>This is done to allow other servers to access this server.
-
-
Afer making the changes to
cupsd.conf, restart CUPS (with "service cups restart"). -
Add one or more printers to this server and mark them as shared. This could be done using the graphical interface, but it can be also done by using the lpadmin command as follows:
lpadmin -p <printer> -v socket://<ip.address.of.printer> -o printer-is-shared=true -EThe options for
lpadminare as follows:-
The "
-p <printer>" option adds the named<printer>to the server. -
The "
-v socket://<ip.address.of.printer>" option tells CUPS to communicate with the network printer located at<ip.address.of.printer>using the "AppSocket" (or JetDirect) protocol. You could use "lpd://" instead of "socket://" if the printer needed that protocol instead. -
The "
-o printer-is-shared=true" option sets the printer up as a shared printer. -
The "
-E" option enables the printer.
-
Master Server Configuration
-
Modify /etc/cups/cupsd.conf as follows.
-
Change "
Listen localhost:631" to "Listen *:631" so that CUPS listens for print and browsing request from other servers. -
Add "
BrowseRemoteProtocols none" to stop this server for browsing printers from other servers. -
Add "
Allow from all" in the "<Location />" section, so that it looks like:<Location /> Order allow,deny Allow from all </Location>This is done to allow other servers to access this server.
-
-
After making the changes to
cupsd.conf, restart CUPS (with "service cups restart"). -
Add print queues on the master server that send jobs to the printers on the print server(s). You can use a command like the following to accomplish this:
lpadmin -p <printer> -v lpd://<ip.address.of.print.server>/<printer> -o printer-is-shared=true -EThe options for this command are the same as above. What's important is that the name of the printer remains consistent throughout the process. So, for example, if the printer that is created on a print server is "hpprinter" then the command to run on the print server is:
lpadmin -p hpprinter ...and the command to run on the master server is:
lpadmin -p hpprinter -v lpd://print-server1.example.com/hpprinterIt's also important to use the "
lpd://" protocol to communicate with the print server, instead of "ipp://". When "ipp://" is used to communicate between the master server and the print server, it is not possible to re-share the printers from the master server to the clients.
Client Configuration
-
Once the servers are configured, add the following line to
/etc/cups/cupsd.confon the client(s):BrowsePoll <ip.address.of.master.server>where
<ip.address.of.master.server>is the IP address or hostname of the master server configured in the section above. This will allow the client to automatically access printers that are shared on the master server.
Testing
Once the print server(s), master server, and client are configured, you can use the the lpstat command on the client to show the printers. For example:
[root@test ~]# lpstat -t
scheduler is running
no system default destination
device for hpprinter: ipp://master-print.example.com/printers/hpprinter
hpprinter accepting requests since Fri 02 Aug 2013 01:19:23 PM PDT
printer hpprinter is idle. enabled since Fri 02 Aug 2013 01:19:23 PM PDT
Then try to print a file on the client.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
