Installing a USB attached printer as a network printer

First of this is for Linux, specifically I did this on Fedora Core 16.
Secondly I was using a Brother DPC-150C printer.

On the actual server the USB printer was to be connected to I updated the /etc/cups file /admin entry to “Allow 192.168.1.*” as I needed to manage it remotely not having any X-windows stuff installed on my server, that was the only change needed there; and only because in my environment localhost connections are blocked so you probably don’t need to do even that.

Started cups on the server that was to share the printer (“systemctl start cups.service”, don’t forget to “systemctl enable cups.service” after testing so it starts on reboot when you are happy it all works).

ON THE CLIENTS

These would be the Fedora servers I wanted to be able to print files from to the remote server that actually owned the remote printer. I actually needed to do nothing (apart from fixing my first error as discussed below). When the USB attached printer was made shareable on the server it was attached to it broadcast that fact to all my other servers running CUPS and the printer just apeared as available (from the CUPS web interface and command line lpstat) on all the client servers. [note: I had my firewall/iptables flushed for testing, will figure out the ports needed to be open later, which will not be appended to this post as this is not a firewall tutorial].

ON THE SERVER

Powered on the printer, there were no messages in /var/log/messages to say a new device had been found ???. Ok, went to http://servername:631 ; on the administration option selected add printer anyway, yipee CUPS had detected the new printer.

Went through the Admin/Add-Printer options to add the printer, it wanted a PPD file I didn’t have (well it was probably on the CD that came with the printer, but I got that years ago so no idea where the printer box is now). Chose one of the existing ones I thought might work.

And WOW, with all my firewalls shutdown the new local printer I had just added as a network shareable printer (with the internet available option turned off) had its definition automagically propogated to all my other servers that had CUPS running at the time (and firewall flushed).

On one of those remote client servers did a “lp -d printername /home/myuserid/.bashrc” and… it got blackholed. BUT that was my fault trying to guess a PPD file; fixed as noted in my attempt two.

CUPS PPD files for all brother printers are easily found on a google search on cups brother ppd files, but this is the link I found for those that want to skip that step.
http://welcome.solutions.brother.com/bsc/public_s/id/linux/en/download_prn.html#DCP-150C

So attempt two was
* systemctl stop cups.service on all machines
* vi /etc/cups/printers.conf on all servers to remove the entry added while playing
* install both rpm files for the DPC-150C from the above link on server and all clients
* systemctl start cups.service on all machines
* redo the add printer steps mentioned above, this time the printer add steps using the web interface on the server found a PPD file for the DPC-150 and I used that when defining the printer entry

Result
* on one of the client Fedora servers I did a “lp -d printername /home/myuserid/.bashrc” and …. it printed, no black hole, paper was spat out of the printer with the expected contents on it.

Conculsion

Sooooo, basically if you download the correct PPD file prior to defining the printer, and have open firewalls, and have the cups service running on all your clients; adding a printer as a network available printer on the Fedora server you plug the USB printer into using the CUPS web interface will result in that printer being propogated to all client servers and being instantly available (without restarting the CUPS service on the clients; it just appears in a “lpstat -a” request like magic and can be immediately used.., thats cool.

Of course, there are firewall ports that will get in the way, as noted above I flushed all iptables rules before trying thisi which obviously helped in the automatic propgation of available printers, and risks involved in opening ports etc you have to decide yourself.

Anyway, in under 30mins all my ‘client’ machines could network print to a USB attached Brother DPC-510 printer on my test server.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in Uncategorized. Bookmark the permalink.