MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
December
Sun Mon Tue Wed Thu Fri Sat
         
8
           
2006
Months
Dec


Fri, Dec 08, 2006 9:40 pm

Forwarding Print Jobs

I have a PC running Solaris 5.10 connected to one network interface on a Sun Ultra 5 system running Solaris 2.7. The Ultra 5 workstation has another network interface that faces the world. The PC connects only to the Ultra 5 and has no other network access. It has web acces through proxy server software running on the Ultra 5. I also needed to be able to print from the PC to printers on the other side of the Ultra 5. To obtain that access, I used balance

Balance is a load balancing solution, which uses a simple but powerful generic TCP proxy with round robin load balancing and failover mechanisms. Its behaviour can be controlled at runtime using a simple command line syntax, which is listed below.


balance 3.19
Copyright (c) 2000-2003,2004 by Inlab Software GmbH, Gruenwald, Germany.
All rights reserved.

usage:
  balance [-b host] [-t sec] [-T sec] [-dfp] \
          port [h1[:p1[:maxc1]] [!] [ ... hN[:pN[:maxcN]]]]
  balance [-b host] -i [-d] port
  balance [-b host] -c cmd  [-d] port

  -b host   bind to specific host address on listen
  -B host   bind to specific host address for outgoing connections
  -c cmd    execute specified interactive command
  -d        debugging on
  -f        stay in foregound
  -i        interactive control
  -H        failover even if Hash Type is used
  -p        packetdump
  -t sec    specify connect timeout in seconds (default=5)
  -T sec    timeout (seconds) for select (0 => never) (default=0)
   !        separates channelgroups (declaring previous to be Round Robin)
   %        as !, but declaring previous group to be a Hash Type

example:
  balance smtp mailhost1:smtp mailhost2:25 mailhost3
  balance -i smtp

Balance is Open Source Software (OSS) and is provided under the Gnu Public License (GPL). It runs on Linux, FreeBSD, BSD/OS, Solaris, Windows using Cygwin, Mac-OS X, HP-UX, and other operating systems.

To use balance to forward print jobs from the PC through the Ultra 5 workstation to printers on the other side of the Ultra 5 workstation, I installed balance on the Ultra 5 system and then issued the following command:


# balance -b 192.168.1.1 515 bermuda.somewhere.org:515

I specified the -b option, since I did not want balance listening on both of the Ultra 5 network interfaces, only the one that faces the PC. The address for the network card to which the PC connects is 192.168.1.1. The 515 after that address specifies that balance should listen on TCP port 515 on that interface. I then want balance to forward any data it receives on port 515 on the 192.168.1.1 interface to a printer with a network name of bermuda.somewhere.org. The :515 at the end of the printer's network name indicates that balance should forward data to port 515 on the printer. TCP port 515 is the port for the Line Printer Daemon (LPD) protocol. It is a standard port on which network printers listen for print jobs. If you wish balance to listen on ports less than 1024, which are the "well known" ports, then you must issue the command to run balance from the root account.

I then needed to tell the PC that there is a printer available at the 192.168.1.1 address, though in actuality, the workstation at that address will simply forward any data it receives on port 515 to the bermuda printer.

First, I checked to see what printers the PC already thought were available through the lptstat command.


# lpstat -a
laserjet accepting requests since Dec 05 19:23 2006

The system already is set up to print to laserjet, but unfortunately that printer is no longer accessible, which is why I need to use balance and the bermuda printer.

I then used the lpadmin command on the PC running Solaris 10 PC to add the new printer.


# lpadmin -p bermuda -s 192.168.1.1

The first lpadmin command has a -p argument, which specifies the printer name I want to use on the PC for the printer. I am going to use the name bermuda to make it match the name on the network name of that printer, but it wouldn't have to match. The next argument is specified with -s. The -s option is followed by a system name, e.g. ultra5.somewhere.org, or IP address. I used the latter and specified the IP address on the Ultra 5 workstation to which the PC is connected. The -s option is used to make a printer available on another system available to the local system.


     -s system-name[!printer-name]

         Make a remote printer (one that must be accessed through
         another  system)  accessible  to  users  on your system.
         system-name is the name of the remote  system  on  which
         the  remote  printer  is located it. printer-name is the
         name used on the remote system  for  that  printer.  For
         example,  if  you want to access printer1 on system1 and
         you want it called printer2 on your system:

         -p printer2 -s system1!printer1

Once I added the printer, I wanted to make it the default printer, which I can do with the -d option for lpadmin.


# lpadmin -d bermuda

If you want to check which printer is the default printer, you can use the command lpstat -d.


# lpstat -d
system default destination: bermuda

Now, if I check printer status with lpstat -a, I see both the old and new printers listed.


# lpstat -a
laserjet accepting requests since Dec 08 19:32 2006
bermuda accepting requests since Dec 08 19:32 2006
_default accepting requests since Dec 08 19:32 2006

If I want more details, I can use lpstat -s.


# lpstat -s
scheduler is not running
system default destination: bermuda
system for laserjet: 192.168.1.1
system for bermuda: 192.168.1.1
system for _default: 192.168.1.1 (as printer bermuda)

To get rid of the entry for the no longer accessible laserjet printer, I used the lpadmin -x command.


# lpadmin -x laserjet
# lpstat -a
bermuda accepting requests since Dec 08 19:57 2006
_default accepting requests since Dec 08 19:57 2006

Solaris stores the information about printers in /etc/printers.conf, so the lpadmin commands are modifying that file.

After adding the printer, if I then want to make it visible to a user account that is using the Java Desktop System for the user interface, I need to take the following steps:

  1. Click on Launch.
  2. Select Preferences.
  3. Select Printer Preferences.
  4. Click on View.
  5. Click on Select Printers to Show.
  6. Bermuda is now in the list of available printers, so click on it to select it and then click on OK.
  7. Right-click on it and select Set as Default.
  8. Close the Printer Manager window.

Now when printing from the Solaris 10 PC, I can print to the bermuda printer from the user account under which I made the above changes by selecting it as the printer in applications.

References:

  1. balance
    Author: Thomas Obermair
    freshmeat.net
  2. Balance
    Inlab Software GmbH
  3. Line Printer Daemon protocol
    Wikipedia
  4. Print Server Port Numbers for Netcat
    By Jeff Liebermann
    May 17, 2000
  5. How to Add a Network Printer Locally on a UNIX Solaris SPARC Workstation
    Citrix
    January 13, 2003
  6. Proxying the LPD Port with Balance
    MoonPoint Support
    March 3, 2006
  7. Balance
    MoonPoint Support

[/os/unix/solaris] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo