I recently bought me an Asus WL-500g and a LaCie 200Gb mobile harddrive (USB2.0). I intented to use them as router (DUH) and as samba-storage on my home network. Speed wasn't really an issue, so that the Asus uses USB1.0 instead of 2.0 i can live with. Maybe, in a year or so, I'll replace it with an Asus version which has USB 2.0.
Anyways, on installing the 'damn' thing I encountered many small problems. Thanks to this forum, i overcame them all, but it took some search effort. Especially 'the little facts' are scattered all over the place, making something which i think is very common (using your router as a router and attaching storage to it) harder than it needs to be.
Therefore I made this post. Goal of this post is to explain how to accomplish attaching your asus as a router with storage, including all the little details.
In this howto I assume you got the router bit working already, and know how to set it up again, if needed. If not, you might start working on that first Also I do not take any responsibility; if you screw over your asus, your computer or your harddrive (or anything, for that matter) I'm not responsible. Use at your own risk.
First thing that becomes obvious after the installation of the WL500G is that the Asus firmware just doesn't cut it, at least not if you want to use Samba (Samba = windows based file sharing). I knew it was possible, since I researched that subject before purchasing the device. So I came here, and downloaded one of Oleg's excellent firmware images, to be precise, i downloaded this one:
(choose the one applicable for your device)
Then to upgrade the firmware. Step one is to reset your router to factory defaults. I didn't do this at first go, and got stuck with a router that wouldn't respond (luckily pressing the reset button like 6 seconds did the trick). To reset the router to factory defaults, visit the router homepage (usually http://192.168.1.1), select 'system setup', then select 'factory defaults' and click the 'restore' button.
Note that this will most likely lose you your internet connection, so if you're planning on using guides from the internet (like this one), have them open in your browser, or print them.
After your router comes back up (you might have to re-establish the connection yourself, see the last part of this howto for an explanation), go to the homepage again, select 'system setup', then select 'Firmware Upgrade'.
click the 'browse' button, select the firmware you downloaded, and click 'upload'. Your router will now upload and install the firmware, this might take a minute or so.
After your router is back up, visit the homepage again. Go back to 'system setup', select 'Firmware Upgrade' and check if the numbers given correspond with the version you uploaded. If so, the firmware is succesfully updated. If not, you might want to try again.
Now restore the settings needed for your internet connection, and save them. Also, if you want to use samba, enable the FTP under the 'USB Applications' section in the web interface. Though this is not strictly needed, without doing this the smb.conf doesn't exist.
The new firmware comes with a telnet and ssh daemon. Telnet is a simple command-line interface. You can use it by doing 'start->run->telnet 192.168.1.1'. SSH is basically the same, but then over a secure channel. To use SSH on windows, i recommend downloading putty.
Before you can use SSH, you need to generate 'keys'. These are used to encrypt the connection. To do so, telnet to your router. Log in as 'admin' with password 'admin'. Type the following to generate the keys:
After this, the SSH daemon is running and you can connect to it with putty. Notice that we haven't saved these changes yet, so if you reboot your router now, you lose these settings. To save settings, do:
mkdir -p /usr/local/etc/dropbear
dropbearkey -t dss -f /usr/local/etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key
mkdir -p /usr/local/sbin/
echo "#!/bin/sh" >> /usr/local/sbin/post-boot
chmod +x /usr/local/sbin/post-boot
echo "dropbear" >> /usr/local/sbin/post-boot
Connecting the remote storage (USB HDD/USB-stick/etc) is the next step. Simply plug in the device. Now for some thoughts on file-systems. Most likely your device is formatted with the NTFS filesystem. Though linux does have write support for NTFS (in contradiction to what i've seen people say on this board), the write support wasn't enabled in the firmware. So if your drive uses an NTFS filesystem, you won't be able to write to it. The logical choice for filesystem would be EXT2 or EXT3, since they are the native linux filesystems. Drawback of this would be that you can't use your USB HDD on a windows machine anymore. If the device is smaller than 32Gb, you could format it with a 'FAT32' filesystem. Both windows and the Asus can use this filesystem, and read/write from/to it. The easiest way to do this, is to connect your drive to your windows system and format it, choosing 'FAT32' as file system.
If your device is bigger than 32Gb however, you can't use FAT32 for the whole device, since FAT32 has a limit of 32Gb. You could create several 32Gb FAT32 partitions (use windows to do this), or you could do what i did: create one 32Gb Fat32 partition, and use the rest as an EXT3 partition. That way you don't get a lot of partitions, but you will be able to use your device on both windows and the asus (note: on windows you'll only be able to use the 32Gb partition).To do this, connect the device to your Asus router and do the following:
fdisk is the disk partitioner linux uses. use 'p' to print out the partition table, use 'n' to create a partition, use 'd' to delete a partition, use 'w' to write the partition table to the disk and use 'q' to quit fdisk. The /dev/scsi[..] part tells fdisk where your disk is. First print all partitions using 'p'. Notice the partitions have numbers. Then use 'd' to delete the partitions. After deleting all the partitions, first create your 32Gb windows partition. Type 'n', select 'primary', press enter (start block=1), type +32000M as the end block. This will result in a partition roughly 30Gb big. Now create another partition, select 'extended' and press enter on all questions. Then create the ext3 partition, by selecting 'n', 'logical' and press enter on the size questions. Then save your work by typing 'w' and quit fdisk by typing 'q'.
Your disk has now been partitioned, but the Asus kernel doesnt know this. To let it know, reboot your device. You can do this by typing 'reboot' at the command prompt. Notice that unsaved changes will be lost, so it might be wise to save your changes (see above on how to do that). Fdisk changes won't be lost.
After your router is rebooted, telnet of ssh back into it. Now to format the partitions. The trick to this is that the Asus doesn't have enough memory to format the biggest partition (at least, it didn't for my 200Gb drive). To be able to format this partition, you need to create a swap. You can temporarely use the windows partition to do this. Type:
Now we'll create a ext3 file system on the logical partition:
Depending on the size of your disk, this might take a while. After this is done, you can use the partition. To format the 30Gb windows partition, the most easy way is to connect the drive back to your windows computer, delete the swap partition and create a primary partition. Be sure to format it as FAT32!. (you can do this by using the disk manager, start->settings->control panel->administrative tools->computer management->disk manager).
mke2fs -j /dev/scsi/host0/bus0/target0/lub0/part5
Now that your drive is partitioned and formatted, the asus will be mounting the two partitions automatically. If you telnet to the device, you'll vind there's a 'harddisk' in the /tmp/ folder. This contains the first (FAT32) partition. In this harddisk folder there's also a subdirectory called 'part1', containing your second (EXT3) partition.
Now to enable Samba (=windows file sharing). Edit your smb.conf by typing
Vi is an editor. If you want to start typing into the file, press the 'i' key (=insert) on the location where you want to add stuff. If you're done typing press the <ESC> button to get back to command mode. To save your work, type :w. To exit vi, type :q. To exit without saving, type :q!.
Probably the easiest thing to do is to just erase any existing config. Then start by typing in:
this section contains the global parameters for your samba setup. Replace <workgroup name> by the name your windows workgroup uses. If you're using windows 98 or older, you might want to set 'encrypt passwords' to no.
workgroup = <workgroup name>
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 1
max log size = 100
encrypt passwords = yes
dns proxy = no