guinix international

Computing Without Borders

 

guinix TechNote: A Tiny Print Server

Using the Netgear PS101 with LPD/LPRng on Unix

Introduction

The Netgear PS101 is a tiny "print server", about half the size of a pack of cigarettes. It connects directly and discretely to the centronics interface of any parallel printer, so you don't even need a parallel cable. For about $60(USD) at a local office supply store, after discounts and coupons, it provides an inexpensive and effective means to put a parallel printer anywhere on a local area network, to share among a variety of hosts and operating systems.

And since many laptops and newer systems don't even have parallel ports anymore --most are moving to USB instead-- the PS101 can help you keep using your "legacy" printer for a long time to come.

Note, though, that we use the term "print server" somewhat loosely here. The PS101 won't do the whole job you might desire from such a device. For example, no spooler or filtering, and it doesn't directly support protocols such as AppleTalk or Netware, either.

In fact, the packaging and manuals for the PS101 would suggest it is usable for printing only from Windoze systems!

Fortunately the device is a bit more useful than the documentation would suggest.

Solution

The key to the most flexible use of the PS101 is to combine it with another host set up as a standard LPD/LPRng print server, including the usual spool queue and input filtering. The PS101 is then used simply for network connectivity, providing a remote printer to use in the printcap file on the "real" print server. All other workstations on the network are then configured to deliver jobs to the real print server, rather than directly to the PS101.

A simple diagram:

+---+
|   |
|   |\
|   | \
+---+  \
"apple" \
         \
+---+     -->    +---+            +====+
|   |            |   |       +-+  |====|
|   | ------>    |   | --->  | |--|    |
|   |            |   |       +-+  +----+
+---+     -->    +---+       ps101/LaserSnot
"berry"  /       "spool"
        /
       /
+---+ /
|   |/
|   |
|   |
+---+
"candy"

Used in this way, the PS101 device mostly provides ethernet connectivity for a printer that is otherwise not network enabled. Why not just connect the printer directly to a parallel port on the "real" print server then? A couple of possible reasons:

  • The "real" print server is in the closet, and you would prefer to have the printer in your work area.

  • The "real" print server is something like a small Soekris box, which doesn't come with a parallel port.

The first step in using the PS101 is to configure network connectivity for the device. Of course you have the usual Windoze-based setup tools for this, but you don't need to use them if you don't want to.

Out of the box, the PS101 is configured to get its IP address via DHCP. If you don't have a DHCP server on your network, make a note of the MAC address appearing in very small print on the label of the unit. Then use an ARP command to setup a working IP for the device:

# arp -s 10.0.1.77 00:c0:02:xx:xx:xx

Where 00:c0:02:xx:xx:xx is the MAC address for your device, and 10.0.1.77 is an IP address available on your local network.

Now you can point any web browser at http://10.0.1.77/ and get at the simple PS101 configuration screens. The basic things to adjust include:

  • a user name for the device ("ps101" might be a good choice)
  • password
  • disable dhcp
  • static IP address, netmask, and gateway

Interestingly enough, once you have an IP connection to the device, you can also configure the PS101 through FTP. At the login prompt, the "user" name to enter is either the name printed on the device, such as PS654321, or the user name you assigned above.

Then you can use get CONFIGURE to download the plain-text configuration file. Some of the file looks like this, with changed items in bold:

0001 BOX_NAME:PS101
0012 TCPIP_P :Enable
0014 NETB_P:Enable
0040 P1_NAME:P1
0100 L1_PROUT:P1
0101 L1_PREST:
0102 L1_POSTR:
0103 L1_CHGLF:No
0501 LPT1MODE:Ack&Busy
4000 IP_ADDR:10.0.1.77
4001 GATEWAY:10.0.1.254
4002 MASK   :255.255.255.0
4010 TCP_INT:2
4011 TCP_CNT:254
4012 WINS_IP:0.0.0.0
4020 DHCP_MODE:Disable
5000 SMBGNAME:
5001 SMBDROP:No
5002 SMBDELAY:0

After the file is suitably edited, upload it back into the device with put CONFIGURE. The PS101 also offers a primitive executable interface through FTP. For example, the command get RESET resets the device, and the command get PASSRESET clears the password. (Yes, this is a very unconventional way to run commands. And you also end up with corresponding zero-byte files, such as RESET and PASSRESET, "downloaded" to your system!)

Once the PS101 is connected to the network, it is then a very simple matter to send it print jobs from any BSD/Linux host. That's because it "listens" on port 515, using the standard LPD print spooler protocol.

The key to communicating with the device, in printcap terms, is to use either "L1" or "P1" as the remote port name ("rp" capability), and the IP address as the remote machine name ("rm" capability).

To illustrate, using the enhanced lpr from the LPRng package, you can send jobs directly to the device from the command line with the following syntax:

$ lpr -PL1@10.0.1.77 myfile

This works okay, but only as long as "myfile" is in a format suitable for the target printer. And you don't get any features to manage a print queue on the PS101 this way, either.

That's why, in practice, it is preferable to set up a bona-fide print server on the network, with all the filtering and spooling features you want, as well as whatever Samba and AppleTalk is needed by client workstations.

So the rest of this note describes the basics of an LPRng set up. There are several alternatives to use in the way of input filters, including apsfilter and ifhp. Here we will simply describe our most current setup, based on the foomatic-rip filter and printer PPD files.

The requirements for this server include:

  • Perl > 5.6
  • ghostscript
  • a2ps
  • foomatic-filters
  • foomatic PPD file for target printer
  • netatalk and samba (optional)

Many of these come as "standard equipment" with common BSD/Linux distributions. The foomatic stuff is available from http://www.linuxprinting.org/. This site can also be used to generate a PPD file for your particular make and model of printer.

The foomatic-filters package should install two executables:

  • /usr/local/bin/foomatic-rip
  • /usr/local/bin/foomatic-gswrapper

These are Perl scripts, expecting Perl to be installed as /usr/bin/perl. Edit the scripts if Perl is located in another path.

The PPD file should be installed somewhere sensible and convenient, such as:

/usr/local/etc/foomatic/ppd/LaserSnot.ppd

Then create a suitable LPRng printcap file for /etc/printcap:

# /etc/printcap
# printcap for LPRng
#
## LaserSnot on PS101 device, foomatic filter on local queue:
lp|ps|lasersnot:\
	:lp=L1@10.0.1.77:\
	:lpr_bounce:\
	:if=/usr/local/bin/foomatic-rip:\
	:ppd=/usr/local/etc/foomatic/ppd/LaserSnot.ppd:\
	:lf=/var/log/lpd-errs:\
	:sd=/var/spool/lpd/lasersnot:\
	:sh:mx=0:mc=0

### that's all, folks!

Run the checkpc -f command as root to setup the spool. Then: happy printing!


Copyright © 2002 - 2005, Wayne Marshall. All rights reserved.
Last edit 2005.03.07, wcm.