I have a Solaris 10 system that is connected to one network card in a Solaris 7 system. A second network card in the Solaris 7 system connects to the LAN. The Solaris 10 system has no other network connectivity. Its web access is obtained through a SOCKS proxy server running on the Solaris 7 system. I needed to be able to print to an HP laserjet printer on the network, so I needed some way to proxy connections to the Line Printer Daemon (LPD) port, TCP port 515, on which the network printer is listening, through the Solaris 7 system. The balance load balancing and proxy program works well for such situations. In this case I didn't need to use the load balancing features of the program, just its proxying feature.
[ Solaris 10 ] <-----> [ Solaris 7 ] <-----> ( Network )
The network interface on the Solaris system that faces the Solaris 7 system has an IP address of 192.168.1.1. So on the Solaris system, I issued the following command:
# balance -b 192.168.1.1 -f 515 laserjet.moonpoint.com:515
I needed to run the command as root, since I was using a
well known port,
i.e. a port between 0 and 1023. To set up a process to use a well known
port requires root privilege, since those are commonly used by server processes.
The -b
option specifies the IP address on which the system
should listen for connections. In this case I want the Solaris 7 system
to only listen for connections on the network card facing the Solaris 10
system, i.e. on IP address 192.168.1.1. Otherwise, by default, it would listen
on all network interfaces in the system. Also, normally, balance will run in the
background, but in this case I chose to keep it in the foreground with
the -f
option; normally I would not use that option. I then
specify the local port on the Solaris 7 system on which it should listen
for incoming connections. In this case the port for printing is the LPD
port, TCP port 515 (balance only handles TCP ports). I then specify the
system and port to which balance should route the data. I can specify
a host, such as laserjet.moonpoint.com, or its IP address, such as 10.0.0.8,
followed by a colon and the port number to be used on the destination system,
which is the HP LaserJet printer with a network card in it.
Other options for balance are shown below.
bash-2.03$ balance
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
According to the developer, Balance successfully runs at least on Linux(386), Linux(Itanium), FreeBSD, BSD/OS, Solaris, Cygwin, Mac-OS X, HP-UX and many more. Since it runs under Cygwin, you should be able to get it to work on a Microsoft Windows system using Cygwin. It is free Open Source software released under the GPL license. It is available from http://www.inlab.de/balance.html or here.
On the Solaris 10 system, I'm using the Java Desktop System. I clicked on "Launch", "Preferences", "System Preferences", and then "Add/Remove Printer". I put in the root password when prompted, since I was logged in under a normal user account. When the Solaris Print Manager opened, I clicked on "OK" to use the default and only value of "files" for the "Naming Service". I then clicked on "Printer" and "New Network Printer". I gave the printer a name of "laserjet" and specified "192.168.1.1" for the "Printer Server" value and selected "TCP" for the "Protocol" value.
References:
- RFC 1179 - Line Printer Daemon Protocol
-
Print Server Port Numbers for Netcat
by Jeff Liebermann jeffl (@) comix.santa-cruz.ca.us
Version 1.04 05/17/00 - Setting up Sun Solaris 2.6, 7, and 8 to print to Canon Networked Printers using LPD
- Port Numbers