Configuring CUPS on Linux
CUPS Master Print Server
Stop CUPS and back up your current CUPS configuration:
# service cups stop
# cp -a /etc/cups /etc/cups.saved
Edit /etc/cups/cupsd.conf to allow other servers to connect to printers on the master server. First change:
Listen localhost:631
to:
Listen *:631
or
Listen 0.0.0.0:631
This will configure CUPS to listen on all network interfaces. If you would like to limit CUPS to listening on a particular interface, enter the IP address of that interface instead of * or 0.0.0.0. For example:
Listen 192.168.102.32:631
Add Allow @LOCAL to the bottom of the stanza so It looks like the following:
<Location />
# Allow shared printing
Order allow,deny
Allow @LOCAL
</Location>
This will allow clients on the “local” network (the subnet on which the Master Print Server is located) to access CUPS on the Master Print Server. If you would like all clients to access the Master Print Server, then use “Allow all” instead of “Allow @Local”.
The following steps involve making changes to the CUPS configuration files. For RHEL 6 and earlier, the changes should be made to /etc/cups/cupsd.conf. For RHEL 7 and later, the changes should be made to /etc/cups/cups-browsed.conf.
Remove or comment out the following line:
BrowseRemoteProtocols dnssd cups
If you would like to use printer browsing to advertise shared printers, add the following lines (they may already exist):
Browsing On
BrowseLocalProtocols cups
If you don’t want your CUPS server to send out broadcast packets, but would rather have your CUPS clients poll the CUPS servers for shared printers, change the line:
Browsing On
to
Browsing Off
After saving cupsd.conf, (re)start CUPS by running:
# service cups start
CUPS Client
NOTE: The following steps involve making changes to the CUPS configuration files. For RHEL 6 and earlier, the changes should be made to /etc/cups/cupsd.conf. For RHEL 7 and later, the changes should be made to /etc/cups/cups-browsed.conf. Which change you will make depends on your system environment, as described below.
If the master print server is using browsing to advertise shared printers, as described above, add the flowing line to the CUPS configuration file:
BrowseRemoteProtocols cups
This will allow your CUPS client to gather shared printer information from all the Master Print Servers on the local subnet. It will not work, however if your Master Print Server(s) are on different subnets than your clients.
If your CUPS client system will use browse polling to discover printers, then add the following line to the appropriate CUPS configuration file, substituting the actual IP address (or host name) of your Master Print
Server for 10.12.13.14:
BrowsePoll 10.12.13.14
If you have multiple Master Print Servers (as would be the case in a high-availability CUPS setup), then use a separateBrowsePoll line for each of the Master Print Servers in your environment. Since the BrowsePoll option actively queries the Master Print Server for information (using the CUPS-Get-Printers IPP request) this method works across subnets. However, since a TCP connection is required to poll the server, it consumes slightly more network resources than CUPS Browsing.
Start CUPS
service cups start
For RHEL 7, you can also use the command “systemctl start cups.service”
If you are running RHEL 7, enable and start the “cups-browsed” service:
systemctl enable cups-browsed
systemctl restart cups-browsed
Verify that the remote printer(s) are now available on the local client. Please note that if you are using CUPS Browsing, it may take several minutes for the ilst of printers to be populated on the client, as the CUPS Master Servers only broadcast shared printer information once every minute.
$ lpstat -t
scheduler is running
no system default destination
device for pcl: ipps://master-server.local:631/printers/pcl
device for postscript: ipps://master-print-server.local:631/printers/postscript
device for textonly: ipps://master-print-server.local:631/printers/textonly
pcl accepting requests since Wed 09 Nov 2016 05:18:09 PM PST
postscript accepting requests since Wed 09 Nov 2016 05:18:09 PM PST
textonly accepting requests since Wed 09 Nov 2016 05:18:09 PM PST
printer pcl is idle. enabled since Wed 09 Nov 2016 05:18:09 PM PST
printer postscript is idle. enabled since Wed 09 Nov 2016 05:18:09 PM PST
printer textonly is idle. enabled since Wed 09 Nov 2016 05:18:09 PM PST
If you are running RHEL 7.7 or later, the device for the remote printers will begin with implicitclass instead of ipp or ipps. For example:
lpstat -t
scheduler is running
no system default destination
device for test: implicitclass:test
test accepting requests since Fri 31 Jan 2020 10:14:03 AM PST
printer test is idle. enabled since Fri 31 Jan 2020 10:14:03 AM PST
Attempt a test print
$ lp -d textonly /etc/fstab
request id is textonly-1 (1 file(s))
If all goes well, the test print should be successful