May 15, 2011

USB Printing with DD-WRT

*Update* 30/07/2017 : As you can see, this guide is very dated, however I believe the general steps should still be the same as the helpful comments from readers mentioned below, though you may need to find the latest drivers and packages for your setup. Do give a shoutout if you used my guide recently and let us know if it still works! Some have also mentioned that JFFS2 may not be required now, although it was something I did back then.

I had recently switched my home router to a TP-LINK TL-WR1043ND and decided to make full use of my spanking new router by upgrading it to DD-WRT firmware. It was quite fun doing the upgrade process, but my main point for this post is not to talk about how to upgrade it, but to touch on one interesting feature that I had spent a little while getting to work - USB printing.

I have a Brother HL-2040 printer lying around in the house which has not been used ever since the com connected to it went dead. I have always wanted to try connecting it to my new router and share it across my home network, but never got around to actually doing it for the lack of a more compelling reason other than to do printing at home, which I can usually do in office. The push to do this came when my dad needed to print something.

Disclaimer: I take no credit for the guide I did below, which was a compilation of different advices from a few websites. I will include links to those sites at the end for further references for anyone who still cannot make it work. This goes to say that you are using this guide at your own risk. I do not guarantee it works, and bricking your router IS possible.

I also want to highlight that although I am using a TP-LINK router and a Brother printer, this guide is generic and should probably work for any other combination of routers/printers. Another thing to highlight is my firmware version, which is DD-WRT v24-sp2 (08/07/10) std - build 14896

With that, the steps as promised (it is assumed your router is already upgraded to DD-WRT firmware and tested in stable working condition):
    Enable JFFS2
  1. On "Administration" tab -> "JFFS2 Support" -> enable "JFFS2"



  2. Click "Save"
  3. Wait a few seconds, and click "Apply Settings" at bottom of the page
  4. Enable "Clean JFFS2" and click "Apply Settings" at bottom of the page (You will lose connection to your router for awhile)
  5. Disable "Clean JFFS2" and click "Save" at bottom of the page (I did not need to do this as the option was disabled when I got connection back to my router)
  6. Click "Reboot Router" at bottom of the page (IMPT!!)

  7. Enable USB
  8. On "Services" tab -> "USB" tab, enable the settings as below



  9. Click "Apply Settings"

  10. Enable SSH
  11. Still in "Services" tab -> "Services" tab ->" Secure Shell", enable the settings as below



  12. Click "Apply Settings" and after a few seconds, click "Reboot Router"




  13. Install Printer Drivers
  14. Telnet/SSH into your router (IP is usually 192.168.1.1). Username is "root" while default password is "admin", unless you have changed it
  15. Download the package with this command

    wget http://downloads.openwrt.org/snapshots/trunk/brcm-2.4/packages/p910nd_0.93-1_brcm-2.4.ipk

  16. Install the package with this command

    ipkg install p910nd_0.93-1_brcm-2.4.ipk

  17. Connect printer to the router, switch on printer and reboot the router
  18. When the router is up, Telnet/SSH into the router
  19. Type "ps" and enter. You should see something like below (Mine was "p9100d" and not "p910nd" as some suggested)



  20. Type "netstat -an" and enter. You should see something like below "listening" to port 9100





  21. (I did not get anything when I did a "ls /dev/usb/")

  22. Connecting to printer on a Windows XP machine
  23. In Control Panel -> Printers and Faxes -> File -> Add Printer
  24. In "Add Printer Wizard", click "Next"
  25. In "Local or Network Printer", select "Local printer attached to this computer". Check "Automatically detect and install my Plug and Play printer" if your machine previously has the drivers already installed, or else uncheck it and download your printer's drivers from the manufacturer (I got mine from Brother's website, you will get prompted for the drivers). Click "Next"
  26. In "Select a Printer Port", select "Create a new port" and select "Standard TCP/IP Port' from the dropdown box. Click "Next"
  27. In "Add Standard TCP/IP Printer Port Wizard", click "Next"
  28. In "Add Port", enter the IP Address of your router. The port name will be auto filled but you can change it to anything. Click "Next" (It will take awhile here before next screen comes up)
  29. In "Additional Port Information Required", select "Custom" and click "Settings"
  30. In Configure Standard TCP/IP Port Monitor, select "Raw" for Protocol and type "9100" for Port Number (as below). Click "OK"



  31. In "Additional Port Information Required", click "Next"
  32. In "Completing the Add Standard TCP/IP Printer Port Wizard", click "Finish"

And you are done! You can print a test page to verify it works.


And these are the links I used to compile this guide:
http://www.dd-wrt.com/wiki/index.php/Jffs#Enable_JFFS:_Create_.2Fjffs
http://sites.google.com/site/wl520gu/
http://www.dd-wrt.com/wiki/index.php/Printer_Sharing
http://www.dd-wrt.com/wiki/index.php/Asus_WL-520GU#VPN_.2B_USB_Printer_server



8 comments:

  1. Very well designed "How To" for setting up a print server with DD-WRT...Surprised no one else has ever made a comment before.

    Thanks!

    ReplyDelete
  2. This does seem to be very helpful. Thank you very much. Filenames and locations have changed since it was written so the specified wget failed but I managed to find it. I'm closer than I've been, I'm sure, but still have work to do.

    ReplyDelete
  3. : DD-WRT v24-sp2 (03/29/14) std does not have jffs2 support in Administration/Management
    --> should I forget USB printing ?

    ReplyDelete
    Replies
    1. i just used this guide to setup my printer, worked like a charm

      **i also didnt find the JFFS2 enable, so i just went ahead without it....still worked

      DDWRT build 20675 and Samsung printer

      Delete
  4. several years later and still more useful than the wiki - as the dev/usb is not valid for all models.
    yours worked as expected and don't have to use the netgear/etc usb redirector packages that don't stay connected
    - very nice work and thanks

    DD-WRT v24-sp2 (02/xx/15)
    and
    DD-WRT v3.0-r27715M kongac (08/23/15)

    Netgear R6300V2

    ReplyDelete
  5. Worked great for my HL-2040 (the AK-47 of printers) on a TP-Link N750 (DD-WRT v24-sp2 (03/25/13) std), thanks!
    Installation on Windows worked well too, but with Ubuntu I'm having troubles. Ubuntu connects to the printer when I set it up as ipp://[router-IP]:9100, but it doesn't print, print jobs are not getting done. Anyone had the same problem?

    ReplyDelete
  6. I have tried to download and install package, but its saying file not found .. not sure what I am missing?

    ReplyDelete
    Replies
    1. Hi, have you tried to download the latest package?

      Delete