Subject: Re: NetBSD and Printing - Samba/otherwise
To: Laine Stump <lainestump@rcn.com>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: netbsd-help
Date: 02/16/2000 12:14:08
On Tue, 15 Feb 2000, Laine Stump wrote:

>At 09:53 AM 2/15/00 +0200, Bruce Martin wrote:
>>We have an HP LaserJet on our network, and our BSD machines run Samba. What
>>is the easiest way of printing from NetBSD over the network to this printer?
>>Are there any FAQs/docs out there on printing under NetBSD?
>
>If you mean that the printer is connected directly to the ethernet, the
>problem to overcome is that it doesn't speak SMB or lpr (at least they
>didn't when I had to do this a couple years ago), and the software you can
>get for the printers only runs on Solaris or MS WinXX (and maybe a couple
>others, I forget).
>
>I ended up installing HP's network printer management software on a WinNT
>workstation, sharing the printer from there, then using Samba's smbclient
>as a printcap filter to get output from the NetBSD box out to the printer.
>Once you've done that on one machine, you can tell other Unix machines
>about the printer "on the NetBSD box", thus further convoluting things.
>
>Obviously if you can get something like what Christos mentioned, that would
>be a much cleaner solution.
>
>If you've got a Windows machine on your network and end up needing to do it
>the way I describe, I can send you my smbprint script (different from what
>comes with Samba) and an example printcap entry.


It's much simpler, and you don't need any of HP's network software
(although hpnpadmin is very useful if you have a Solaris/SPARC or HP-UX box
to run it on).

All you should need to do is put

	:lp=9100@<printer-host-or-IP-addr>:

in your printcap entry, and it should Just Work.

The card IP address can be configured with BOOTP (although I couldn't get
it to work with the NetBSD 1.3.2 bootp -- this is vaguely somewhere on my
TODO list, but nowhere near the top).  On printers with a front-panel
and LCD display, you can set addr, netmask, defaultrouter from the front
panel.  However, configuring with BOOTP allows you to make the printer
download a configuration file via TFTP.  This configuration file can
contain access control IP-addr/netmask pairs, SNMP stuff and override
the default 90 sec timeout for the TCP/IP connection (sometimes necessary
if you have a PostScript printer which can pause to digest a chunk while
receiving a file).  Finally, if you haven't configured the IP addr from
the front panel, and it doesn't get a BOOTP response within a reasonable
time, it goes to a default address (192.0.0.192 ??).  You can then telnet
to it and set a different address, but beware that once you do this it
won't use BOOTP again unless you reset it completely, and you can't have
an access control list in this mode.

Another catch:  if you use TFTP config files (:T144=hpnp/myprinter.cfg: in
the bootptab entry), and you don't run tftpd on the *same server* as provides
the BOOTP reply (or the specified file is unavailable), the ethernet card
will sulk.  You can see why the tftp failed by printing a test page.
(BTW, there used to be a wierd problem if the TFTP server was a multi-homed
SunOS 4 host and the TFTP responses came from an IP address on a different 
network - the JetDirect card ignored them).

The config file /tftpboot/hpnp/myprinter.cfg should look like this:

name: lj4si1
location: <printer location, for SNMP>
contact: <contact person, for SNMP>
allow:	<IP-addr> <netmask>
	.
	.	(can have up to 10? allow: records)
	.

idle-timeout: 1800
get-community-name: public
set-community-name: <my-community-name>
trap-community-name: public
trap-dest: <IP-addr>
authentication-trap: on
subnets-local: on


Oh yes, and if it's a PCL-only printer you will to set up a filter running
Ghostscript to do PS->PCL conversion.


Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------