2009-01-04

OpenWRT on Linksys WRT350N

My Linksys WRT350N wireless router started locking up more frequently recently, requiring a power cycle to reset it. When this started happening every day, I decided to re-flash it with OpenWRT and replace the buggy Linksys v1.03.7 firmware last updated in 2007.

I made the mistake of installing a pre-built Kamikaze 8.09 RC1 image (openwrt-wrt350n_v1-squashfs.bin) using the upgrade webpage on the router. When the router rebooted itself the Power LED flashed continuosly for a couple of minutes and then stayed on, but the ethernet switch was not functioning.

TFTP
The router responded to pings on 192.168.1.1 for the first few of seconds after the router was powered up. This indicates that that the bootloader was functional and sending a new firmware image using TFTP should work. See Installing OpenWRT via TFTP
echo -e "binary\nrexmt 1\ntimeout 60\ntrace\nput openwrt-wrt350n_v1-squashfs.bin\n" | tftp 192.168.1.1
Unfortunatly this didn't work for me, the transfer would complete successfully but the router didn't appear to recover or reflash itself with the new image.

Serial Port
The only option left was to add a serial port and gain access to the bootload console. This wepage has instructions on Modding the Linksys WRT350N v1 and WRT350N External Serial shows a way to access the serial port via the WAN port. Several Linksys models have this special serial port connector on the WAN port, but there don't seem to be any connectors sold for it. So I ended up opening the case and soldering on a header and custom cable - yuk. Armed with an RS232 level converter and USB serial adaptor I got a serial console running and access to the bootloader.

Bootloader
When the router boots it outputs the bootloader and kernel console info on the serial port (115200 baud, 8bits, no parity). With access to the bootloader I was able to tftp and flash a new image. Simple really.

echo -e "binary\nrexmt 1\ntimeout 60\ntrace\nput openwrt-wrt350n_v1-squashfs.bin\n" | tftp 192.168.1.1
CFE> flash -ctheader : flash1.trx
CMD: [flash -ctheader : flash1.trx]
Reading :: upgrade_ver[v1.4.1] upgrade_ver[10401] 4712_ver[0]
Done. 3215392 bytes read
fname=flash1.trx
CODE Pattern is correct! (EWCG)
Programming...done. 3215360 bytes written
*** command status = 0
Configuration
OpenWRT has lots of configuration options, more than most routers. My favorite features include being able to assign a dhcp assigned IP address to a particular MAC address and then give this IP address a host name. Now I can browse to my PAP2 VOIP box using "http://voip/" from any computer on my network. No more typing in IP addresses.

Software Packages
Now that it was booting and I could log in via telnet and the web interface, I was able to cross-compile more packages from OpenWRT and install them. First off the line was dropbear ssh server, install my ssh key, and disable telnet and ssh password logins. Extra packages include statistic charting using collectd.


Conclusion
My router has been running OpenWRT software for over a month now and has been doing a fantastic job. There is still room for improvement and polish, but everything just feels solid.

Update 2012-12-22
The latest OpenWRT version called "attitude adjustment" does not work - the kernel panics during boot.  I was trying to use 12.09-rc1 openwrt-wrt350n_v1-squashfs.bin from the OpenWRT website.