How to Set Up an LPD/LPR Print Server on Ubuntu/Linux for WiFi Interface Traffic Authentication and Routing
In this article, we will discuss the steps to set up an LPD/LPR print server on Ubuntu/Linux that can handle WiFi interface traffic, including incoming/outgoing authentication, routing, and gateway configuration. By the end of this article, you will have a good understanding of the key concepts involved and be able to implement a similar setup in your own environment.
Introduction
The Line Printer Daemon (LPD) and Line Printer Remote (LPR) protocols are widely used for printing in Unix-like operating systems. LPD is a daemon that listens for print jobs on a specified port, while LPR is a client that sends print jobs to the LPD daemon.
In this article, we will focus on setting up an LPD/LPR print server on Ubuntu/Linux that can handle WiFi interface traffic. This is useful when you want to set up a print server that can be accessed by WiFi-enabled devices, such as laptops, smartphones, and tablets.
Prerequisites
Before we begin, make sure you have the following prerequisites:
- A WiFi interface that is properly configured and working on your Ubuntu/Linux system.
- Root or sudo access to your Ubuntu/Linux system.
Step 1: Install the CUPS Print Server
The Common Unix Printing System (CUPS) is a popular open-source printing system for Unix-like operating systems. We will use CUPS to set up our LPD/LPR print server.
To install CUPS, run the following command:
sudo apt-get install cups
Once the installation is complete, start the CUPS service and enable it to start at boot:
sudo systemctl start cups
sudo systemctl enable cups
Step 2: Configure the CUPS Server
Next, we need to configure the CUPS server to listen on the WiFi interface. To do this, edit the /etc/cups/cupsd.conf file and add the following lines:
<Interface WiFi>
BindAddress 192.168.1.2
Port 631
Allow 192.168.1.0/24
</Interface>
Replace WiFi with the name of your WiFi interface, and replace 192.168.1.2 with the IP address of your WiFi interface. The Allow directive specifies the IP address range that is allowed to access the CUPS server.
Step 3: Add a Printer
Now that the CUPS server is configured, we can add a printer. To do this, open a web browser and navigate to http://localhost:631. Click on the "Administration" tab and then click on "Add Printer".
Follow the on-screen instructions to add your printer. Make sure to select "Internet Printing Protocol (IPP)" as the connection type and enter the IP address of your printer.
Step 4: Configure Authentication and Routing
To configure authentication and routing for incoming/outgoing WiFi interface traffic, we will use iptables.
First, we need to allow incoming traffic on the WiFi interface:
sudo iptables -A INPUT -j ACCEPT -i WiFi -p tcp --dport 631
Replace WiFi with the name of your WiFi interface.
Next, we need to allow outgoing traffic from the CUPS server to the printer:
sudo iptables -A OUTPUT -j ACCEPT -o WiFi -p tcp --dport 9100
Replace WiFi with the name of your WiFi interface.
Finally, we need to allow incoming traffic from the WiFi interface to the CUPS server:
sudo iptables -A INPUT -j ACCEPT -i WiFi -p tcp --dport 631
Replace WiFi with the name of your WiFi interface.
Step 5: Save the iptables Configuration
To make the iptables configuration persistent across reboots, save it to a file:
sudo iptables-save > /etc/iptables/rules.v4
Step 6: Test the Print Server
To test the print server, try printing a test page from a WiFi-enabled device. If everything is configured correctly, the test page should print successfully.
Conclusion
In this article, we have discussed the steps to set up an LPD/LPR print server on Ubuntu/Linux that can handle WiFi interface traffic, including incoming/outgoing authentication, routing, and gateway configuration. By following the steps outlined in this article, you can set up a similar print server in your own environment.
References
- CUPS Documentation. https://www.cups.org/doc/index.html
- iptables Documentation. https://linux.die.net/man/8/iptables