How to use Netcat with the Netgear PS104 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.

Netgear PS104/105/110 docs

  • PS104 Reference Manual
  • PS104 Installation Docs
  • PS104 Release Notes

  •  

     

    Netcat Source and binaries

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



  • Setup the PS104 Print Server using Unix
    Setup the IP address with ARP (Address Resolution Protocol)
    arp -s 192.168.111.84 00:C0:02:30:20:23
    The default user name is on the bottom of the print server.  The default password is just a carriage return.

    Download the config file with ftp (File Transfer Protocol)

    # ftp 192.168.111.84
    Connected to 192.168.111.84.
    220 Print Server Ready.
    User (192.168.111.84:(none)): PS302023
    331 Password required for user.
    Password:
    230 User logged in.
    ftp> get config
    200 Command OK.
    150 Open BINARY Mode Connection.
    226 Transfer complete.
    ftp: 873 bytes received in 0.93Seconds 0.94Kbytes/sec.
    ftp> quit
    221 Goodbye.


    Edit the config file to look something like the following TCP/IP section.

    4000 IP_ADDR:192.168.111.84
    4001 GATEWAY:0.0.0.0
    4002 MASK   :255.255.0.0
    4010 TCP_INT:2
    4011 TCP_CNT:254
    4012 WINS_IP:0.0.0.0
    4020 DHCP_MODE:Disable


    Upload the config file back to the PS104 with

    # ftp 192.168.111.84
    Connected to 192.168.111.84.
    220 Print Server Ready.
    User (192.168.111.84:(none)): PS302023
    331 Password required for user.
    Password:
    230 User logged in.
    ftp> put config
    200 Command OK.
    150 Open BINARY Mode Connection.
    226 Transfer complete.
    ftp: 873 bytes sent in 0.00Seconds 873000.00Kbytes/sec.
    ftp> quit
    221 Goodbye.
    For additional detail, see the technical manual under "Printing using DSI".  Setting the IP address can also be done with the Windoze "FirstGear" software, but that's no fun.


    Add entry to /etc/hosts file
    Add an entry to /etc/hosts that looks like this:
    192.168.111.84   hp3
    The hp3 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
    ogre:hp3:4010
    The various Netgear print servers uses ports
    4010    First parallel port
    4020    2nd parallel port
    4030    Serial port
    The PS104 uses only port 4010 as it only has one parallel port.


    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:  ogre
    Description:  Netgear PS104
    Model:  netcatHp
    Device:  /dev/null
    Note that "ogre" is the printer name and "netcatHP" is the name of the spooler script.  Run:
    /usr/lib/accept ogre
    enable ogre


    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 hp3 -p 4010
    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.


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


    Drivel:
    1.01  03/12/00  Original inscription.
    1.02  03/21/00  Tweaks and edits.  Edited PATH on spooler script.
    1.03  04/19/00  fixed path, rename binary
    1.04  05/17/00  Renamed spooler scripts.