Print Spooling using raw port 9100

Hello all,
I need to setup a print server that listens on three separate network interfaces, and sends jobs to the corresponding print queue. Example:

192.168.69.100 - printer1 -> Out to 139.177.69.100:9100
192.168.69.101 - printer2 -> Out to 139.177.69.101:9100
192.168.69.102 - printer2 -> Out to 139.177.69 102:9100

Is there a way to have the printing system listen on a specific interface for a queue?

Also can I have the queue listen on port 9100 and just spool the raw data to be sent on to the printer?

The system I'm going to use is a RHEL5 system, but I can make it anything if I so desire.

The issue deals with a client application that can't be touched and currently prints directly to an HP jetdirect server. We are moving some infrastructure and due to some security directives, I'm required to build this intermediate box to spool the data, rather than just routing these jobs through the firewalls. (I've already fought the logic on this and lost, so don't get me started again :-))

Any insight is appreciated.

Shawn

Found the solution to my problem, and thought I would post it in case I forget it and have to look it up again.. :slight_smile:

Since the customer application was setup to print to 4 individual printers, using 4 different IP addresses, I had the network folks re-map the NATting to point to aliases created on my print queue box. So I created the network aliases on my primary interface, giving me:

eth0 Link encap:Ethernet HWaddr 00:24:E8:67:E9:85
inet addr:172.19.2.56 Bcast:172.19.2.63 Mask:255.255.255.224
inet6 addr: fe80::224:e8ff:fe67:e985/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:68965 errors:0 dropped:0 overruns:0 frame:0
TX packets:77371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26198783 (24.9 MiB) TX bytes:35977262 (34.3 MiB)
Interrupt:169 Memory:f8000000-f8012100

eth0:1 Link encap:Ethernet HWaddr 00:24:E8:67:E9:85
inet addr:172.19.2.57 Bcast:172.19.2.63 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:169 Memory:f8000000-f8012100

eth0:2 Link encap:Ethernet HWaddr 00:24:E8:67:E9:85
inet addr:172.19.2.58 Bcast:172.19.2.63 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:169 Memory:f8000000-f8012100

eth0:3 Link encap:Ethernet HWaddr 00:24:E8:67:E9:85
inet addr:172.19.2.59 Bcast:172.19.2.63 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:169 Memory:f8000000-f8012100

Next was to create the print queues and point them to the HP printers to be serviced. I called them 'printer1' 'printer2' and so on.. (I cheated and did this with Webmin):
[root@ndh1-dmz-ptq ~]# lpstat -a
printer1 accepting requests since Sat 07 Nov 2009 12:30:10 PM EST
printer2 accepting requests since Sat 07 Nov 2009 12:30:14 PM EST
printer3 accepting requests since Sat 07 Nov 2009 12:30:18 PM EST
printer4 accepting requests since Sat 07 Nov 2009 12:30:22 PM EST
[root@ndh1-dmz-ptq ~]#

Verified the existence of the JetDirect service in /etc/services on port 9100:
jetdirect 9100/tcp laserjet hplj #

Installed xinetd on the RHEL 5 system and created a new file in /etc/xinetd.d/ for each print queue that I wanted to setup. Remember to change the name of the print queue and the IP address to be listened to using the BIND flag. This one is called /etc/xinetd.d/printer1:

# Allow applications using the AppSocket / JetDirect protocol
# to communicate with CUPS.
service jetdirect
{
socket_type = stream
protocol = tcp
wait = no
user = lp
server = /usr/bin/lp
server_args = -d printer1 -o raw
groups = yes
disable = no
bind = 172.19.2.56
}

Then I just created 3 more files (one for each printer), restarted xinetd:
service xinetd restart
And check netstat for listeners:
netstat -a|more:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 ndh1-dmz-ptq.:2208 *:* LISTEN
tcp 0 0 172.19.2.59:jetdirect *:* LISTEN
tcp 0 0 172.19.2.58:jetdirect *:* LISTEN
tcp 0 0 172.19.2.57:jetdirect *:* LISTEN
tcp 0 0 172.19.2.56:jetdirect *:* LISTEN
tcp 0 0 :sunrpc *: LISTEN
tcp 0 0 :ndmp *: LISTEN

After this we just had to ensure all firewall rules allowed port 9100 traffic to flow in and out, and we were up and printing.

Shawn

Don't you love people who took the time to post their solutions to their problem even though nobody here helped?

Excellent solution. Thank you for posting it.