February 22, 2019

Sharing Linux Printers Across Subnets - page 3

Printing Is Still Vexatious. But We Can Prevail

  • December 20, 2007
  • By Carla Schroder
Pick one computer in the network to act as your "relay" server; it will contact the printer server and then relay its printers to the rest of the subnet. Just add these lines to cupsd.conf:

# Allow shared printing
Order allow,deny

Restart CUPS, and in half a minute or so all the computers on should see all the printers that are physically attached to the server at What if you have more than one printer server to share? Then add a line for each server like this:


This is nice and efficient because all you need is one PC per subnet to act as the relay.

You can easily test all of this from the comfort of your secret armored underground network administrator lair, because of course you have OpenSSH set up all over your network so that you can securely log in to all hosts and do stuff. First log into your relay computer, then use lpstat to see what printers are available:

$ lpstat -v
device for HP_LaserJet_3050: ipp://uberpc.alrac.net:631/printers/HP_LaserJet_3050
device for HP_LaserJet_6L_LPT_parport0_HPLIP: ipp://xena.alrac.net:631/
device for tp0: ipp://uberpc.alrac.net:631/printers/tp0
Now that is a happy sight; you can see printers from two different printer servers. You can see if they are ready to use:
$ lpstat -a HP_LaserJet_3050
HP_LaserJet_3050 accepting requests since Tue 18 Dec 2007 07:07:39 PM PST

You can even print a test page remotely:

$ lpr -P HP_LaserJet_3050 /etc/cups/cupsd.conf

CUPS relies on polling to notify the entire network about what printers are up. By default each CUPS server send out an 80-byte broadcast packet every thirty seconds. If this gets to be too much, or if your printer setup doesn't change very often, you can change this behavior:

BrowseInterval  360
BrowseTimeout 600
This polls the network every six minutes, and if any CUPS server does not respond within ten minutes it is removed from the browse list.

So there you are- as easy as falling over and a lot more fun.


CUPS has bales of documentation; click the Documentation/Help tab in your CUPS Web interface, and visit CUPS Documentation

Carla Schroder is the author of the Linux Cookbook and the newly-released Linux Networking Cookbook, and is a regular contributor to LinuxPlanet.

Most Popular LinuxPlanet Stories