Wireless Mesh Networking with WRT54G and OLSR

Background

I was sending a file to a friend who lives a block away and it took a while due to the uplink bandwidth limit. There was no way to get around that besides sending the file via an internal network. A wired network was out of the question. The next best thing was wireless mesh networking. This is a project to build and analyze the performance of a working wireless mesh network using the Optimized Link State Routing protocol.

Setting up OLSR using a Linksys WRT54G router on the DDWRT 2.4 SP2 firmware

A very detailed guide with screenshots of how to do this can is located at http://sites.google.com/a/uprm.edu/ccli/Home/testbeds-1/wireless-mesh-network-testbed-using-wrt54gl-dd-wrt-and-olsr

Due to the implementation of OLSR requiring the isolation of the WIFI interface, most of the functionality (DHCP, QOS, etc) that can be configured through the web interface will no longer work.

Routing Internet to Clients

Once an internet accessible link is plugged into the WAN port, OLSR will automatically discover it and update the routing table.

Setting up NAT

1
2
3
iptables -t nat -A POSTROUTING -o $(nvram get wan_ifname) -j MASQUERADE
iptables -t nat -A POSTROUTING -o $(nvram get wl0_ifname) -s $(nvram get eth1_ipaddr)/$(nvram get eth1_netmask) -d $(nvram get eth1_ipaddr)/$(nvram get eth1_netmask) -j MASQUERADE
iptables -t nat -A POSTROUTING -o $(nvram get lan_ifname) -s $(nvram get lan_ipaddr)/$(nvram get lan_netmask) -d $(nvram get lan_ipaddr)/$(nvram get lan_netmask) -j MASQUERADE

http://www.dd-wrt.com/wiki/index.php/Mesh_Networking_with_OLSR

Setting up DHCP on Isolated Wifi (eth1) Interface

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
iptables -I INPUT -i eth1 -p udp --dport 67:68 --sport 67:68 -j ACCEPT
iptables -I INPUT -i eth1 -p udp --dport 53 -j ACCEPT
killall -q -9 dnsmasq
sed /^interface.*/d /tmp/dnsmasq.conf > /tmp/dnsmasq.conf.new
echo -n "
pidfile /var/run/udhcpd.pid
start 10.1.1.50
end 10.1.1.100
max_leases 50
interface eth1
remaining yes
auto_time 30
lease_file /tmp/udhcpd.leases
statics_file /tmp/udhcpd.statics
option subnet 255.255.255.0
option router 10.1.1.1
option lease 86640
option dns $(nvram get wan_dns)
"
> /tmp/udhcpdeth1.conf
udhcpd /tmp/udhcpdeth1.conf

taken from http://www.dd-wrt.com/wiki/index.php/Separate_Lan_and_WLan

DHCP requests are not propagated in AD-HOC mode; therefore, each node must provide its own set of IP’s.

Removing Generated Filters

On some versions of DD-WRT, namely the micro version on WRT54G V5 and V6, there are some generated DROP entries in iptables that prevent proper routing. Remove those entries by,

1
iptables -F INPUT

http://www.olsr.org/
http://www.dd-wrt.com/wiki/index.php/Development
http://www.bitsum.com/firmware_mod_kit.htm

Leave a Reply

Your email address will not be published. Required fields are marked *