FreeBSD + Brother HL-2070NThere was a discussion last week on the freebsd-questions list about "budget" laser printers. In light of comments from the list and my desire for a printer -- I've grown rather weary of printing via my parents' computers and then waiting for documents to arrive at a rate of 3 pages per minute -- I decided to buy a Brother HL-2070N printer, which I was surprised to find cost less than two hundred (Canadian) dollars, even before the mail-in rebate. So far, I've been generally happy with this printer; however, getting it to work with FreeBSD wasn't an entirely smooth process.
As the printer packaging and the website from which I ordered the printer both clearly state, while the HL-2070N supports parallel, USB, and RJ45 connections, it doesn't come with any such cables. This didn't cause me any difficulty -- I pulled 20' of cat5e cable off of the (still mostly full) 1000' reel I bought a couple of years ago -- but it is worth remembering if you don't manufacture your own network cables.
The first problem I encountered was configuring an IP address for the printer. A few seconds after being turned on, it sent out DHCP requests -- first three DHCPDISCOVER packets, and then three BOOTREQUEST packets. I was running dhcpd on the network, and using tcpdump I saw replies to each DHCP/BOOTP request providing an IP address; but for some reason the printer either didn't receive or didn't understand the responses. After giving up on DHCP, the printer chose an IP address randomly from the 169.254/16 RFC 3927 link-local range and started looking for routers (it didn't find any, since my network doesn't use that IP range).
After spending an hour trying to get the printer to obtain its IP address via DHCP, I switched to a different strategy: I told my laptop to use IP address 169.254.0.1. From there I could access the printer's web-based control panel: I could print test pages, I could configure printing and networking settings... but I couldn't configure its IP address because the "Configure TCP/IP" link led to a blank page.
At this point, I noticed that the printer specifications list TELNET as a supported network protocol. Sure enough, when I tried to telnet to the printer's IP address, I was presented with a management shell. A few help queries later, and I found the command I wanted: "set ip ad <address>". To make sure the printer wouldn't try to pick a new address, I also asked it to "set ip me static".
Now that the printer had the right IP address, I started cupsd on my laptop, told KDE that I had a new printer, asked it to print a test page... and received four pages of garbage plus a paper jam by the time I could hit the power button to turn the printer off. A few attempts -- and several pages of garbage -- later, I told the printer to emulate an HP LaserJet and told CUPS to use its HP LaserJet driver, at which point everything worked.
My instructions for setting up a Brother HL-2070N printer with FreeBSD are consequently as follows:
- If it isn't already installed, install the print/cups metaport from the FreeBSD ports tree. Note that while the cups-base port is installed as part of KDE, this isn't enough.
- If cupsd isn't already running, start it by adding cupsd_enable="YES" to /etc/rc.conf and running /usr/local/etc/rc.d/cupsd.sh start.
- Start running tcpdump ip host 255.255.255.255, connect the printer to the network, and turn the printer on.
After about 30 seconds, tcpdump will print out a line looking like
23:30:30.164843 IP 169.254.x.y > 255.255.255.255: ICMP router solicitation, length 8
Remember the IP address 169.254.x.y -- this is the address the printer chose automatically.
- On your FreeBSD system, su to root, and run ifconfig bge0 add 169.254.0.1 (substituting the name of your network adapter for bge0 if appropriate).
- Telnet to the printer (telnet 169.254.x.y) and log in using the default password ("access"). Run the two commands set ip ad aa.bb.cc.dd and set ip me static (where aa.bb.cc.dd is the IP address you want the printer to use).
- Run ifconfig bge0 delete 169.254.0.1 to unconfigure the IP address we added in step 5.
- Open your web browser to http://aa.bb.cc.dd:631/user/prnset.html (you'll have to log in using the default username "admin" and password "access"), and set the Emulation to HP LaserJet.
- Tell CUPS that you have a network printer with IPP, with a URI of http:/aa.bb.cc.dd:631/ipp and that it should use the ESP HP LaserJet Series PCL 6 driver.
- Print a test page to make sure everything is working!
blog comments powered by Disqus