Is possible to configure a Linux computer to work as a "network printer device" ? I have an USB printer that I intend to share in the network like a native network printer device.

Is that possible? How?

NOTES: 'Autonomous' network printers usually communicate with the protocol "HP Jetdirect" (Also known as "Raw").

I have a RS/6000 with AIX 5 that finds and works with any kind of 'autonomous' network printer. And I would like to expose through Linux (preferably Debian) an USB printer in the network, like any ordinary network printer (autonomous device) which I could access in AIX.

EDIT: I need to do in AIX something like that, where 'my_printer_ip' is the Linux IP:

$ netcat my_printer_ip 9100
$ Hello remote USB printer plugged in a Linux !
$ <Ctrl+D>

I understand that network printers use a protocol called RAW (or Jetdirect), is that correct?

Yes. There are two network protocols for print jobs that are still relevant today: LPD, running on TCP port 515, and JetDirect, running on TCP port 9100. LPD was designed by Berkeley for BSD UNIX in the old days. It's pretty much obsolete now, but it's still available on many printers, presumably for compatibility with old servers. JetDirect was designed by HP in the early 1990's, and it's simpler and somewhat faster than LPD. You should probably use JetDirect whenever available.

I have a RS/6000 with AIX 5 that finds and works with any kind of 'native' network printer. And I would like to expose in the network a USB printer like a network printer (autonomous device), using Linux (preferably Debian) to do that.

Install CUPS on a Linux machine, and connect the printer to it. You don't even need a full machine for that, a Raspberry Pi or similar, or a home router with an USB port and running OpenWRT or DD-WRT, would work just fine.

  • And how to have a port 9100 in that Linux "redirecting" print jobs (or stream) do the local USB printer ? – Luciano May 13 '15 at 15:32
  • That's what CUPS is supposed to do, provided that you configure it correctly. – lcd047 May 13 '15 at 15:34
  • Sharing a local-USB printer through JetDirect with CUPS seems to be very obscure. I found a suggestion to just configure a network streaming using inetd (xinetd): "9100 stream tcp nowait lp /usr/bin/lp lp -d <cups_printer_name> -o raw" – Luciano May 13 '15 at 18:52
  • @Luciano: Perhaps try the docs rather than looking for cheat sheets? – lcd047 May 13 '15 at 19:28

CUPS allows you to share printer with (at least) IPP, LPD and samba protocols out of the box. IPP is supported by most operation systems and IBM was part of the Printing Working Group which came up with IPP so it's likely supported in AIX as well.

Also, samba has AIX protocol so one or the other should work. search for AIX

But none of the documents I came across referenced AIX version so I can't be sure if AIX 5 is supported or not.

The way it works anyhow is that you plug the printer to server with CUPS installed and select the method of sharing, broadcast settings etc. It's straightforward. Then clients can connect to it and it'll show up as network printer.

  • I am an experienced programmer and engineer, but printing protocols are a new subject for me. All that I found relates the term Raw to printers that works as an autonomous network devices. Is IPP anything related to the term or protocol Raw ? I would like to have a USB printer acting as an autonomous network printer (could it be made plugging it "behind" a Linux ?) – Luciano May 13 '15 at 13:57
  • 1
    @Luciano I'm not expert (or even very experienced) in printer protocols either. I'm just using CUPS to serve few clients. But what I could find out is that RAW or telnet protocol is older protocol as is LPD/LPR (there was a typo in my original post, sorry). Here's short overview of the differences: In any case, it's possible to set up CUPS to serve in RAW/JetDirect as well (documentation may be scarce tho) so it should work. – WhimsicalWombat May 13 '15 at 15:04
  • Nice overview, very helpful – Luciano May 13 '15 at 18:40

After some researches and tries...

These "network printers devices", could implement some protocols, being one of them the one called "HP JetDirect", also known as "Raw", "JetDirect", either just "9100". It seems to be the most common protocol supported by network printers.

A network printer configuration sample: A network printer configuration sample

The JetDirect protocol is just an ordinary network stream, and not a real protocol, at least in my tests. So, you don't need CUPS neither any kind of printer engine to have a Linux behaving like a network printer, all you need is a 'network stream server' like inetd (or xinetd), to listen to the port 9100 and redirect this stream to the printer stream.

Consider a printer stream in the port /dev/lp0, where we could do something like that:

$ echo "Hi local legacy printer !" >/dev/lp0

Now we could redirect the stream coming in the port 9100 to the /dev/lp0, just using the old school inetd:

9100 stream tcp nowait cat > /dev/lp0

So, in any other remote system (like AIX), we could get the legacy parallel (or USB) printer plugged in a Linux to work like a network printer:

$ netcat linux_ip 9100
$ Hello remote Parallel printer plugged in a Linux !
$ <Ctrl+D>

Of course, there are concurrency issues which beyond others solutions could be handled by CUPS configuring the local printer under a spooler.

It worked for me !

  • 1
    That looks like the correct answer: use inetd and 9100 stream tcp nowait cat > /dev/lp0. No CUPS needed. – josef Mar 2 '17 at 18:01

You'll probably want to install CUPS; according to this page it's definitely available for AIX as well.

Once you've configured it to recognize and use your printer, you probably want to check here for instructions on how to share it across the network.

Alternately, you can use samba to share the printer; nowadays most OSes speak the protocol.

  • But, what about not installing CUPS in AIX knowing that it already works with network printers ? Does have a way to make a Linux acts as a generic "pass through" network printer device using CUPS or anything other way ? – Luciano May 13 '15 at 13:43
  • @Luciano: You don't need CUPS on AIX, you just need it on the Linux machine. But you do need to configure CUPS to use a protocol the print server on the AIX machine can speak. – lcd047 May 13 '15 at 15:36

This very old program exports a local printer on /dev/lp to localhost:9100. I had to edit the Makefile to support older programming standards. There could be other ways to do this with newer programs. I would like to know: lp_server-1.1.6 source code

  • how does this answer the question? – Pierre.Vriens Oct 30 '18 at 16:28

OP- And I would like to expose through Linux (preferably Debian) an USB printer in the network, like any ordinary network printer

Here is the help from lp_server:

lp_server [-n port] [-w] [-d device] [-t stty_cmds]
Version lp_server-1.1.6
Export a printer by simulating an HP JetDirect interface.
-n connection port (default 9100)
-w open output device write only (default r/w)
-d device (default /dev/lp)
-t stty_cmds - stty commands to apply if device is serial port
-r remote_list - remote hosts allowed, in IP/netmask or hostname
       separated by commas. i.e. -,dickory would
       allow connections from subnet (24 bit netmask)
       and host dickory
-D level - set debug level


The lp_server will bind to the connection port, and wait for
an incoming connection.  After accepting a  connection, it 
opens the output device, (rw or write only as specified),
applys the stty options,  and then copies the connection output
to the device input and vice versa.

The USB printer would appear as a character device /dev file on the linux server and then get exported to the network IP address port 9100 by lp_server where the AIX computer can find the simulated Jet Direct print service. This should be very similar to the minimalist inetd answer and just provide another choice.

  • 1
    Hello and welcome to the U&L stack exchange site! Please review the Help Center to get information on how to best post to this site. To get to your post, could you please edit your post to contain additional context as to why you believe this to be an answer. Thank you! – kemotep Nov 2 '18 at 15:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.