Request from ethernet address 08:00:09:54:18:02
The story The situation The printer Setup step by step Printing from Windows and OS/2 Feedback
Some time ago, I aquired a LaserJet series II printer with memory extension and JetDirect cards. The printer is rather old and slow compared to todays models, but it's a nice printer anyway, especially if you get one for nothing.
After replacing most of the network cabling in the office by 10BASE-T, I decided that it's now time to get rid of the old fashioned parallel port interface and hook the printer directly onto the net.
Since I had no documentation for the printer, and since it's rather difficult to get information online from Hewlett Packard because of the age of the printer, I had to solve several problems. This text describes the problems I faced and how I solved them.
The local network consists of several Linux boxes running RedHat 5.x, a NT and one OS/2 box. Because of the limited capabilities of the latter two, most Linux boxes act as server systems in one respect or the other. Because of the current setup and because neither NT nor OS/2 is capable to drive the printer (see below), one of the Linux boxes was choosen to act as a printer server for this printer. The printer is accessed from the other hosts as SMB or lpr remote printer.
Most things described below work for RedHat Linux. However, since I describe in detail how it works, it shouldn't be a problem to get a similar setup running for other distributions. The text assumes that you know what IP addresses, UDP packets and similar things are. If you don't know that, get a good book and come back later.
Please note: There is absolutely no warranty that the instructions will work and don't cause any harm. I'm not responsible for any damages or problems caused by the instructions below. Use your brain, Luke!
The JetDirect interface for the LJ series II is somewhat old fashioned, but simple (the most difficult thing was to determine, how it works). After warmup, the printer sends a bootp request to determine it's IP address. After that, a TCP connection to port 9100 must be established, all data sent via this connection is printed. There is no lpr style interface.
Several people asked me about the JetDirect card, so here is the HP part number as printed on a sticker on the inside: 27305-60401. When searching for this number on Google, I found several companies still offering these cards!
Menu
button for several
seconds. Browse through this menu until you get an entry I/O=
.
Using the +
and -
keys, change this to read
Optional I/O
. Press Enter
to make this the default,
then reboot the printer. (Note: While bootp is not running, the printer cannot
determine it's IP address and will show 43 Error
on startup).
bootps
in
/etc/inetd.conf
. You may add a -d 5
at the
end of the line to enable more verbose syslog messages.
/etc/bootptab
similar to the following:
The# # Sample bootptab file # # Settings for LJ series II printer. # BEWARE: The printer does not accept subnets in the netmask printer:\ ha=080009541802:\ ip=195.254.106.9:\ sm=255.255.255.0:\ vm=auto:
ha
entry is the hardware address of the printer. If you don't
have any information about the card, just remove it from the printer (two
screws - be sure to switch the printer off before doing this).
There's a label on the card telling the address (which is always a string
consisting of 12 hexadecimal digits).
ip
is the IP address you want to assign to your printer.
Note: If you don't have a name server entry for the printer, the
first line of the entry must start with a dot. In this case, change
printer
to .printer
or similar.
sm
is the subnet mask. Note: The printer does
not accept anything but the normal class A/B/C subnet masks.
If you already have an /etc/bootptab
file, add an entry similar
to the one above.
If your setup is ok, reboot the printer. You will find messages in the syslog
file from the bootp server, and the printer will boot into the
Ready
state. If you still get 43 Error
, something is
wrong with your setup. Check the messages in the syslog file and recheck your
/etc/bootptab
file.
You may use the arp
command to display the ARP table. It should
contain an entry showing your printers hardware and IP addresses. If the printer
displays Ready
, you may telnet to port 9100 of your printer and
type some text to print.
This paragraph is somewhat RedHat specific, but all distributions I know of work in a similiar way, so just use your brains.
The printer setup most similar to the one we need is an SMB printer (filter
the data, then pipe it into a network connection). So, use
printtool
as root to install a new SMB printer. You may enter
random data for the user and password settings since they aren't used.
After that, go into /usr/lib/rhs/rhs-printfilters
and copy
smbprint
to hpprint
. Edit the file, remove anything
but the last line (which pipes the data into a network share), and replace
this last line by
Replacenc -w 3 printer 9100
printer
by the name or IP address of your printer. If you
don't have netcat
installed, it's now time to do so, since it's a
great tool, and it is used in the line above. There is a solution using perl
in the Linux Printing-HOWTO, but it has more than 20 lines and cannot be used
without several changes.
There are of course more elegant solutions. You may add a .config
file so you don't have to hardcode the printer IP in the script. Feel free to
add any bells and whistles you feel are necessary.
We now have code to do the network connection. What we need is to tell the
printer spooler to use it. To do that, cd
into the spooler
directory for this printer (something like /var/spool/lpd/lp/
),
load the script named filter
into your favourite editor and
change the (one and only) call to smbprint
to
hpprint
.
That's it! Of course, it's not nice to hardcode things in scripts, change
system scripts and the more, but this is only a rough description and you are
free to find a more elegant solution. The best thing would be if RedHat could
support the printer setup from the printtool
program. The changes
needed are very small, but I was happy I got the printer running, so I was not
in the mood to do it myself.
To test your setup, print a test page from printtool
. Be sure not
to edit the entry, otherwise the program may decide to replace your filter and
you have to do the small change again.
Note: Starting from version 7.1, RedHat supports JetDirect natively
from printtool
. So all you need is the bootp setup as described
above, then select "JetDirect Printer" in printtool
and things
should work!
Just use Samba to export the printer as a network printer. Other (non Unix) systems may then easily access it via the network.
If you think there are important things missing from this article, feel free to contact me. Remember: If you don't share your information with others, it looses it's value (of course, this is the reason, why I did this web page). Other feedback is also appreciated! If you think, this page sucks, please tell me about it. I will then activate my killer androids to visit you at home:-)