Sunday, March 06, 2011

Making the WRN3500L into a Print Server

The Netgear WRN3500L came to my notice very recently when a local store had it on sale for the same price as the venerable Linksys WRT54GL, my go-to router for stable-as-a-rock installs for many years. The WRN3500L is also a Linux router, but it has all sorts of cool extras; Wireless N, gigabit Ethernet, and coolest of all, a USB port! Sadly, the supplied firmware didn't have any print server capabilities, and I really wanted that feature.

So, I've managed to turn my Netgear WRN3500L router into a print server (while still keeping it as a nice router). I did so using the standard DD-WRT build and an extra package that I downloaded using ipkg, the package-manager for OpenWrt and DD-WRT.

I used the following resources:

myopenrouter.com
The DD-WRT router database and wiki

Read on for my detailed instructions on doing it yourself. And feel free to comment if you have found things I should add or change.


Getting DD-WRT Set Up


I used a netbook connected by Ethernet cable to the router to connect to the router.


Flashing to DD-WRT

First, I downloaded the "special .chk file for initial flashing" firmware and the "Standard-USB-FTP Generic" firmware to the netbook. I got them both from the wrn3500L page of the DD-WRT router database (you have to enter "wrn3500l" into the search engine; I can't link to it directly).

Then I plugged in to the router and went to the router's web interface on 192.168.1.1 (using the default name and password) and went to "Upgrade Router".  I installed the .chk firmware and then let it sit a very long time (20 minutes or so) before doing the 30-30-30 reset that the wiki recommends. You probably don't need to wait that long.

When the router was back up with the DD-WRT firmware, I immediately went to the Administration / Firmware Upgrade tab and flashed the Standard-USB-FTP Generic firmware. This time, I just let it sit for 5 minutes and then reconnected. I didn't have to do anything fancy this time; it just came back up with the new version.

Enabling SSH

After I had the full DD-WRT firmware, I activated SSH (Services / Services tab: Secure Shell box: enable everything, Apply Settings; then Administration / Management tab, Remote Access, SSH Management: Enable, Apply Settings) and deactivated telnet. (That's optional; but who uses telnet these days?)

SSH really is the best way to connect to your Linux router; it gives you a secure connection from anywhere. Linux (and Mac OSX) has it built-in (well, desktop Linux distros have it built in. You have to download it for Maemo), and PuTTY for Windows is a great SSH client for Microsoft platforms. A great side benefit of setting up SSH for your router is that you can use your router as a proxy with an encrypted tunnel. But that's for another post.

Enabling JFFS

In order to install the extra print server packages, you need to first get a JFFS filesystem installed on your router. This reclaims the space not used by your firmware and gives you a writeable filesystem to put custom files on. For the WRN3500L with the standard USB firmware, this is 2.6 MB, more than enough space for getting a print server running.  I'm hoping to get a windows file share using Samba as well, and it looks like there's enough space for that too.

Enabling JFFS isn't as easy as just choosing "Enable JFFS" and hitting the Apply button. I found that out the hard way. You have to follow the steps in the wiki very closely:

  1. On the router web page click on Administration.
  2. Scroll down until you see JFFS2 Support section.
  3. Click Enable JFFS.
  4. Click Save.
  5. Wait couple seconds, then click Apply.
  6. Wait again. Go back to the Enable JFFS section, and enable Clean JFFS.
  7. Do not click "Save". Click Apply instead.

    The router formats the available space.

  8. Wait till you get the web-GUI back, then disable "Clean JFFS" again.
  9. Click "Save".
  10. It may be wise to Reboot the router, just to make sure 
 I didn't do it this way the first time, and the JFFS partition seemed to be there, but it wasn't really. I guess it just hadn't been formatted.

Getting The Printer Set Up

Enabling USB and Printer Support


I mostly followed the Printer Sharing article on the DD-WRT wiki to get this working. I think there may be extra steps here (it seems you may not need to install anything at the command line if you enable USB and Printer Support in the GUI), but it doesn't seem to hurt anything to do them all.

First, you need to go to the Services / USB tab and enable everything. Just go down the row of radio buttons and set everything to "Enable". Hit "Apply Settings" and wait for the GUI to return. Plug in your USB printer and reboot the router.


Go to the Setting Up The Clients section and if that works for you, then you're done. If not, come back and continue with...

Installing the Print Server


First you have to log in to your router via SSH. This is pretty straightforward. In Linux, it is just
ssh username@192.168.1.1
In PuTTY it is just a case of putting username@192.168.1.1 into the Host box.

username is the name you chose when setting up your DD-WRT for the first time. And you'll need your password too, because that's the first thing the router asks when you connect.


Once logged in, I updated ipkg, the package installation system in DD-WRT. Ok, I have to stop and say, isn't that cool? A router with a package management system! Yes, that is very cool. Ahem. Anyway. It is pretty straightforward to do.

ipkg update
You can see what printer-related stuff is available by doing the following:

ipkg list | grep print
This showed me:
kmod-lp - Kernel modules for parallel port support and line printer
kmod-usb-printer - Kernel modules for USB Printer support
p910nd - A small non-spooling printer server.
samba - NetBIOS/SMB file and print server
I installed the kernel modules (even though I think they're already installed in this version) and the p910nd printer server. I also installed the samba server, but I haven't gotten that working yet, so I'm not going to dwell on it ;-)

ipkg -force-depends install kmod-usb-printer

I created the file /jffs/etc/config/usb.startup and added a single line, using the very simple built-in text editor vi, as follows:

vi /jffs/etc/config/usb.startup
Hit the i (for insert) key, type the following two lines:
insmod /jffs/lib/modules/2.4.30/printer.o
Hit Esc a couple of times, then enter :wq to save and exit.

I rebooted the router, (reboot at the command line does this well) and then waited until I could SSH back in. Then, I installed the print server:
ipkg -force-depends install p910nd
Then I rebooted one last time.

I didn't have to do anything special beyond this to get printing working. I may not have even needed to do all that.

Getting The Clients Set Up

Ubuntu Clients: Set up the printer using System / Administration / Printing. If you add the printer, choose "Other", or if you have the printer set up, choose properties, and then put the following into the "Device URI" field:
socket://192.168.1.1:9100
And you're done with the special set up. That should just work.

Windows Clients: This is a bit weird. For some reason, you have to install a Local Printer (NOT a Network Printer! Don't go there!) and then choose New Standard TCP/IP Port. (I know, I know, I told you it was weird). Set device type to custom, keep it set to RAW and set the port number to 9100.

Labels: , , , , , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home