Configure an LPD/LPR print server on Ubuntu by installing the cups and systemd dependencies, then defining the printer via CUPS web interface or command line using the lpd://host/queue URI scheme. Ensure network routing is correct, especially when using WiFi interfaces that may have different gateway metrics than Ethernet connections.
Understanding LPD/LPR Protocol in Modern Linux
The Line Printer Daemon (LPD) protocol is one of the oldest printing protocols still in use, particularly common with older network printers and dedicated WiFi print servers. While modern systems heavily favor IPP (Internet Printing Protocol), many legacy devices and specific enterprise setups still rely on LPD for its simplicity and low overhead. On Ubuntu and other Debian-based distributions, the Common Unix Printing System (CUPS) acts as the backend to manage these jobs, translating local print requests into LPD packets sent over the network.
When connecting via a WiFi interface, it is crucial to ensure that the client machine can reach the print server's IP address without interference from routing tables. This is often complicated by dual-stack networks where both WiFi and Ethernet are active. If you experience connectivity issues similar to those described in Why doesn't SSH work if WiFi is on while ethernet is connected?, your print jobs may fail silently because the system routes traffic through the wrong interface or subnet mask.
Installing Required Software Packages
Before configuring the printer, you must ensure the necessary software stacks are installed. Ubuntu typically includes CUPS by default, but explicit installation guarantees all helper scripts and filters are present. Open a terminal and update your package lists first:
sudo apt update
sudo apt install cups cups-common hplip lprng
The lprng package provides the legacy LPD daemon capabilities if you need to act as a server, but for clients, the cups-client tools are sufficient. Verify that the CUPS service is running and enabled:
sudo systemctl status cups
sudo systemctl enable cups
Configuring the Print Queue via Command Line
The most robust way to add an LPD printer is using the lpadmin command-line utility. This method gives you precise control over the device URI and queue name. You need three pieces of information: the hostname or IP of the print server, the name of the printer queue on that server, and a descriptive name for the local queue.
To add the printer, run the following command, replacing placeholders with your actual details:
sudo lpadmin -p MyNetworkPrinter -E -v lpd://192.168.1.50/printer1 -m everywhere
Here, -p defines the local queue name, -E enables the printer and accepts jobs immediately, -v sets the device URI using the lpd:// scheme, and -m specifies the PPD model. Using everywhere allows CUPS to auto-select the best driver based on the printer's capabilities advertised via DNS-SD or mDNS, which is helpful if the exact driver model is unknown.
Handling Authentication and Network Routing
Some LPD servers require authentication, although standard LPD does not support usernames and passwords natively. If your WiFi print server requires credentials, you may need to wrap the connection in a secure tunnel or use a wrapper script that handles authentication before sending the job. However, most basic WiFi print servers operate on open LAN segments. If you find yourself needing to troubleshoot why the connection drops intermittently, check your WiFi stability. Issues like Troubleshooting Debian WiFi Phantom Failure can cause packet loss that results in incomplete print jobs or timeouts.
If you are using both WiFi and Ethernet, ensure that the route to the print server is preferred over the default gateway. Use ip route get 192.168.1.50 to see which interface the kernel chooses. If it selects wlan0 correctly, you are good. If it selects eth0 and the printer is on the WiFi VLAN, you must adjust the metric or add a static route:
sudo ip route add 192.168.1.0/24 dev wlan0 metric 100
Verifying and Testing the Configuration
Once configured, verify the printer status using lpstat:
lpstat -p MyNetworkPrinter -l
This will show the state of the printer, whether it is accepting jobs, and any error messages. To test the connection, send a simple text file to the printer:
echo "Test Page" | lpr -P MyNetworkPrinter
If the job fails, check the CUPS error log at /var/log/cups/error_log. Look for lines containing "LPD" or "connection refused". These logs provide critical insights into whether the issue is network-related, permission-based, or a mismatch in the queue name on the remote server.
Frequently Asked Questions
What is the difference between LPD and LPR?
LPD refers to the Line Printer Daemon service or protocol, while LPR stands for Line Printer Remote, which is the client command used to submit jobs. In practice, they are often used interchangeably to describe the same legacy printing subsystem. The URI scheme lpd:// tells CUPS to use this protocol stack.
Can I use SSL/TLS with LPD for security?
Standard LPD does not support encryption or authentication. All data, including print content, is sent in plaintext. For secure printing over untrusted networks like public WiFi, consider using IPPS (IPP over TLS) or setting up an SSH tunnel to forward the LPD port locally.
How do I remove a broken LPD printer configuration?
You can remove a printer queue using the lpadmin command with the -x flag followed by the queue name. Run sudo lpadmin -x MyNetworkPrinter to delete the configuration entirely. You should also restart the CUPS service afterward to clear any stuck jobs.
Why does my print job hang indefinitely?
Hanging jobs usually indicate a network timeout or a blocked firewall port. LPD uses TCP port 514 by default. Ensure that no firewall rules on the router or the host machine are blocking outbound traffic to this port. Additionally, verify that the remote queue name matches exactly what the print server expects.
Is LPD still supported in recent Ubuntu versions?
Yes, LPD support remains built into CUPS, though it is considered legacy technology. It is fully functional in Ubuntu 22.04 and 24.04 LTS releases. However, new hardware rarely supports LPD out of the box, so it is primarily useful for integrating older peripherals or specialized industrial printers.