Use Networked Printers and Scanners with HPLIP

Enterprise Networking Planet content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

In which we learn how to plug printers directly into and share scanners over the network.

HP vs. Samsung Smackdown

Not too long ago I treated myself to a HP 3050 multi-function laser printer with fax, scanner, and copier. I almost went with Samsung because it makes good machines, and all of its monochrome printers have Linux drivers. But they are closed, proprietary binary drivers which are bad enough on their own: big fat pains to install and upgrade. And then the news broke about the ingenious security holes and inexplicable permissions changes on key directories introduced by the amusingly awful installer for the Samsung drivers, and that was all she wrote. HP, on the other hand, supports good-quality, well-supported genuine FOSS drivers, HPLIP, which we introduced ourselves to last week.

A number of Samsung printers are supported by CUPS, but a lot of them aren’t, and I want to send my hard-earned money to vendors who are serious about supporting Linux users. A common problem with multi-function printers is that some parts work in Linux, and some parts don’t. Or you have to pull all the pieces together yourself, instead of having a nice unified management console like hp-toolbox. Game, set, and match to HP.

Networked Printers

The 3050 does not include an Ethernet interface (which is not a showstopper; it just means it has to be connected to a PC and shared over the network via CUPS) but many HP printers and all-in-one machines do. This is an excellent option for network printing, and is nice to administer on mixed networks. The printer gets its own IP address, and the HP toolbox will find all of your networked printers so you can manage them from your underground network administrator’s lair.

Make the manual for your particular HP printer your first stop because it tells you everything. Mine is a 430-page PDF that covers models 3050, 3052, 3055, 3090, and 3092.

As is so often the case, there are a few speedbumps to getting all this network guff working. You need snmp and avahi-daemon running on your Master Linux Netadmin Workstation, and you need avahi-daemon on any Linux PC that you want to enable auto-discovery of networked printers on. These days most Linux distributions install and run avahi-daemon by default to enable Zeroconf services, even though there isn’t much of anything for it to Zeroconf. (See Make Sense of SNMP/MRTG Alphabet Soup to learn how to enable snmp on your Linux hosts, and Run Zeroconf for Linux in a Snap for an introduction to enabling, testing, and using avahi-daemon.)

Mac OS X has the nicest Zeroconf setup and should “just work.” Windows has its own weirdo auto-discovery protocol, and of course each iteration of Windows behaves a little differently, if it supports it at all. See your excellent printer manual for details.

You can configure everything on the printer’s own control panel, but why do it the hard way when there are easier ways? Then you can manage your printer in several ways: from CUPS, from the printer’s own embedded Web server (EWS), and from the hp-toolbox.

When you connect your printer to the network for the first time, the easy way is to already have a DHCP server running and the printer will get an IP address from that. It will look first for a DHCP or BOOTP server, and if you don’t have either of those it will auto-generate its own link-local address, which comes from the 169.254/16 address range, which is the link-local (or Zeroconf) range. This has some advantages if your clients are all properly Zeroconfed. You don’t need a DHCP server and address collisions are handled automatically.

You can give your printer a static IP address in the usual way via through DHCP, or use one of the HP control panels to configure it manually. If you use the printer control panel your address assignment won’t survive a power cycle, so make sure you use hp-toolbox or EWS.

Sharing Scanners Over the Network

Sharing a scanner over the network has limited value, because most folks don’t find it convenient to gallop great distances back and forth between their computers and scanners. But it’s not so bad sharing a scanner between a few computers that are in reasonable proximity to each other, and then the person using the PC that the scanner is attached to gets pestered only a little instead of a lot.

The first step is making sure your scanner works for ordinary users and doesn’t require root privileges. Linux’s new best friend udev has turned device permissions into a New Fun Headache, so hopefully your distribution ships with a nice udev configuration that neither vexes nor annoys, but does the work for you. As, presumably, it is designed to do. On Ubuntu all you do is add local users to the scanner group. On other distributions who knows; see Manage Linux Hardware with udev for some pointers on making udev bow to your will.

Now you need to make sure that saned, the Linux scanner daemon, is installed on the PC that the scanner is connected to, which we’ll call the server. On Debian this comes in the sane-utils package, and on Fedora it’s in sane-frontends. Then you control it from either inetd or xinetd. inetd users need a line like this in /etc/inetd.conf:

sane-port stream tcp nowait saned.saned /usr/sbin/saned saned

This assumes that your saned user and group are both saned. If they’re something else, change the saned.saned bit.

In /etc/xinetd.conf, use these lines:

service sane-port
port = 6566
socket_type = stream
wait = no
user = saned
group = saned
server = /usr/sbin/saned

Again, adjust your user and group if necessary.

Now you need a couple of saned tweaks on both the clients and the server. On the server edit /etc/sane.d/saned.conf to include IP addresses, an address range, or hostnames of allowed PCs like this:

# local hostnames

# or just give a subnet range

Then on client machines edit /etc/sane.d/net.conf to include the hostname or address of the scanner:


On the server, restart (x)inetd:

# /etc/init.d/xinetd restart

Figure 1. Kooka Finds a Networked Scanner

Now fire up your favorite scanner software on the client. Kooka will show a window like Figure 1.

Hurrah! Success! Now you can scan in comfort from your own computer. Xsane has a Windows version, so that’s a good option for Windows clients. Configure the client file the same way as on Linux, except the slashes tip the wrong way, so you’re editing C:saneetcsaned.dnet.conf.

What about directly-connected network scanners, like the HP 3052? Use either Zeroconf, or configure your clients just like for scanners attached to Linux PCs. Check out your EWS or HP Toolbox for configuration and access controls.


Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends, and analysis.

Latest Articles

Follow Us On Social Media

Explore More