What is it for?
This is a little "HowTo" for new Users of the Asus WL-500g Premium. It's a synopsis of my own experiences in setting up this box with Oleg's firmware "WL500gp-1.9.2.7-7f-pre4.trx". Thanks to Oleg fort his great work and thanks to all users of this forum, because almost every information I gathered comes from this site here (including the postings from macsat).
Comment: I tried to record every step of setting up the box, so I hope the amount of typos and principal faults is finite. And please be forbear with my grammar and orthography - English is not my native language..
In general: Any corrections, comments, improvements or suggestions are welcome!
2nd comment: principally you have to save every changes on flash fliesystem before you reboot with
Code:
flashfs save && flashfs commit && flashfs enable && reboot
but you can execute more than one of this sections and commit changes to flash at the end, unlike I write you have to flash.
To get access
First of all you've got to get access to your box. Therefore I use Putty, you can get it here: http://www.chiark.greenend.org.uk/~s.../download.html
If you didn't disabled telnet on the Asus-configuration site, you can access your box by opening a telnet-session with IP 192.168.1.1, Port 23, username "admin" and password "admin" (if you haven't changes yet, but you should).
Now you are connected to your box. You can try some commands to play a bit around: top, ps, df, free...
Install ssh-deamon
So, you have access, but with telnet this connection is not encrypted, so we will establish a ssh-connection. Therefore we need to install dropbear.
Create the dropbear-directory:
Code:
mkdir -p /usr/local/etc/dropbear
Generate dropbear-keys; it may take a few seconds:
Code:
dropbearkey -t dss -f /usr/local/etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /usr/local/etc/dropbear/dropbear_rsa_host_key
Create the script-directory:
Code:
mkdir -p /usr/local/sbin/
Create the post-boot script-file
Code:
echo "#!/bin/sh" >> /usr/local/sbin/post-boot
Mark post-boot-file as executable:
Code:
chmod +x /usr/local/sbin/post-boot
Start dropbear in post-boot-script:
Code:
echo "dropbear" >> /usr/local/sbin/post-boot
You can start dropbear manually to try it out, but we have to reboot anyway:
Save changes in flash and reboot:
Code:
flashfs save && flashfs commit && flashfs enable && reboot
Extend RAM to 32MB
After flashing Oleg's FW on your box, it has by default 16MB RAM, but on the PCB are 32MB. By changing some NVRAM variables you can make the hole 32MB RAM accessable.
Attention! This just works with Premium boxes! Use this section on your own risk! It can damage your box! You shouldn't change the nvram variables with a Premium V2!!!
Code:
nvram set sdram_init=0x0009
nvram set sdram_ncdl=0
nvram commit
reboot
You can check the success by typing
Prepare USB-HDD
If you want to connect a USB-HDD to you box and make it accessible by network you have to partition your HDD and create a linux-accassible filesystem (ext3). For that matter we can create a swap-partition.
О made the decision to create one big primary partition for data and one little partition at the end of the disk for swap.
Run the partition program by typing
Code:
fdisk /dev/discs/disc0/disc
Fdisk is self-explaining, type m to view the help-page. When you are finished, don't forget to save changes with the w-command before you exit fdisk.
After partition your disk, it's time to create filesystems
Code:
mke2fs -j /dev/discs/disc0/part1
mkswap /dev/discs/disc0/part2
We already created the post-boot scriptfile, now we can create several others too.
Code:
touch /usr/local/sbin/post-firewall
touch /usr/local/sbin/post-mount
touch /usr/local/sbin/pre-shutdown
chmod +x /usr/local/sbin/*
Netx we will modify the post-boot-script with the vi-editor. I wouldn't say it's self-explaining but with a few commands you can use it. With "i" you get into editor-modus, with [ESC] you leave it. With ":wq!" you quit the editor by saving your file. For further information about vi visit http://lug.boulder.co.us/docs/vi_vim_howto.html
Code:
vi /usr/local/sbin/post-boot
Add the following lines to post-boot file:
Code:
#Wait for /opt to mount
mount /dev/discs/disc0/part1 /opt
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc ]
then
break
fi
sleep 1
i=`expr $i + 1`
done
# Activate swap
swapon /dev/discs/disc0/part2
# Run all active services - active means starts with S
/opt/etc/init.d/rc.unslung
Save changes in flash and reboot.
Code:
flashfs save && flashfs commit && flashfs enable && reboot
Initiate ipkg and install nano, screen, midnight commander
With ipkg there exists a package-system which enables you to easily install additional software-packages. Available packages und information about them you can find here: http://ipkg.nslu2-linux.org/feeds/unslung/wl500g/, http://ipkgfind.nslu2-linux.org/
So, make the necessary dirs and install and update ipkg:
Code:
mkdir /opt/tmp
mkdir /opt/tmp/ipkg
ipkg.sh update
ipkg.sh install ipkg
ipkg update
Now you are able install useful software, for examle nano, a nice, easy to use editor:
Install the terminal-multiplexer screen, a nice tool to handle several terminal-sessions:
Code:
ipkg install screen
Some useful commands for screen are:
Code:
C-a c create
C-a n next
C-a p previous
C-a # #=number of screen beginning with 0
C-a A give a name
C-a " list
C-a K kill
C-a d detatch
screen -r reattach
C-a S split horizontally
C-a X kill 2nd region
In which e.g. "C-a" means to press [ctrl] and [a] at the same time. For further information see: http://www.slac.stanford.edu/comp/unix/package/epics/extensions/iocConsole/screen.1.html
Install midnight commander, THE file-browser:
Midnight commander won't rum without a few lines in the post-boot script:
Code:
nano /usr/local/sbin/post-boot
So add to post-boot-file:
Code:
#to let midnight commander run on terminals, make alias for colored mc
echo "export TERMINFO=/opt/share/terminfo">>/etc/profile
echo "alias mc=\"mc -c\"">>/etc/profile
Install cron, a daemon to run scripts by scheduler:
With cron it is possible to let script-files periodically run, accordingly to its directory in which it is saved.
Code:
mkdir /opt/etc/cron.5mins
mkdir /opt/etc/cron.hourly
mkdir /opt/etc/cron.daily
mkdir /opt/etc/cron.weekly
mkdir /opt/etc/cron.monthly
Now you have to edit the crontab-file:
Code:
nano /opt/etc/crontab
and add the following lines:
Code:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
# Syntax for lines is : minute hour day month dayofweek command #
*/5 * * * * admin run-parts /opt/etc/cron.5mins
0 * * * * admin run-parts /opt/etc/cron.hourly
0 0 * * * admin run-parts /opt/etc/cron.daily
0 0 * * 0 admin run-parts /opt/etc/cron.weekly
0 0 1 * * admin run-parts /opt/etc/cron.monthly
It's just an example. To understand how cron works, search for a cron-howto. I didn't used it copious, but I think it works (note: you need cron for the torrent-package). As you can see in the run-parts-script, I have this from macsat, but I modified the crontab-file.
So, we have to create the run-parts-script:
Code:
nano /opt/bin/run-parts
Fill it with the following lines:
Code:
#!/bin/sh
#
# runparts.sh by macsat@macsat.com
# intended for use with cron
#
# based on rc.unslung by unslung guys :-)
#
if [ -z "$1" ]
then
echo "Usage : $0 "
fi
RUNDIR=$1"/*"
for i in $RUNDIR ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
And make the script executable:
Code:
chmod +x /opt/bin/run-parts
Save changes in flash and reboot:
Code:
flashfs save && flashfs commit && flashfs enable && reboot
[edit@20060725] typos..
[edit@20080827] nvram variables with Premium V2