How to use Netcat with the Axis 540 Print Server and SCO Unix

by Jeff Liebermann   jeffl@comix.santa-cruz.ca.us


Netcat is a program that will output (print) to any arbitrary IP port.  This is especially handy for avoiding problems with SCO lpr and HPNP.  The idea is to use the stock SCO print spooler, and to use netcat to output to the print server.  My thanks to Kevin Smith for inscribing the netcat program and utilities.

Axis 540 Technical Docs and RTFM

  • 540 Specifications and data
  • 540 Print Server manual
  • 540 Install instructions
  • 540 Users Printing Guide

  •  

     

    Netcat Source and binaries

  • http://www.cruzio.com/~jeffl/sco/lp/



  • Setup the Axis 540 Print Server using Unix
    Setup the IP address with ARP (Address Resolution Protocol)
    arp -s 192.168.111.83 00:40:8C:3C:4A:8D


    Download the config file
    ftp 192.168.111.83
    Connected to 192.168.111.83.
    220 AXIS 540/542 FTP Printer Server V5.48 Dec 14 1998 ready.
    User (192.168.111.83:(none)): root
    331 User name ok, need password
    Password:
    230 User logged in
    ftp> dir
    200 PORT command successful.
    150 Opening data connection for dir (192,168,111,9,4,165), (mode ascii).
    -r--r--r--   1 axis      public      66  Jan 21 09:17 account
    -r--r--r--   1 axis      public     510  Oct  9 11:01 status
    -rw-r--r--   1 root      root      5664  Oct  9 18:20 config
    -r--r--r--   1 axis      public    5615  Apr 20 09:51 defaults
    -r--r--r--   1 axis      public    1086  Apr 30 11:01 help
    --w--w--w-   1 axis      public       0  Oct 18 08:22 prx (x = 1..8)
    dr-xr-xr-x   2 axis      public     512  Sep  2 11:38 aix
    dr-xr-xr-x   2 axis      public     512  Sep  2 11:38 bsd
    dr-xr-xr-x   2 axis      public     512  Sep  2 11:38 npipe
    dr-xr-xr-x   2 axis      public     512  Sep  2 11:38 sysv
    226 Transfer complete.
    ftp: 620 bytes received in 0.05Seconds 12.40Kbytes/sec.
    ftp> binary
    200 TYPE set to I.
    ftp> get config
    200 PORT command successful.
    150 Opening data connection for config (192,168,111,9,4,166), (mode binary).
    226 Transfer complete.
    ftp: 5664 bytes received in 0.16Seconds 35.40Kbytes/sec.
    ftp> quit
    221 Goodbye.


    Edit the config file to look something like the following
    --- TCP/IP Menu
    TCP_ENB.     : YES
    INT_ADDR.    : 192 168 111 83
    DEF_ROUT.    : 0 0 0 0
    NET_MASK.    : 0 0 0 0
    PROS_PWD.    : netprinter
    PROS_PRT.    : 35
    LPD_BANN.    : OFF  (OFF, AUTO, LAST)
    BOOTP_ENB.   : NO
    RARP_ENB.    : NO
    RTN_OPT.     : NO
    RTEL_PR1.    : 9101  [Port Number for PR1]
    RTEL_PR2.    : 0
    RTEL_PR3.    : 0
    RTEL_PR4.    : 0
    RTEL_PR5.    : 9102  [Port Number for PR5 with cr-lf translate]
    RTEL_PR6.    : 0
    RTEL_PR7.    : 0
    RTEL_PR8.    : 0


    Upload the edited config file
    ftp 192.168.111.83
    Connected to 192.168.111.83.
    220 AXIS 540/542 FTP Printer Server V5.48 Dec 14 1998 ready.
    User (192.168.100.83:(none)): root
    331 User name ok, need password
    Password:
    230 User logged in
    ftp> binary
    200 TYPE set to I.
    ftp> put config
    200 PORT command successful.
    150 Opening data connection for config (192,168,111,9,4,168), (mode binary).
    226 Transfer complete.
    ftp: 5664 bytes sent in 0.00Seconds 5664000.00Kbytes/sec.
    ftp> quit
    221 Goodbye.


    Doing it with Windoze
    You can also do the setup using the Axis Windoze Netpilot setup software.  The key screen shots are:
    TCP/IP setup
    Reverse Telnet setup


    Add entry to /etc/hosts file
    Add an entry to /etc/hosts that looks like this:
    192.168.111.83   hp4m
    The hp4m is now the hostname of the printer (not the printer name).


    Create a file called /etc/printers
    Add an entry to /etc/printers that looks like this:
    #printer_name:printer_hostname:port_number
    fudge1:hp4m:9101
    fudge2:hp4m:9102
    The port numbers for the Axis 540 are user configurable on the reverse telnet page or in the config file.  There are 8ea virtual printers available with one each port number for each virtual printer.  By default pr1-pr4 are non-cr-lf translating, and pr5-pr8 have built in cf-lf translation.  For this setup, the configuration is:
    9101    parallel port w/o cr-lf translation on virtual printer pr1
    9102    parallel port with cr-lf translation on virtual printer pr5


    Setting up the Unix print spooler
    Download the print spooler file netcat.  This version includes a cr-lf translation and a reset for HP LaserJet printers.  Some tweaking will probably be required to work with other printers.  Save the file as:
    /usr/spool/lp/model/netcatHP
    and run:
    cd /usr/spool/lp/model
    chmod 550 netcatHP
    chown bin netcatHP
    chgrp lp netcatHP
    Run:
    scoadmin printer
    Add a local printer.  The setup should look something like:
    Name:  fudge1
    Description:  Axis 540 p1
    Model:  netcatHp
    Device:  /dev/null
    Note that "fudge1" is the printer name and "netcatHP" is the name of the spooler script.  Run:
    /usr/lib/accept fudge1
    enable fudge1


    The netcat binary
    Download either the ELF (OSR5) version of netcat or the COFF (3.2v4.x) version and save the netcat binary where you hide executeables.  Most common are /usr/local/bin and /u/bin.  I suggest you NOT install it in /bin, /usr/bin, or /etc.  The spooler script includes a PATH statement to most of the common directories.  This may require modification if you decide to install it elsewhere.   These directories must all be on your shell environment $PATH to use netcat from the command line.  If not, just use the absolute path on the command line.

     After downloading, run:

    mv netcat.elf netcat
    chown lp netcat
    chgrp lp netcat
    chmod 755 netcat


    Testing from the command line
    Run:
    lpstat -t | /usr/lib/lponlcr | netcat -h fudge1 -p 9101
    lpstat -t | netcat -h fudge2 -p 9102
    This will print the print spooler status to the print server.  If this doesn't work, don't bother trying the print spooler.  The lponlcr adds a carriage return for every linefeed.  The lponlcr is not needed for virtual printer p5.  Other translations are available.


    Testing with the print spooler
    Run:
    lpstat -t | lp -d fudge1


    Fun with SNMP
    Try this from the OSR5 command line:
    getmany 192.168.111.83 public iso
    snmpstat -s 192.168.111.83


    Drivel:
    1.01  03/20/00  Original inscription.
    1.02  04/19/00  rename binary, fixed path.
    1.04  05/17/00  Renamed netcat spooler script.  Fixed hp3a -> hp4m typo.