OpenWRT on an Asus WL-HDD
This is what I did to get OpenWRT doing what I want on my Asus WL-HDD.
This is a description of what I did, it is not instructions. I make no claim that this will work for you - I'm not even sure it works for me. Understand the risks. You can easily "brick" your machine - that is completely stop it working, give it the properties of a brick. Really. You can. You will invalidate your warranty. If it breaks, no one will fix it. (But the folks at OpenWRT are helpful).
Are we ready? This is what I did:
- Understand the risks. I can't emphasise this enough. If the power goes off half way through, your WL-HDD will be useless.
- Download the firmware. I used the "bin" version, and the "SquashFS" flavour. Start here: Choosing the right firmware.
- Reset the WL-HDD to factory defaults. This is always a good idea when tweaking firmware, so the new firmware arrives in an environment it is expecting.
I used the Asus web interface, System settings, Factory Reset. The unit rebooted, factory defaults restored. This means the WL-HDD now had its default ip address of 192.168.1.220 - so I had to change the ip address of the laptop I was using to 192.168.1.10 to communicate with it. By the way, you really shouldn't use a wireless connection for anything to do with firmware flashing. You need the absolute best connection you can get between you and your target, and wireless is too risky. Ideally get a good quality, reasonably short wired connection directly between the two machines.
I used a wireless connection, through one floor and no walls, into a WRT54GS (running OpenWRT, natch), and then wired to the WL-HDD. This is a really bad idea. Use wire, not wireless, avoid any stops on the way (switches, routers, hubs). You need nothing to go wrong! Actually, don't do this at all.
-
Put the WL-HDD in "Failsafe mode". Shutdown the Asus, either through the browser interface - point your broswer at 192.168.1.220 (we reset to factory defaults, so we know it's there) - or by holding down the "Reset" button for about 5 seconds, until the green "WAN" light goes off. Once all lights are off:
- Unplug the power
- Press and hold the "reset" button
- Still holding the "reset" button, plug the power in
- When the power light flashes slowly, release the "reset" button
- Fire up the "Recovery utility" from the CD which came with the WL-HDD. This utility takes a firmware file you specify (such as the trx file you downloaded earlier) and sends it to the WL-HDD when it's in "recovery mode". The utility will find your HDD and send over the firmware.
- When the utility reports that it "succeeds", wait five minutes.
- Your WL-HDD has rebooted. Point your broswer at 192.168.1.220 and you will find a friendly welcome from OpenWRT. You can now breathe again, it's all worked.
-
Click on the category called "System" at the top of the page. OpenWRT will ask you for a password. Remember it! On this page, change the "Host Name" to something appropriate, and click "Save changes", and then "Apply changes".
Congratulations, you have just configured your custom firmware. Feels good, doesn't it?
-
Now we'll set up the WL-HDD to get it's network info from the existing dhcp server. For this we need to roll our sleeves up and edit some nvram settings, and some configuration files.
First let's set the nvram variable to tell the "lan" interface to use my dhcp server
To do this we need to get to the command line on the WL-HDD. I use PuTTY. Point PuTTY at 192.168.1.220 - and feed it the username root and the password you remember from earlier.
There's your prompt:
root@[whatever host name you choose earlier]:~#Type in
nvram set lan_proto="dhcp"
nvram commitMost times that would fix the setting, but due to a bug with the Linksys router, a configuration file has to set "lan_proto" to "static" at boot time, if you want to have a static ip address. As we don't, we have to edit the file to stop it changing our "dhcp" to "static".
Most of the configuration files on the firmware are just pointers (symlinks) pointing to the read only filesystem. To make our edits stick, we need to delete the symlink, and replace it with a writeable copy of the actual file.
The file we're after is "/etc/init.d/S05nvram" so type:
rm /etc/init.d/S05nvramto delete the symlink,
cp /rom/etc/init.d/S05nvram /etc/init.d/S05nvramto copy over a writeable version, and
vim /etc/init.d/S05nvramto start editting.
"vim" is a useful little text editor, there are others, but this is the one I use.
Use your arrow key to go down to the lines
# linksys bug; remove when not using static configuration for lan
nvram set lan_proto="static"Press "i" to enter "insert mode" and type a "#" before "nvram set ..."
Press the escape key to get out of "insert mode", and the ZZ (that is "shift" and two "z"'s) to save and exit.
Excellent! Type
rebootand plug the WL-HDD into your network, wait a couple of minutes, and it'll get it's network info and join the party.
Check your dhcp server's list of clients, and there it is.
-
Point your browser at your new ip address, head for "Network", then "Wireless", and fill in the appropriate settings. If you need "WPA" security, you'll need to install "nas".
Go to "System" then "Installed Software". Click on "Update package lists" in the top right, then find "nas" in the "non-free" section. Click install. Job done. While we're here, install "ntpclient". From the command line, put your favourite ntp server (I use uk.pool.ntp.org) in nvram variable "ntp_server".
-
Next job is to get the hard drive going, after all, that's the whole point of the machine. This wasn't so difficult. Following these instructions from OpenWRT made the drive appear. Except nothing appeared in "/proc/partitons". The drive is in: /dev/ide/host0/bus0/target0/lun0/disc .
Partition and format as per these OpenWRT instructions. Add an init.d script to mount it at boot, and you now have a whole load of storage space. Time to share the love.
-
This wasn't so easy. First I installed Samba - which was working fine on a WRT54GS - but it failed to start. I managed to get nmbd running, briefly, but never smbd.
So, nfs it is. This works. But not for Windows clients. However, mount the nfs on the WRT54GS with the running Samba, & Windows can see the WL-HDD. Magic. Not a very efficient way of doing things though.
Long term, it's not going to be a problem, as the goal of this project is to not have any Windows clients.
-
So now my Network Attached Storage is attached, let's see if it'll store. I have a couple of DVD iso's (Mandriva, since you ask) which need putting in a safe place. So off we go...
- Transferring using Samba -> WRT54GS -> nfs -> WL-HDD, fails at 1.99GB
- Direct nfs cp, fails at 1.99GB
- SCP transfer, fails at 1.99GB
- Install sftp, transfer using sftp, success!
Job done, finally.
Stangely, the wired lan port has stopped responding. Wireless is fine, so that'll do for now.
This is recommended.
This is useful.