User Tools

Site Tools


wibed:example_mesh

Routing mesh experiment using 11s and bmx6

In this example the overlay experiment contains two scripts named “prepare.sh” and “test.sh”.

The prepare.sh script must be execute once the experiment is deployed by executing the command “sh /root/prepare.sh”. It downloads and install the L3 routing daemon bmx6 and configures two new virtual WiFi interfaces using 802.11s as link layer (forwarding is disabled).

Then the test.sh script is executed every 5 minutes to count the number of nodes available in the new network managed by 11s and bmx6. The output is saved in the directory /save

Be aware that we don't touch the management network (radio0 → mgmt0), we don't change channels or anything else which may cause a failure in the management network.

The overlay file can be found here: wibedoverlay_11s_bmx6.tar.gz

/root/prepare.sh

#!/bin/sh
### CONFINE WIBED EXPERIMENTS SCRIPT ###
### Unicast experiments ###

hostname=$(cat /proc/sys/kernel/hostname)
ip="$(ip addr show dev br-mgmt | grep inet | awk '{print $2}' | cut -d. -f4 | cut -d / -f1 | awk NR==1)"
ip6="$(cat /sys/class/net/br-mgmt/address|cut -d: -f6)"
ids="0 1"

if ! opkg list-installed | grep bmx6; then
	echo "Installing bmx6"
	opkg install http://wibed.ac.upc.edu/wibed/misc/bmx6.ipk
fi

printf "Starting prepare script for $hostname\n"
set -x
devs=""
for i in $ids; do

	uci set wireless.radio$i.disabled=0
	
	uci set wireless.mesh$i=wifi-iface

	uci set wireless.mesh$i.mode=mesh
	uci set wireless.mesh$i.mesh_id=wibed
	uci set wireless.mesh$i.mesh_fwding=0
	uci set wireless.mesh$i.ifname=mesh$i
	uci set wireless.mesh$i.device=radio$i
	uci set wireless.mesh$i.network=mesh$i
	
	uci set network.mesh$i=interface
	uci set network.mesh$i.proto=static
	uci set network.mesh$i.ipaddr="1.1.$i.$ip"
	uci set network.mesh$i.netmask="255.255.255.0"
	uci set network.mesh$i.ip6addr="2012:0:$i:$ip6::1/64"
	devs="$devs dev=mesh$i"
done
	
uci commit wireless
uci commit network
	
if ! grep bmx6 /etc/rc.local; then
    echo "(while pgrep -f mac80211.sh ; do sleep 1; done;
    ulimit -c 20000;
    bmx6 $devs;
    sleep 1;
    bmx6 -c --tunDev main /tun6Address 2012:0:0:$ip6::1/128 /tun4Address 1.1.1.$ip/32;) &" >> /etc/rc.local
fi
	
if ! grep test.sh /etc/crontabs/root; then
	echo '*/5 * * * * sh /root/test.sh' >> /etc/crontabs/root
fi

(sleep 15 && reboot) &

/root/test.sh

c=0
for h in $(bmx6 -c originators | awk '{print $3}'); do
	ping6 -c2 $h -w 10
	[ $? -eq 0 ] && c=$(($c+1))
done
echo $c >> /save/meshnodes.log
wibed/example_mesh.txt · Last modified: 2014/09/12 16:11 by pau