http://www.mandrakeuser.org/docs/hardware/hcups3.html

MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!

 
 

*DocIndex - Hardware

Printing With CUPS

Setup And Configuration II

* Accessing Remote printers:
- CUPS/IPP
- LPD
- AppSocket
- Windows

Related Resources:

See Resources on article index

Modified: Nov. 15, 2000
Author: Till Kamppeter

 

Setup and Configuration II

* Accessing Remote Printers

CUPS does not only allow access to local printers, but also to all kinds of remote printers. Except for CUPS printers in the local network, you have to choose a machine in your local network to install a queue for the remote printer on. This machine broadcasts the information about the remote printer to all the other machines in the local network (assuming that they run the CUPS daemon and the broadcasting of the queue machine is not restricted). So a remote printer needs to be installed only once in a local network.

* article index * top

CUPS or IPP server

If you have a simple network with shared Internet access (Internet access through one server) at home or in a small office, you should also take a look at the "Small network" example.

The simplest scenario is if the remote printer you want to use is hosted by another machine in your local network running the CUPS daemon. If there are no access or broadcasting restrictions configured on the remote machine with the printer, it will broadcast the information of the printer to your machine every 30 seconds and so the printer gets automatically detected by your machine within 30 seconds after starting your local CUPS daemon. If the remote server goes down or the printer is removed, the appropriate queue on your local machine will disappear within 5 minutes. So you do not need to configure anything, and you do not need to restart the CUPS daemon.

This broadcasting only works when all your CUPS servers and CUPS clients are in the same local network.
The "same local network" means that the IP addresses are the same in all the fields where the Netmask is set to '255', for example:

Server: 192.168.1.34, Client: 192.168.1.94, Mask: 255.255.255.0
Server: 132.180.23.40, Client: 132.180.97.83, Mask: 255.255.0.0

Whereas in this case server and client are not in the same local network:

Server: 133.181.93.68, Client: 133.181.1.95, Mask: 255.255.255.0

In this case the broadcasting does not work. If you want to print on all the printers which the server in this example knows of, you have to add the line

BrowsePoll 133.181.93.68:631

to your '/etc/cups/cupsd.conf' file. If you want that these printers are available to your whole local network and not only to the machine where you have added the BrowsePoll line, add the line

BrowseRelay 127.0.0.1 255.255.255.255

Restart the CUPS daemon with:

service cups restart

Alternatively, you can use 'kupsdconf' and enter the name or IP of the server in "Browsing"/"Connection"/"Poll addresses". You can enter more than one server for polling its printer information.

Instead of polling the printer information through the client, you can also tell the server's CUPS daemon that it should broadcast the printer information to the network you desire. Leave the '/etc/cups/cupsd.conf' file on your client alone and add the lines

BrowseAddress [Broadcast IP for 1st network]
BrowseAddress [Broadcast IP for 2nd network] ...

to the '/etc/cups/cupsd.conf' of the server. In our example networks you should add:

BrowseAddress 133.181.93.255
BrowseAddress 133.181.1.255

The broadcast addresses of your networks can be determined by entering

ifconfig

on a machine in the appropriate local network and looking for a "Bcast" entry. Restart the CUPS daemon on the server with

service cups restart

or use "Browsing"/"Connection"/"Broadcast addresses" in 'kupsdconf'.

Another important point is that every machine with a printer made available by CUPS needs a defined name. This name must be known to the clients and be used in the information broadcast into the network. The print server must have a fixed IP for the local network and not a dynamic one. You can set its name with 'Linuxconf' choosing "Networking" and then "Host name and IP network devices". In the upcoming dialog click on the tab for the network interface for your local network. Fill in the "Primary name + domain" field with the desired name, for example "server.localdomain". Do not keep the name "localhost" or "localhost.localdomain" here.

To get the chosen name broadcast, add a line

ServerName [server's name]

to the '/etc/cups/cupsd.conf' file on the server and restart the CUPS daemon with

service cups restart

In 'kupsdconf', go to the "Server" section and fill in the "Server name" field with the server's name.

If the clients cannot resolve that name (e.g. due to lack of DNS), add an appropriate entry (one per server) to the '/etc/hosts' file on the clients:

[servers's IP] [server's name].[domain] [server's name]

for example

133.181.93.68 server.localdomain server

Note: By this method you always get all printers and classes of the remote server, you cannot choose individual printers.

Important: If a machine in local network has two different IPs, one for the local network (192.168.1.x) and a completely different one for 'outside' (e.g. the Internet), it is possible that CUPS uses the outside address. In this case broadcasting will not work.
Use the BrowsePoll line on the client or the BrowseAddress line on the server. In both cases the correct server name for the local network must be set in the ServerName line of '/etc/cups/cupsd.conf' on the server. See the "Small network" example.

If you do not want all the printers from the CUPS server in the remote network being visible on your client or if you want to have the queues for the printers of the remote CUPS servers being broadcast in your local network, you can install selected queues on your client:

Enter the web interface of CUPS (http://localhost:631/printers/) and click on "Add Printer" at the end of the page. Enter name, description, and location for the queue, choose the second entry for "Internet Printing Protocol" on the device page. On the next page, enter:

ipp://[server name or IP]/printers/[name of the printer on the server]

So if your server's name is "paperwaster" and it has a printer named "laserjet", you enter:

ipp://paperwaster/printers/laserjet

Afterward choose the appropriate manufacturer and model and your queue for the printer in the remote network is ready.

You can do this on the command line, too:

lpadmin -p [local queue] -E -v \
ipp://[server]/printers/[printer on server] -m [PPD file]

CUPS uses the Internet Printing Protocol (IPP) for communication between the daemons on the machines on a network. There are also some Ethernet-connected printers which use IPP. They behave like a remote CUPS server, but the default configuration (broadcasting, access, ...) can be completely different. Check the printer's web interface (http://[printer name or IP]/ or http://[printer name or IP]:631/).

* article index * top

LPD server

LPD (Line Printer Daemon) servers are very common, because LPD is the default printing system of every other Linux distribution and in every commercial Unix. It is also used by some Ethernet-connected printers (as Tektronix Phaser) and one can configure Windows NT servers to make their printers available via LPD.

All which is needed for this form of access is already in the CUPS package, so you do not need to install additional packages. In 'PrinterDrake' you choose "Add", then "Remote Printer" and afterward "Remote lpd server". After entering the name, description, and location, you will be asked for the host name of the server and the name of the printer queue on the server (on most Ethernet connected printers and printing server boxes the queue name is "lp", "lpr", or "lpd", on a Tektronix Phaser also "PS"). Afterward you choose the driver like for a local printer and you are set.

In 'Kups' you choose "Printer"/"Add" and in the wizard you choose "LPD". Then you enter the server's name and the name of the queue on the server, afterward the rest of the information like for a local printer. You cannot enter a wrong queue name, 'Kups' checks the name which you have entered. After clicking on "Add printer" on the web interface and entering the queue name, you choose "LPD/LPR Host or printer" on the page for selecting the device. On the next page you enter:

lpd://[server name]/[queue name on server]:

Afterward you select the driver as usual.

* article index * top

AppSocket network printer

The AppSocket protocol is only used by Ethernet-connected printers or printing server boxes (e. g. HP JetDirect). In 'PrinterDrake', you choose "Add", "Remote Printer", and "Network printer (socket)". Later on you will be asked for the printer's host name and a port. You only need to enter the port when it is not the default (9100).
In the wizard for adding printer queues in 'Kups', choose "Socket" and on the next page "Scan" and after some seconds you get a list of all AppSocket printers in your local network. If you want to access a printer with a port other than 9100 or in a remote network, change the scope of the scanning process with the "Settings" button or enter host name and port for the desired printer manually.
In the web interface of CUPS you have to choose "AppSocket/HP JetDirect" as the device. Enter

socket://[hostname]

or

socket://[hostname]:[port]

on the next screen.

* article index * top

Windows server

To use a printer on a Windows server, CUPS has to work as an SMB client. To be able to do so the "samba-client" package must be installed (urpmi samba-client).
When the Samba client package is there, the choice "SMB" in the printer adding wizard of 'Kups' will be available. Simply choose it, enter the login and password for your Samba server (or use the guest access) and click on "Scan network ..." on the next screen. Click on the + on the left of the name of your workgroup and then double-click the name of your server to get a list of the provided printers. Choose the printer and go on like for a local printer.
In 'PrinterDrake', you choose "SMB/Windows 95/98/NT" after you have clicked on "Add" to install a new printer. After entering the queue name you are asked for the server name and IP, user name and password, the share name, and the workgroup. Except for user name and password all fields have to be filled out. Leaving out user name and password means that you access the printer via a guest account. The share name is the name of the printer on the Windows server. It is not recommended to use the web interface or 'lpadmin' to set up the access to a Windows printer, since you have to enter the password in clear text in both.

* article index * top

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.