TechInfoDepot:DD-WRT/USB on ASUS WL500GPV2

From TechInfoDepot
Jump to navigationJump to search

Introduction

NOTE This is an old Wiki (which still contains useful information, but Optware, the Right Way THIS is a better system.


This short How To is intended to walk someone through configuring a basic USB printer and a USB storage device (specifically USB flash drive) on their ASUS WL-500G Premium v2 (WL500GPV2) router. There are great USB how to articles on the DD-WRT wiki and I am sure that a lot of information in this article is duplicated elsewhere. Nevertheless, a lot of the guides I found only solved a piece of the puzzle. This article intends to bring all of that information into a single URL.

Firmware

I highly recommend a fresh firmware flash and a clearing of the NVRAM, starting with a clean slate will provide the smallest chance of encountering a random problem. Flash your WL500GPV2 router with either the latest DD-WRT Mega firmware (v24 SP2) or the Eko DD-WRT NEWD or NEWD-2 mini USB, or Big build releases that include full USB support. If using a mini firmware package, consider the following:

Why bother with the reduced functionality of a mini build when this router has 8MB flash? Well, there are several advantages. The mini is a fraction of the size, yet provides the vast majority of the functionality of the larger builds. For this small sacrifice, you get a much more lean and efficient setup, including...

  • A nearly 5.0MB JFFS2 partition
  • Nearly 90% free system memory on a fully configured system
  • Full USB support, easily enabled from the web GUI (just like Mega)
  • Faster, leaner (Merely observational, but noteworthy)
If you want to use USB it is good idea to use Eko's modified firmware instead of original, because
there have important fixes for the Broadcom BCM5354 CPU. It improves stability of USB devices. 

Firmware

BrainSlayer Builds

Use builds with a date August 3rd 2009 or higher. Once build of choice is selected, navigate to the broadcom section and choose your build. If planning to enable JFFS2, do NOT flash with these builds! Use the Eko builds listed below


Eko Builds

These are the preferred builds for Asus routers. Use SVN 12548 or higher. NEWD-2 builds will work for the WL500gP v2 but NOT the WL500gP v1!!!

Initial Prep

  1. Complete your standard WAN, LAN, DHCP configuration so that your router has working Internet access
    Note: This guide will not explain these details, since they are very well documented elsewhere
  2. Under Services, enable:
    Secure Shell (SSHd)
    Telnet (optional, select this if you have no idea how to connect to an SSH server)
    USB modules which you need to enable under Services->USB (Core USB support, UHCI, OHCI, USB 2.0, USB Storage, ext2/ext3, FAT, USB Printing)

For example, if you only want to install Limited Optware packages on 2.0 device you can enable : Core USB support, USB 2.0, USB Storage, ext2/ext3 FS support.

  1. Save & then Apply Settings
  2. Under Administration > Management:
    Enable JFFS2 Support
    Clean JFFS2
  3. Save & then Apply Settings
  4. Reboot Router


NOTE

If pursuing more dynamic and more advantageous properties of Optware, do NOT enable JFFS2. Read the rest of this tutorial to find out the amazing things you can do with an external storage device and a printer.

Command Line Configuration

See Frater's no hassle, newbie friendly Optware for a much more user friendly approach


Now that we have JFFS2 and command line access via SSH, lets connect to the router and perform the core of the configuration. This section is a little more advanced and some Unix/Linux experience will help reduce the chance of a cockpit error.

  • SSH to your router's internal IP address, by default this is the 192.168.1.1 address and login with the web admin credentials (default is root/admin)
    alternatively, if you enabled Telnet you can connect via the Windows built-in telnet client
  • verify that the JFFS2 partition is mounted
root@DD-WRT:/jffs# mount | grep -i jffs
/dev/mtdblock/4 on /jffs type jffs2 (rw)
  • Update the ipkg package list
ipkg update

Sometimes you may need to

mkdir -p /jffs/tmp/ipkg

before update. The last line of the output should be similar to this

Updated list of available packages in /jffs/usr/lib/ipkg/lists/backports

Note: For me, the first time I run ipkg update I always get errors. Try exiting out of SSH/Telnet by pressing Ctrl-C, typing "exit", and reconnecting - if that doesn't work, then reboot the router. It has worked every time for me.

  • Install the Print Server package to your JFFS2 partition
ipkg -d root install p910nd

Note: You may be tempted to install your ipkg software to a Samba mount point, USB flash/hard disk, SD card or some other place aside from the limited JFFS2 file system. This is of course your choice, and may seem the logical one, but there are several advantages to using the JFFS2 partition. For one, the JFFS2 partition always mounts. Being internal to the router, it is the most reliably detected and mounted file system at your disposal. Installing the Print Server and associated configuration pieces adds < 400K and regular usage entails no writes as far as I have observed.

  • The core of the Print Server is a single binary. Verify that the Print Server package installed the binary in the proper location.
root@DD-WRT:/# ls -l /jffs/usr/sbin/
-rwxr-xr-x    1 root     root         8563 Mar 26  2006 p910nd
  • Verify that dd-wrt Linux has detected your USB printer
root@DD-WRT:/# ls -l /dev/usb
crw-rw----    1 root     root     180,   0 Jan  1 00:00 lp0
root@DD-WRT:/#

Note: lp0 means line printer 0 was properly detected by the dd-wrt Linux kernel. So far, so good.

  • Set the Print Server binary to start automatically on boot with the correct command line parameters.
mkdir -p /jffs/etc/config
echo "/jffs/usr/sbin/p910nd -b -f /dev/usb/lp0 0" >  /jffs/etc/config/usb.startup
chmod +x /jffs/etc/config/usb.startup

Note: The contents of usb.startup will be executed automatically at boot, there is nothing you have to do to enable this, other than create the file and give it execute permissions (shown above)

  • Reboot the Router

Note: Before rebooting the router, unmount the jffs partition (umount /jffs) to make sure all changes have been committed to flash. I have found that a web GUI reboot does not always unmount the JFFS2 partition and I have experienced data loss.

Verify the Print Server is Running

  • SSH to the router
  • See if Print Server process is running
root@DD-WRT:/mnt# ps | grep p91
596 root       348 S    /jffs/usr/sbin/p9100d -b -f /dev/usb/lp0 0

and...

root@DD-WRT:/mnt# netstat -an | grep 910
tcp        0      0 0.0.0.0:9100            0.0.0.0:*               LISTEN

If it doesn't work, see this page for more detailed info (not all is relevant to the mega versions): USB printer sharing

Configure the Printer from a Windows/Linux Client

  • From Windows, go to Control Panel, Printers, Add Printer
  • Choose Local, create new port Standard TCP/IP Port
  • Set Device Type to TCP/IP
  • For Hostname or IP field, set to router IP
  • On Vista, do not query printer for driver
  • On next screen, click custom
  • Manually select the printer from list or select Have Disk to add a new printer driver
  • Note: On Vista, many newer HP Deskjet printers can be set to HP Deskjet 990c since no Vista drivers are available from HP.

Adding USB Storage

Obviously you wouldn't be here if you hadn't bought a router with TWO USB ports, so why not make the absolute best out of what you paid for? You can use many types of storage devices such as Hard disks and flashdrives.

It is important to understand that only Linux filesystems (ext2 or 3) and FAT are supported by this router.

If you just want to share your files over FTP or your network places, FAT will work fine. However, the benfits of Optware are the best thing since sliced bread!

To make the following work, you must format and partition the drive to a linux filesystem. I have made it as simple as possbile on how to do this, so don't give up! It doesn't take alot of technical skill and is fairly easy if you follow the directions.


NOTE ALL external harddisks MUST be self powered. Do NOT use a portable external! Flashdrives are fine. You can even use a USB hub to connect several devices to the router.


Frater's no hassle, newbie friendly Optware

This is the latest, greatest and easiest way to enable Optware on your Router and add a high degree of flexibility to it.


Please see Optware, the Right Way for a highly detailed walkthrough and instructions.



Services that will be installed:


  • Bash instead of shell in busybox (LFS support)
  • Automounting and unmounting of storage device partitions
  • Network printing
  • Torrent transmission with watchdog
  • Hotmount
  • Pre-configured samba share
  • Reverse proxy featuring pound
  • Service tool
  • Xinetd
  • Pound
  • Asterisk
  • Lighttpd
  • Vlighttpd
  • Countryblock
  • Services running as other users than root
  • Vim with proper terminal support
  • Twonky Media
  • News Server
  • Other various and useful tools

File Serving Overview

Now that you've added USB storage, you may want to share that storage with other computers on your network. The available protocols are:

  • SSH Server (works out of the box)
  • FTP Server
  • NFS Server
  • SMB/CIFS server (aka Samba)


Links

The ASUS WL-500g Premium v2 Wiki Page