banner


This page contains information about getting the Adhoc On-demand Distance Vector (AODV) Routing protocol on the Linksys WRT54G wireless broadband router. AODV is a reactive routing protocol for wireless adhoc networks. The WRT54G is a wireless broadband router solution that runs Linux and supports the IEEE 802.11 adhoc mode.  It is available for under $70 at most retail websites. Moreover, its easy to turn the WRT54G into a wireless mesh box. This enables one to create an economical wireless mesh network in quick time. Given below are a set of instructions on transforming a stock WRT54G device into a wireless mesh box that uses AODV for routing within the mesh.

Overview

To install AODV on the Linksys WRT54G, please follow the following four steps:
1) Upload a Linux firmware on the router.
2) Configure the router.
3) Cross-compile AODV for the MIPS processor.
4) Execute AODV.

Step 1: Firmware Installation

I recommend using the openwrt firmware for running AODV. The openwrt project has created a simple, no-frills Linux distribution for the WRT54G. Because the openwrt firmware offers only the bare minimum to run Linux on the WRT54G, you can customize the base installation however you require. Offcourse, openwrt is not the only distribution to support the WRT54G. Other distributions are available such as ones from Sveasoft. Sveasoft's distribution is kinda neat because it comes bundled with a bunch of additional software. However, their firmware offers more than I need. I wanted something light-weight and easily manageable and therefore I choose the openwrt firmware. From what I read online, people have successfully executed AODV using the Sveasoft firmware. So, if you need to use the Sveasoft firmware, please search for it.

As for the choice of the openwrt firmware, I used their stock firmware available here. Since openwrt updates their distribution on a daily basis, the version you choose will be different from the version I use. If you want to in stead proceed with the firmware I use, you can download my version from here. In any case, I would highly recommend that you compile the firmware from the sources because you will need the mips cross-compiler, available as part of the source package, to compile AODV for the WRT54G. Check the openwrt user-guide for instructions on compiling the firmware from the source.

After successfully compiling the firmware, you need to install your choice of the openwrt firmware on your router. The best way to do this is to use the html based management interface offered by the factory-default Linksys firmware. Click on the "management" tab on the main html page and then click on the "firmware upgrade" link to install the openwrt firmware. Comprehensive instructions on howto install the openwrt firmware are available on this openwrt web-page. It is very important that you turn on the "boot_wait" nvram setting on the router before the upgrade or else you may end up with bricking your device due to a faulty firmware. Here is an excellent page on debricking your WRT54G.

Step 2: Device Configuration

Once you have installed the openwrt firmware on device, the next step is to configure the device to operate in adhoc mode. Before the device configuration, might I also recommend that you install the dropbear ssh package on the device. Here is a handy page with installation instructions and some getting started tips.

Now, lets get straight to the device configuration. First, you need to telnet/SSH into the box. Next, you have the choice of using the br0 interface or disabling it. This interface bridges the lan ports and wireless interface as a virtual br0 inteface, which means that both the lan and the wireless share the same IP range. This may be required when you use the WRT54G as an access point. However, when operating the device in adhoc mode, this feature is probably not required. I have disabled the br0 interface on my device, and you can do this by executing the following commands:

    nvram set lan_ifname=vlan0
    nvram unset lan_ifnames  
    nvram set wifi_ifname=eth1
    nvram commit

The first command, above, sets the lan_ifname NVRAM setting to the lan interface vlan0 instead of br0. It then sets the wireless interface to interface eth1.To configure the wireless interface to operate in adhoc mode, execute the following commands:

    nvram set wifi_proto=static
    nvram set wifi_ipaddr=<adhoc IP address>
    nvram set wifi_netmask=<netmask>
    nvram set wl0_mode=sta
    nvram set wl0_infra=0
    nvram set wl0_ssid=<adhoc essid>
    nvram commit

The above commands configure the wireless interface on the WRT54G to operate in adhoc mode. At this point, you should reboot the router and check if you can ping another device operating in adhoc mode on the same essid. If all is well, proceed to the next step. If you are not able to ping the other device, something is obviously wrong, and you need to troubleshoot the problem. The best way to check if your interface is correctly configured is to run iwconfig eth1 on the router as a first step. A typical iwconfig command output should look similar to this:

    root@WRT54G:~# iwconfig eth1

    eth1      IEEE 802.11-DSF  ESSID:"aodv-mesh"
              Mode:Ad-Hoc  Channel:11  Cell: 02:02:11:D9:96:7F
              Bit Rate:1Mb/s   Tx-Power=15 dBm
              Retry limit:0   RTS thr:off   Fragment thr:off
              Encryption key:off
              Link Quality:1/5  Signal level:-80 dBm  Noise level:-256 dBm
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Of interest in your command output are the fields marked in red above. The values for the four fields on the two devices should be the same. If they are not, check to make sure that you configured both devices correctly. If the values for the four fields are the same, the next thing to do is to ensure that you have no firewalls rules that are blocking ICMP packets. Another option you can try out is to run a packet sniffer to see whats being exchanged between the two devices on the wireless channel and then to proceed from there.

Step 3: AODV Compilation

I use the NIST implementation for most of my work, which is why I describe the procedure to compile that package for the WRT54G. I recently modified this AODV implementation and the protocol itself to support a reliability based metric. The enhanced protocol is called AODV-ST. More information about AODV-ST can be found here. I would recommend that you use AODV-ST instead of AODV for two reasons: (1) AODV-ST extends AODV through the support of routing metrics, and (2) the AODV-ST implementation addresses some bugs/issues with the NIST AODV implementation. If you are looking for AODV only, you can use either the NIST AODV implementation or one of the others indexed here. If you are using AODV-ST, please note the caveat specific to the WRT54G on the download page for AODV-ST.

Assuming that you are using either the NIST or the AODV-ST implementation, you will need to modify the Makefile in the package to contain the correct path information of the mips cross-compiler. Given below is a diff of the modified Makefile and the original Makefile.

    19c19
    < TARGET:=mipsel
    ---
    > TARGET:=x86
    44,46c44,46
    <       CC := <BASE_DIR_PATH>/openwrt/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-gcc
    <       LD := <BASE_DIR_PATH>/openwrt/buildroot/build_mipsel/staging_dir/bin/mipsel-linux-ld -r
    <       KPATH := <BASE_DIR_PATH>/openwrt/buildroot/build_mipsel/WRT54GS/release/src/linux/linux/include
    ---
    >       CC := mipsel-linux-gcc
    >       LD := mipsel-linux-ld -r
    >       KPATH := /data/kernel/mips-2_4/include

Next, you can compile the aodv module by running make. Thats all there is as far as compiling aodv is concerned.

Step 4: AODV Execution

Before you can run AODV, you need to copy AODV onto the linksys device. Use either scp or wget to copy the kernel_aodv.o (or aodv-st.o) file to the device. To execute AODV, simply run the following command:

    insmod the_aodv_module use_dev=eth1

Thats it! Everything should be hunky-dory now! Enjoy your new AODV mesh box!


Last Updated: 02/12/06
Contact: Krishna Ramachandran (krishna AT cs ucsb edu)