Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 May 2004 12:00:30 +0800
From:      Robert Storey <y2kbug@ms25.hinet.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Printing to a network printer?
Message-ID:  <20040514120030.53b076ef.y2kbug@ms25.hinet.net>
In-Reply-To: <200405121019.11429.fbsd-questions@trini0.org>
References:  <200405121019.11429.fbsd-questions@trini0.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 12 May 2004 10:19:11 -0400
Gerard Samuel <fbsd-questions@trini0.org> wrote:

> Specifically to a Brother MFC3820cn ->
> http://solutions.brother.com/mfc3820cn_us/en_us/
> Im currently trying to print to it via CUPS, but Im getting nowhere fast.
> Has anyone ever attempted to print to this unit via the network?
> I would like to hear what you have to say...

Dear Gerard,

I too have struggled with making CUPS work for network printing. It took me
awhile, but I think I've finally got it. The FreeBSD Handbook has nothing useful
to say about CUPS (it just says visit http://cups.org), so I've been writing up
a HOW-TO which I'll submit to the Handbook folks soon. It's not quite finished,
but here's what I have so far - hope it helps.

regards,
Robert


STEP 1: Installing CUPS from PORTS
You've got to install four packages from ports. You can find them here:
 
   root@sonic:# ls -d1 /usr/ports/print/cups*
   /usr/ports/print/cups
   /usr/ports/print/cups-base
   /usr/ports/print/cups-lpr
   /usr/ports/print/cups-pstoraster

The first port - /usr/ports/print/cups - is a meta-port, so installing it should
install the others.
 
 
STEP 2: Creating a Log Directory
Create a directory for the CUPS log files:
 
   root@sonic:# mkdir /var/log/cups
 
 
STEP 3: FreeBSD-specific Issue
On FreeBSD, CUPS stores its executable files in /usr/local/bin/ whereas the
traditional lp executables are in /usr/bin/. Because /usr/bin/ is in the command
path before /usr/local/bin/, your CUPS files will not be able to execute. For
example:
 
   root@sonic:# which lpr
   /usr/bin/lpr
 
This problem is handily solved by making file /usr/bin/lp* non-executable, like
this:
 
   root@sonic:~> chmod -x /usr/bin/lp*
 
Now, let's try the previous command again:
 
   root@sonic:# which lpr
   /usr/local/bin/lpr
 
Success! This is what we want.
 
 
STEP 4: Starting the CUPS Daemon
You need to set up a script that starts the CUPS daemon on bootup. There is a
sample startup script which you can just copy and make executable, like this:
 
   cd /usr/local/etc/rc.d>
   cp cups.sh.sample cups.sh
   chmod 755 cups.sh
 
 You could reboot now to start the daemon, but since you're in this directory
anyway, you could start it manually:
 
   ./cups.sh start
 
 
STEP 5: Configuring the Printer
This part is just like Linux. Open up a browser (Mozilla or Konqueror will do)
and type this url:
 
   http://localhost:631
 
This will bring you to the CUPS configuration menu. You'll be asked to login
(login as root and use the root password), then it's simple point-and-click
stuff that you should be able to figure out yourself.
 

STEP 6: Configuring a CUPS Server and Client
If you want to enable network printing on your LAN, you've got a little more
work to do. Assuing that the FreeBSD box is the print server, edit file
/usr/local/etc/cups/cupsd.conf and make two changes. The two changes vary
according to how your network is configured, but for a typical Class C network,
this should work:


  # broadcast address
  BrowseAddress @LOCAL

  <Location />
  Allow From 192.168.0.0/24


Instead of @LOCAL, we could have specified a broadcast address, such as
192.168.0.255 (again, that's for a Class C network). And rather than
192.168.0.0/24 (the whole network), we could have specified just a single client
machine (such as 192.168.0.3).

Once you have made the above changes, restart the CUPS daemon:

     /usr/local/etc/rc.d/cups.sh restart

Now go to the client machine, open your browser, type http://localhost:631, and
click the button "Print test page" - it should work. Now try printing a regular
html file with the same browser. It will probably NOT work unless you remember
to specify the CUPS server as the printer (your browser should give you an
option to select a printer in the "File-Print" menu).


STEP 7: Configure a CUPS Server to Work with LPD Clients
If the client machine is not running CUPS, or you are using an application (on
the client machine) which depends on lpr, you must configure CUPS to accept
print jobs from LPD clients. You accomplish this with a CUPS helper server
called "cups-lpd" (see "man cups-lpd").




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040514120030.53b076ef.y2kbug>