Running a Network Printer: The Why and the How
A network print server gives every device a single, consistent way to print without relying on manufacturer apps. In this guide, I'll show how I use CUPS with both HP and Epson printers, while keeping the physical printers themselves out of sight.
Why
Most printer manufacturers try to push their proprietary software very hard.
Whether that's a good thing or not is open for debate, but there is little doubt that many of these applications leave a lot to be desired.
On top of that, there is the issue of privacy. These apps often require broad network permissions, and in some cases the documents you print may pass through the manufacturer's cloud services.
There is also the issue of convenience. Once you need to use your printer from more than one device, you need to install and configure the manufacturer's software on every client.
And if all of this wasn't bad enough, as your printer ages, the manufacturer may eventually decide that your model is no longer supported. When that happens, software updates stop, compatibility issues appear, and features that once worked perfectly can suddenly become unreliable or disappear entirely.
Overnight, a perfectly functional device can become expensive e-waste.
When done well, a network print server can solve all of these problems.
You get convenience, privacy, and longevity without sacrificing usability.
Addressing the elephant in the room
Before getting to the how, we need to address the elephant in the room.
Although I've recently switched to an Epson printer (more on the reasons for that below), I'll still cover the HP setup in this article. I used an HP printer for many years, and getting everything working the way I wanted wasn't always straightforward. Finding useful information wasn't always easy either, so I think it's worth keeping these instructions around for anyone trying to do the same thing.
HP has earned a notoriously poor reputation among technology enthusiasts for a number of anti-consumer practices. In some parts of the world, the company heavily promotes subscription-based services and cloud-centric features that primarily benefit HP rather than the end user.
Fortunately, where I live, consumer protection laws prevent some of the more aggressive practices that users in other regions have reported. As a result, those issues were not part of my own experience.
From a hardware perspective, however, I've found HP's printers to be quite good. Once I worked through some initial setup challenges, my printer proved to be reliable and stable.
That said, I don't want to gloss over the criticism. Consumers should be free to use the hardware they purchased without artificial restrictions, vendor lock-in, or pressure to adopt services they neither need nor want.
Then there's the cost of ink cartridges, which honestly are almost an extortion.
My HP printer was working just fine, and I had no real reason to replace it from a hardware perspective. But once I realised that I'd spent the price of the printer several times over on replacement cartridges, it became a question of finding a good enough alternative to make me switch.
Eventually, I found a good deal on an Epson EcoTank ET-2956 and decided to make the switch.
Epson seems to have a much better reputation in this regard, and with its refillable ink tanks, the running cost should be significantly lower than with traditional cartridges.
How
Ideally, this article would consist of a simple compose.yml file and we'd be done.
Unfortunately, that doesn't align with the architecture we're trying to build. The goal is to disable as many network services on the printer as possible and have a single, consistent entry point for all users.
In practice, people tend to select whichever printer appears on their device. If both the physical printer and the print server are available on the network, sooner or later someone will use the wrong one. By ensuring that only the print server is visible, we avoid confusion and guarantee that everyone uses the same configuration.
The idea is simple: the print server talks to the printer, and every other device talks to the print server.
From the user's perspective, the printer effectively becomes a network service rather than a physical device.
How you establish a connection between CUPS and the printer depends on the printer itself.
For my HP printer, I disabled services such as IPP and Bonjour on the printer itself, leaving only the service required by HPLIP enabled.
HPLIP is supposed to provide better hardware-specific support than generic printer drivers and give access to features that may otherwise be unavailable.
If you're going to use an HP printer, or any other printer that requires a manufacturer-specific driver, I don't think running CUPS in a Docker container is the best fit for this particular use case. While it's certainly possible, installing and maintaining additional driver packages such as HPLIP can make the setup more complicated than necessary.
For that reason, I chose to run my print server inside an LXC container. The same approach would work equally well on a Raspberry Pi, a virtual machine, or a dedicated Linux host.
For my Epson printer, I disabled all services except IPP. In theory, other devices could still use IPP to connect directly to the printer, but with Bonjour and WSD disabled, the printer is no longer advertised through those discovery mechanisms, making this much less likely.
You could argue that this is a disadvantage compared with the HP setup. HPLIP provides manufacturer-specific support, while with the Epson we're relying on a standardized IPP interface instead.
Personally, though, I think that's actually the better approach in the long run. CUPS itself is moving away from traditional printer-specific drivers, and I'd much rather see manufacturers properly support standards such as IPP than require their own software stack.
The less we depend on manufacturer-specific software, the better the chances are that the printer will simply keep working in the future. Considering that longevity was one of the reasons for setting up CUPS in the first place, that seems like a pretty good trade-off to me.
Installing CUPS
The first thing we're going to do is install CUPS.
sudo apt-get install cups
Next, we'll modify the default configuration.
The configuration is located at /etc/cups/cupsd.conf.
To make the web interface accessible remotely and available on a standard port, add or modify the following settings:
#tells CUPS to listen on port 80
Port 80
<Location />
# Allow remote access...
Order allow,deny
Allow all
</Location>
The main advantage of using port 80 is convenience. By default, CUPS listens on port 631, so instead of remembering and specifying that port every time, you can simply enter the address of your print server in a browser and immediately access the CUPS web interface.
There are several ways to configure access to the administration interface.
Require authentication using a local user account:
<Location /admin>
AuthType Default
Require user @SYSTEM
Allow all
Order allow,deny
</Location>
Allow access from the local network only
<Location /admin>
AuthType Default
Allow localhost
Allow 192.168.10.*
Order allow,deny
</Location>
Allow access from anyone anywhere:
<Location /admin>
AuthType Default
Allow all
Order allow,deny
</Location>
I'll leave the choice up to you, but keep the security implications in mind. The administration interface allows users to add, modify, and remove printers.
Depending on your configuration, someone with access to the interface may also be able to change printer settings or submit administrative actions.
In my case, I chose to require authentication using a local account on the server.
Recommended network settings
CUPS can often detect a printer automatically, but to avoid confusion we're disabling the common network discovery protocols on the printer itself.
To do that, I'll guide you through the printer's network settings.
HP printer
The HP printer I owned was an HP ENVY Inspire 7200. If you own a different printer, keep in mind that the menus may look slightly different. The exact names of the settings may vary, but the overall process should be similar enough that you can follow along.
The printer offers a variety of connectivity options, including BLE, Wi-Fi Direct, Bonjour, WSD, and port 9100 (used by HPLIP).
We only need to keep port 9100 enabled. This allows our CUPS server to communicate with the printer through HPLIP while preventing client devices from discovering the printer directly through other protocols.
First, we're going to disable BLE.

Then we're going after Bonjour.

Next, we'll disable WSD. In the screenshot, you can see that I've left WSD Scan enabled.
I haven't disabled this setting since I'm afraid of breaking my scanservjs integration.
If you don't have a similar setup, go ahead and disable it too.

And last but not least, we need to make sure that port 9100 remains enabled for HPLIP.

Epson printer
As I mentioned earlier, my Epson printer is an EcoTank ET-2956.
Like the HP, it comes with several network services enabled by default. Since we want the CUPS server to be the single entry point for printing, we're going to disable the protocols we don't need.
First, open the printer's web interface and navigate to Advanced Settings.

From there, go to Network Security → Protocol to access the individual network protocol settings.

For this setup, we only need IPP(S), so we can disable the other printing and discovery protocols.

In theory, other devices on our network could still use IPP(S) directly, but with the printer's auto-discovery protocols disabled, a user would have to deliberately configure it rather than connect to it by mistake.
Installing HPLIP (only for HP printers)
The HP setup works a little differently. Instead of IPP(S), CUPS communicates with the printer through HPLIP using port 9100. With the other printing and discovery protocols disabled, CUPS remains the single entry point for client devices.
HPLIP also provides printer-specific functionality that may not be available when using standard protocols, so that's the approach we're going to use here.
Warning
At the time of writing, HPLIP doesn't work properly on Ubuntu 26.04.
I learned this the hard way. Don't worry if you've already upgraded an existing installation: in my case, printing continued to work just fine, but the HPLIP command-line tools were broken.
Hopefully HP will update HPLIP sooner or later and this warning can eventually disappear.
Here comes the tricky part, the part where most people struggle.
HPLIP works fine but the setup process is a pain.
You can download the install script at their development portal.
There is a dropdown where you can select your distribution.

I personally use Ubuntu, so that's what I'll be using throughout this guide.
We need to get the installation script onto our server somehow. wget is not really an option since their code is hosted on SourceForge. I mostly transfer the script through SFTP.
Next, we're going to follow the manual installation instructions, or at least the part covering package dependencies. Installing these beforehand avoids a number of problems with the HPLIP installer.
At the time of writing, the documentation specifies the following command:
sudo apt-get install --assume-yes libcups2 cups libcups2-dev cups-bsd cups-client avahi-utils libavahi-client-dev libavahi-core-dev libavahi-common-dev libcupsimage2-dev libdbus-1-dev build-essential gtk2-engines-pixbuf ghostscript openssl libjpeg-dev libatk-adaptor libgail-common libsnmp-dev snmp-mibs-downloader libtool libtool-bin libusb-1.0-0-dev libusb-0.1-4 wget policykit-1 policykit-1-gnome automake1.11 python3-dbus.mainloop.pyqt5 python3-reportlab python3-notify2 python3-pyqt5 python3-dbus python3-gi python3-lxml python3-dev python3-pil python-is-python3 libsane libsane-dev sane-utils xsane
Now comes the part that made me question my life. I literally spent hours on it.
Normally you should just type sh hplip-3.26.6.run and follow the installation process.
But if you use a modern version of Ubuntu (since 24.04) it will fail due to an issue with a Qt dependency.
This is how we're going to solve this issue.
First we tell the install script to prepare the source files without executing anything.
sh hplip-3.26.6.run --noexec --target hplip-src
Then we navigate to the folder where the source files were extracted.
cd hplip-src
Now we'll execute the Python installation script with some additional arguments telling it to use Qt5.
python3 install.py --no-qt4
This should enable us to go through the installation process without any issues.

Before running the setup command, we need to keep one more thing in mind. Since we're running on a headless server, we don't have a GUI. By default, HPLIP will try to launch one, which will result in an error. We can avoid that by telling hp-setup to use interactive mode instead.
sudo hp-setup -i 192.168.0.70
This will take you through some additional setup and will finally add the printer to our server.
Setting up CUPS
Now we just need to configure CUPS to use our printer.
Open your browser at https://your_cups_server:80/admin.
Depending on the authentication method you configured earlier, you may be prompted for a username and password.
You may receive a certificate warning the first time you access the web interface, as the administration interface runs over HTTPS. This is expected when using the self-signed certificate generated by CUPS by default.
Under Printers click the Add printer button.
HP
Select HP Printer (HPLIP) as the protocol.
You will then be prompted for a connection string.
The format is hp:/net/<printer_name>?ip=<ip_address> where <printer_name> is the name you assign to your printer during the HPLIP setup and <ip_address> is the IP address of your printer.
Be aware that <printer_name> must exactly match the name used in HPLIP. If it does not, CUPS will accept the configuration, but communication with the printer will fail when print jobs are submitted.

If you're unsure which name to use, you can retrieve it using:
hp-info -i
Then we will be asked for some additional settings.
CUPS is a bit particular about printer names, so avoid spaces and special characters. Apart from that, don't forget to check Share This Printer.

Then we will be prompted for driver settings.
Select the make as HP and select your particular model in the list.

At the end of the setup process, you'll probably see a warning that support for traditional printer-specific drivers is being deprecated by CUPS.
Long term, we'll need to find another solution, but for now, we've completed the setup process.
Epson
Setting up the Epson is considerably simpler because we can use standard IPPS instead of installing a manufacturer-specific driver stack such as HPLIP.
The printer's IPPS connection string can be found in its network settings. It should look similar to: ipps://printer_address:631/ipp/print.
Enter this connection string when adding the printer to CUPS.
CUPS will then ask you to select the printer manufacturer and driver. Select Epson as the manufacturer and choose the IPP driver.

And that's it. Unlike the HP setup, there is no separate driver package or HPLIP installation required.
Adding your printer
In this section, you'll see that we talk about automatically discovering our printer.
At first, this might seem strange, since earlier we disabled Bonjour, the protocol used for automatic discovery, on the printer itself.
This is intentional. CUPS has Bonjour enabled by default, so our clients discover the shared CUPS printer instead of trying to connect directly to the physical device.
In fact, this is exactly what we wanted: automatic discovery still works, but CUPS remains the single entry point for printing.
Mobile devices
Mobile devices (Android and iOS) will automatically detect your CUPS printer.
No additional apps are required.
Windows
Using the printer from Windows requires a little bit of setup.
I'll be honest: by the time I started writing this article, I'd been running CUPS for so long that I couldn't remember how I'd originally added the printer to Windows.
While writing the article, I tried recreating the process using a dummy printer, but I couldn't get it to work properly. When my new printer arrived, I finally had the perfect opportunity to test the setup again with a real device.
It turned out to be much easier than I remembered.
Open Settings and navigate to Bluetooth & devices → Printers & scanners.
Click Add device next to Add a printer or scanner.
Your CUPS printer should be discovered automatically. Select it, add it, and you're done.
After everything we went through to configure the server, it's quite nice to have something that's this easy.
If you're having issues adding the printer, remember that Windows can be a bit annoying when it comes to printing, and a good old restart might do the trick.