Lab 4 - Dynamic Ad-Hoc Routing


In the previous lab, you constructed routes between nodes in an ad-hoc setting statically.  This works fine for a static network, which a wired network generally is.  You can imagine being in a wireless setting where nodes are moving and possibly going in and out of radio contact with each other resulting in broken routes, thus incurring a large human overhead to reconfigure the routes manually each time this happens.  Information theory states that in certain situations and with some reasonable assumptions, talking only to your nearest neighbor is the best thing to do to maximize the overall network performance for a specific metric.  If nodes are moving, your nearest neighbor may be changing, thus also motivating interest in using dynamic routing. 

The routing protocol we will be looking at during this lab is called AODV, Ad-hoc On-demand Distance Vector routing protocol.  There are many other, and possibly better dynamic routing protocols available (e.g. DSDV, DSR, ...), but we will only concern ourselves with AODV for now. 

Setting Up Dynamic Routing - AODV: 

Since, it is most likely that you do not have a room large enough to setup your nodes such that the two neighbor nodes are the only nodes within the transmission range of a given node, we will need to do some special setup to make AODV useful, that is, so that we actually need to use AODV instead of directly talking to each and every possible destination node directly.  We will name nodes according to the following table, where you will need to change our values with the values corresponding to your actual hardware to make it work, that is, change the MAC addresses listed to what your cards are actually set to.  The corresponding image illustrates the setup we will be trying to acheive. 

MAC Address
IP Address

AODV Node Link Setup Arrangement

To force our nodes to only allow communication with their neighboring nodes, we will be using the built in linux tool iptables, which will allow us to drop packets based on MAC address.  (Note:  The following configuration if iptables does not necessarily reflect a good firewall policy in general and it is not trying to do so.  Its main goal is to acomplish the task we need it to do for this lab with minimal or no interference with any other setup you may have on the machine.)  Any linux kernel version more recent than 2.4 (inclusive) will have the ability to use iptables as its firewall solution.  Additionally, most linux flavors default installations will have the ability to use iptables from install, however, you may need to turn it on.  Issue the following commands as root at the corresponding nodes.  The notation wlan0 refers to the device name of your WiFi device.  You may need to modify this value based on the device's actual name when you issue the iptables commands. 

Node A:

iptables -A PREROUTING -m mac CC:CC:CC:CC:CC:CC -i wlan0 DROP
iptables -A PREROUTING -m mac DD:DD:DD:DD:DD:DD -i wlan0 DROP

Node B:

iptables -A PREROUTING -m mac DD:DD:DD:DD:DD:DD -i wlan0 DROP

Node C:

iptables -A PREROUTING -m mac AA:AA:AA:AA:AA:AA -i wlan0 DROP

Node D:

iptables -A PREROUTING -m mac AA:AA:AA:AA:AA:AA -i wlan0 DROP
iptables -A PREROUTING -m mac BB:BB:BB:BB:BB:BB -i wlan0 DROP

Start running AODV on each node by issuing the command at each node with
aodvd -l -r 30 -i wlan0
This will start the AODV daemon, telling it to log to /var/log/aodvd.log recording its routing table every 30 seconds.  Now run traceroute, as in lab 3 to verify that your routes are setup. 

Experimental Procedure: 

Start iperf at node D with:

iperf -s

At node A run:

iperf -c

Now we will simulate node D moving "towards" node A by it coming into range of node B and then node A directly.  First, issue the following command at node B to allow node D to be spoken to directly from node B:  (Note:  after each of the following sets of changes, you may need to wait a while [30-60s] to allow the nodes to "discover" each other.) 

iptables -D PREROUTING -m mac DD:DD:DD:DD:DD:DD -i wlan0 DROP

Similarly, issue this command at node D: 

iptables -D PREROUTING -m mac BB:BB:BB:BB:BB:BB -i wlan0 DROP

Now, it looks like node D has come into range of node B.  Run iperf at node A as you did above. 

To make D visible from A, issue this command at node A: 

iptables -D PREROUTING -m mac DD:DD:DD:DD:DD:DD -i wlan0 DROP

Similarly, issue this next command at node D: 

iptables -D PREROUTING -m mac AA:AA:AA:AA:AA:AA -i wlan0 DROP

Rerun the tests one more time. 


How did the throughput compare between the static routing case (previous lab) and the case where AODV was used?  How did changing the number of hops change the throughput?  Why is this?  For additional comparisons, try changing the duration of the flows.  How does this affect the results? 


AODV-UU Linux (2.4) Implementation
NIST AODV Implementation (also has a quick overview)
AODV - RFC 3561

IPTables -
IPTables/Netfilter Project Homepage
man iptables