OpenWRT

Current version is Backfire 10.03.1-rc5 (as of July 2011). Many instructions below are outdated. Also, x-wrt is now dead - but OpenWRT has very good web interface.

How to set up Kamikaze 8.09

Updated February 15, 2010

A lot of bugs reported below have been fixed in 8.09.2

Updated May 15, 2009

Prerequisites:

Installation instructions. Since I already had 8.07 before, I used mtd command-line tool (note that the image is from x-wrt):

cd /tmp/
wget http://downloads.x-wrt.org/xwrt/kamikaze/8.09_RC2/brcm47xx/extra/openwrt-brcm47xx-squashfs.trx
mtd write openwrt-brcm47xx-squashfs.trx linux && reboot

However, it didn't work. So, I had to use tftp (Currently, the link goes nowhere. OpenWRT folks are redesigning their Wiki). I read that 2.6 kernel is now supporting most of wireless functionality (all that I need, anyway). So, it's time to upgrade kernel as well!

ping -t -w 10 192.168.1.1
tftp -i 192.168.1.1 put openwrt-brcm47xx-squashfs.trx
Firmware OpenWrt Kamikaze - With X-Wrt Extensions 8.09
Kernel Linux 2.6.25.17 #1 Tue Apr 28 06:00:05 CDT 2009
MAC **:**:**:**:**:**
Device ASUS WL-500g Premium
Board Broadcom BCM47XX
Username root

Web mgt. consoleWebif²
Versionr4743

Or, you can get the code from the "trunk" (bleeding edge) executables:

cd /tmp/
wget http://downloads.x-wrt.org/xwrt/kamikaze/snapshots/brcm47xx/extra/openwrt-brcm47xx-squashfs.trx mtd write openwrt-brcm47xx-squashfs.trx linux && reboot

Additional packages

qos-scripts 1.2.1-1 QoS - or else the phone won't work
ntpclient 2007_365-1 To keep the time up to date
vsftpd 2.0.6-2 Very secure FTP server

Note: qos-scripts and ntpclient are included in the "extra" firmware

OpenWRT firewall doesn't allow pings from the WAN. The best way would be to change the settings in X-Wrt Firewall screen, but it has a bug in that it doesn't recognize ICMP protocol. Worse, it sets the protocol to TCP in case you make any changes afterward. So, you can make the changes directly in /etc/config/firewall:

config 'rule'
	option '_name' 'ping'
	option 'src' 'wan'
	option 'target' 'ACCEPT'
	option 'src_ip' ''
	option 'dest_ip' ''
	option 'dest_port' ''
	option 'proto' 'icmp'
Remember, though, that due to X-Wrt bug option 'proto' will be reverted to tcp every time you make the changes through X-Wrt GUI. If that's too much to remember, you can modify /lib/firewall/uci_firewall.sh. Comment out the following line in fw_defaults:
$IPTABLES -A reject -j REJECT --reject-with icmp-port-unreachable
If that is not enough (should be enough, though!) - add the following line to addif() function:
$IPTABLES -A INPUT -p icmp -j ACCEPT

Installation instructions for setting up USB drive

Section 1 - mounting, partitioning and formatting USB drive. I didn't create a bootable USB stick; and I read somewhere else that it doesn't work on Kamikaze anyway

If you are doing an upgrade and the drive is already prepared, then only the following steps apply:

opkg update
opkg install kmod-fs-ext2 kmod-fs-ext3 fdisk e2fsprogs kmod-usb2 kmod-usb-storage

Note: ipkg changed to opkg. Not sure what is the difference (besides the name), but use opkg to install packages

Installation doesn't start the modules, so I just rebooted the router

mount -t ext3 -o rw /dev/sda /mnt

To avoid headache in the future make the following changes in /etc/profile

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/bin:/mnt/usr/sbin
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/usr/lib:/mnt/lib

Section 5 - setting up Samba

ipkg install samba-common samba-server

Add the following line to /etc/hosts

192.168.1.1 openwrt

There is still plenty of space on the router

Filesystem                Size      Used Available Use% Mounted on
rootfs                    2.0M      2.0M         0 100% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    14.7M    176.0k     14.5M   1% /tmp
tmpfs                   512.0k         0    512.0k   0% /dev
/dev/mtdblock3            4.9M      2.0M      2.9M  41% /jffs
mini_fo:/jffs             2.0M      2.0M         0 100% /
/dev/sda                 29.4G    172.9M     27.7G   1% /mnt

Everything else will be installed on the external drive. Here are the instructions. 8.09 has a bug that prevents installing large packages on the USB drive. fortunately, there is a workaround (Hat tip: crow): add a line option overlay_root /mnt to /etc/opkg.conf

  • lighthttpd. Instructions here. After firmware upgrade, reestablish the following links.
  • echo 'OPTIONS="-f /mnt/etc/lighttpd.conf"' > /etc/default/lighttpd
    ln -s /mnt/etc/init.d/lighttpd lighttpd
    ln -s /mnt/usr/lib/lighttpd lighttpd
  • php5. Instructions here. Note to self: php.ini is retrieved from /etc; if php is installed to the external drive - don't forget to link appropriately: ln -s /mnt/etc/php.ini /etc/php.ini

    Didn't work on 8.09. Here are the instructions about workaround:

    dd if=/dev/zero of=/mnt/php.swp count=100000
    mkswap php.swp
    swapon php.swp
  • SVN client. Didn't encounter any problems.
    Unfortunately, it seems that 8.09 is missing ra-dav library. Because of that, I can't svn from http server :(

So, 8.09 installation was much more problematic than I expected. Hopefully it will be fixed soon.

Note: After reboot run swapon and start lighttpd. Everything else seems to start properly