0% found this document useful (0 votes)
1K views

FreeNAS As A Print Server

This document provides instructions for setting up a FreeNAS server as a print server. It involves installing the LPRng print server software on FreeNAS, configuring print queues and permissions, and connecting Windows and Mac clients via LPR printing. Key steps include installing the ulpt.ko kernel module, enabling LPRng via rc.conf, configuring printcap, lpd.perms and lpd.conf files, and setting permissions to automatically start printing when a USB printer is connected.

Uploaded by

fahyettin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

FreeNAS As A Print Server

This document provides instructions for setting up a FreeNAS server as a print server. It involves installing the LPRng print server software on FreeNAS, configuring print queues and permissions, and connecting Windows and Mac clients via LPR printing. Key steps include installing the ulpt.ko kernel module, enabling LPRng via rc.conf, configuring printcap, lpd.perms and lpd.conf files, and setting permissions to automatically start printing when a USB printer is connected.

Uploaded by

fahyettin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

FreeNAS as a Print Server

step 1Preparation
First, let's get together a few things and take a look at the setup.

The Network 
Your setup may be different, but mine is as follows.
- Linksys WRT54GL router running Tomato firmware v1.23
- FreeNAS box - v0.69, old Sony Vaio, 2 hard drives, static IP: 192.168.1.50
- PC - Windows XP SP3
- Macbook Pro - OSX 10.5.6
- HP Deskjet 6540 - USB connected printer, attached to FreeNAS

You will need to assign your FreeNAS box a static internal IP from within your router. There's plenty
of guides online for that, all straight-forward, so do a quick Googling.

Stuff You'll Need 


- Windows install disk if you're using Windows (necessary files may be availible elsewhere, but this is
the easiest)
- Printer Drivers for your particular make/model
- The file "ulpt.ko" taken from a full FreeBSD install. File attached to this instructable.
- SSH client - For Windows, go with PuTTy . For Linux, Unix, Mac, etc you can just use the
terminal/command line
step 2Connect via SSH
Connect to your FreeNAS box via SSH. Normally it's bad practice to log in as root, but if you're really
careful, things should go smoothly.

PuTTy is pretty self explanatory here for connecting. For the command line people, type:

ssh -l username static_ip_of_freenas 

The static ip will be something like 192.168.x.xxx.


It will ask for a password, but when you type, nothing shows up. Don't worry, this is normal (hides
password for security purposes); just type it and hit enter.

You should now have yourself a little greeting and a new command prompt (loggin in as root
is freenas:~# and as a user is > )
step 3Put ulpt.ko In The Right Spot
Use your preferred method (ftp, smb, etc.) to put the ulpt.ko file somewhere onto the FreeNAS box,
and remember the full path (I'll call it UPath), which will probably be something
like /mnt/drivename/ulpt.ko 

Go back to the terminal with the SSH connection and command prompt, we're going to move the file
to the proper place. Type:

mv Upath /boot/kernel/ulpt.ko 

That ought to do it.

step 4Install LPRng

We will be using a package called LPRng . To install it, type:

pkg_add -r LPRng 

Let that chug away for a bit while it downloads and installs the necessary bits.

step 5Configure Things to Load on Boot

Load ulpt.ko Module 


First we want to make sure that ulpt.ko loads on boot so as soon as we connect a printer it'll
recognize it properly. Type:

nano /boot/defaults/loader.conf 

Scroll down with either the arrow keys or ctrl+V until you reach a section titled "USB Modules"
Change the line
"ulpt_load="NO " # Printer"
to
"ulpt_load="YES " # Printer"

Hit ctrl+X. Then type "y", and hit enter when it asks you to save.

Start LPRng 

Navigate to the FreeNAS web interface in a browser. Then go to System-->Advanced-->rc.conf


Use the "+" button to add two new entries:

Name: lpd_enable
Value: NO

Name: lprng_enable
Value: YES
Step 6LPRng Configuration: 1 of 3 - printcap
There are three main files that contribute to LPRng working properly.
- /etc/printcap
- /usr/local/etc/lpd.perms
- /usr/local/etc/lpd.conf

Printcap (location: /etc/printcap) can be very complex or very simple. We'll go with very simple, but
you can refer to the LPRng site and google for some different setups depending on your needs.

It'll be much easier to illustrate this by example:

# @(#)printcap HP Deskjet 6540 


lp|deskjet:\ 
:sd=/var/spool/lpd/bare:\ 
:sh:\ 
:lp=/dev/ulpt0: 

First line doesn't matter much. Just put your printer make/model in there for reference
- "lp|deskjet" - this is what you're printer will be known as. "lp" is the primary name, "deskjet" is an
alias.
- "sd=" This is the path to the print spooler. We're going to make this directory in a second.
- "sh" This stands for "supress header". If you've ever printed in a computer lab, you'll have seen
these. It's a page that prints before a job that identifies who the job is for. For most people at home,
it's unnecessary. In a work environment with lots of people and printing, it's something you should
look into.
- "lp=" this is the location of the printer. If ulpt.ko loads properly, then when you connect a printer, it
should register as /dev/ulpt0.
Remember the spooler path from sd? Let's make it. Type:

"mkdir -p -m 700 /var/spool/lpd/bare" 


and
"chown 1:1 /var/spool/lpd/bare" 

This creates the proper directory with the necessary ownership and permissions.

step 7LPRng Configuration: 2 of 3 - lpd.perms


lpd.perms (location: /usr/local/etc/lpd.perms) is a bit long. The default configuration should be fine.
Scroll through and double check that these lines are uncommented (don't begin with a "#") by typing:

nano /usr/local/etc/lpd.perms 

The lines that we want uncommented are:

ACCEPT SERVICE=C SERVER REMOTEUSER=root,papowell 


ACCEPT SERVICE=C LPC=lpd,status,printcap 
REJECT SERVICE=C 
ACCEPT SERVICE=M SAMEHOST SAMEUSER 
ACCEPT SERVICE=M SERVER REMOTEUSER=root 
REJECT SERVICE=M 
DEFAULT ACCEPT 

Make any changes and then hit ctrl+X

step 8LPRng Configuration: 3 of 3 - lpd.conf


lpd.conf (location: /usr/local/etc/lpd.perms) should also be fine as the default. Things to double
check for:

# Purpose: always print banner, ignore lpr -h option 


# default ab@ (FLAG off) 
# Purpose: query accounting server when connected 
# default achk@ (FLAG off) 
# Purpose: accounting at end (see also af, la, ar, as) 
# default ae=jobend $H $n $P $k $b $t (STRING) 
# Purpose: name of accounting file (see also la, ar) 
# default af=acct (STRING) 
# Purpose: use long job number (0 - 999999) when a job is submitted 
# default longnumber@ (FLAG off) 
Longnumber 

step 9Start Things and Set Permissions When Printer Connects


We're going to want to start up the proper LPRng processes when a printer is connected. Type:

"nano /usr/local/etc/devd/devd.conf"

Add to the file:

# start action when USB printer ulpt0 is plugged in 


# wait 3 second and then start the spooler daemon 

attach 100 { 
device-name "ulpt0"; 
action "sleep 3; lpd; 
checkpc -f; 
chown 0:0 /dev/ulpt0; 
chmod 666 /dev/ulpt0; 
echo 'o5L25fgfab' > /dev/speaker;"; 
}; 
*/ 

This watches for the printer to be plugged in, waits a few seconds, and starts the LPD process. Once
that's going it fixes any missing files or permissions with checkpc -f . It then sets proper ownership
and permissions on the device and plays a little sound.

step 10Connecting A Windows PC


1) Go to Network Connections. Click the Advanced tab at the top, then "Optional Networking
Components".
Enable both Management and Monitoring Tools and Other Network File and Print services. It will ask
you to insert the Windows cd, which you should have around. This will allow us to connect via LPR

2) Go to the Control Panel and then to Printers. Run the Add a New Printer wizard.

3) Local Printer (do not automatically detect). Next.

4) Create New Port -> LPR Port. Next

5) Enter the IP address of the FreeNAS box. This is why we want it to be static. Enter the name of the
print queue (if you copied my printcap, it's "lp" without quotes)

6) Install drivers and click through the rest of the wizard. Do not print test page.

7) Right click on the printer and open up properties.

8) Port Tab. Uncheck "bidirectional support"

9) Advanced Tab.
start printing after the last page is spooled. Check
Print directly& Uncheck
Hold mismatched& Uncheck
Print spooled& Check
Keep&.Uncheck
Enable advanced& Check

10) Now go back to the main tab and try printing a test page.
step 11Connecting with Mac OSX
1) Open up System Preferences -> Print and Fax

2) Click the "+" to add a printer


3) Go to the "IP" tab
Protocol: LPD
Address: The IP of FreeNAS
Queue: Name of print queue (if you copied my printcap, it's "lp" without quotes)
Name and Location are up to you
Print Using: Pick correct drivers*

*Some printers, like my HP Deskjet 6540 wouldn't let me use the usb drivers with the LPD. I had to
instead pick one as close as possible (turned out to be 5550) and go with that. If the two models are
similar, it should work without a problem.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy