Jump to Navigation

254 - CUPS shared printer configuration

All you need to make this work are a central Linux/CUPS printer server, and one Linux PC per subnet to act as a relay printer server.

You have two subnets, 192.168.11.0/24 and 192.168.12.0/24. You need to have routing already configured to pass traffic between the two subnets,
so everyone can ping everyone. So you have your CUPS printer server at 192.168.11.1, and you want computers on 192.168.12.0/24 to be able to use it.
This is a complete, barebones example CUPS configuration for 192.168.11.1:

1. Print Server (192.168.11.1) configuration

# vi /etc/cups/cupsd.conf

========================================================

LogLevel warning

#this varies; check your distribution
SystemGroup lpadmin

# Allow remote users to access this server
Port 631
Listen /var/run/cups/cups.sock

# Enable printer sharing
Browsing On
BrowseAllow all
BrowseAddress 192.168.12.255
BrowseAddress 192.168.13.255
DefaultAuthType Basic

# Allow shared printing
Order allow,deny
Allow 192.168.12.0/24
Allow 192.168.13.0/24

========================================================

2.  Restart cups server

# service cups restart

3. Relay Server(192.168.12.1) Configuration

This will contact the printer server and then relay its printers to the rest of the 192.168.11.0/24 subnet.
Just add these lines to cupsd.conf :

# vi /etc/cups/cupsd.conf

========================================================

BrowsePoll 192.168.11.1
BrowseRelay 127.0.0.1 192.168.12.255

# Allow shared printing
Order allow,deny
Allow 192.168.12.0/24

========================================================

4. Restart CUPS on Relay Seerver

# service cups restart

5. Check all printers shared

First log into your relay server, then use lpstat to see what printers are available :

# lpstat -v

# lpstat -a

6. Print Test

# lpr -P HP_LaserJet_4014 /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.
If you want to also serve Windows clients, simply set up a Samba printer share in the usual way, and use Samba's own access controls to cross subnets.

 



Main menu 2

Story | by Dr. Radut