The Linksys WRT54G is one of the best router you may find. Why? Because you can install OpenWrt on it Wink. Here is how to install OpenWrt White Russian RC4 in a few steps on a WRT54Gv2.

Prior to firmware upgrade

The WRT firmware can be updated using a TFTP transfer at the very beggining of the router startup sequence. This is a very short time interval so we will first exend it by changing the "boot_wait" variable stored in the router nvram memory.To do so, we will use a little hack in the web admin interface.

First, open a session into the admin interface:

http://192.168.1.1 (login: admin, password: admin)

First lets give the router a fixed IP address. Open the menu "Setup -> Basic setup" and set these values:

Static IP
Internet IP address 10.0.0.1
Subnet mask 255.0.0.0
Gateway 10.0.0.2

Then open the ping tool from "Administration -> Diagnostics -> Ping" and type these 4 commands:

;cp${IFS}*/*/nvram${IFS}/tmp/n
;*/n${IFS}set${IFS}boot_wait=on
;*/n${IFS}commit
;*/n${IFS}show>tmp/ping.log

The last command should produce some verbose output. Make sure it contains a line "boot_wait=on".

Firmware upload

Get the latest version of the OpenWrt firmware.

~$ wget http://downloads.openwrt.org/whiterussian/newest/default/openwrt-wrt54g-squashfs.bin

Then install tftp to transfer the firmware to the router.

~$ apt-get install tftp

Now let's prepare the tftp connexion.

~$ tftp 192.168.1.1
tftp> binary
tftp> rexmt 1
tftp> timeout 60
tftp> trace
Packet tracing on.

Make sure the network interface you're using on your host has a fixed IP and reboot the router. Just after than, fire the command:

tftp> put openwrt-wrt54g-squashfs.bin

[...]
sent DATA <block=3019, 0 bytes>
received ACK <block=3019>
Sent 1545216 bytes in 5.6 seconds

Once the transfer is complete, you have to wait for the router to reboot. If it doesn't reboot, wait for at least 5 minues prior to do a manual reboot.

First connexion

A freshly installed OpenWrt is only available throught a telnet connexion:

~$ telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
=== IMPORTANT ============================
Use 'passwd' to set your login password
this will disable telnet and enable SSH
------------------------------------------


BusyBox v1.00 (2005.11.23-21:46+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

As said in the disclaimer, let's set a password for root.

~$ passwd
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
Password changed.

Once password is changed, we can close the telnet session. OpenWrt is now installed and ready to use over ssh. Enjoy Wink !