Lab 3 Ad Hoc Routing
August 17, 2010
Contents
Title: 1
1 Description of Ad Hoc routing Testbed 2
2 Exercises 2
2.1 Initial Experiment Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Evaluation of Route Discovery . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Open Question . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
A Some basics of Linux 6
B The installation of aodv-uu 7
C About the name of the wireless card 8
1
1 Description of Ad Hoc routing Testbed
In this experiment you will use 3 laptops to con�gured to communicate in ad hoc mode.
The laptops directly communicate with each other in peer-to-peer mode, without going
through 802.11g access points. The topology of the ad hoc routing testbed is shown as
�gure 1.
Figure 1: Ad Hoc Routing Setup. Since there are several groups of testbeds, please use
10.1..x as your IP address.
In the above setup, you will use MAC address blocking feature of the iptables utility such
that computer A cannot communicate directly with computer C and computer C cannot
communicate directly with computer A. This is done to simulate a real-world ad hoc
network scenario where computer A is out of the transmission range of computer C, but
computer B can reach both computer A and computer C (thus it can act as intermediate
hop to forward packets from computer A to computer C) within the con�nes of the lab.
Though we can decrease the transmission power of WLAN card to really simulate a
multi-hop scenario, we will leave it to further research.
2 Exercises
With TA's help, identify the devices you will be using in the exercises (Laptop hardware
and software). Login into the laptop. The account is "wl", and password is "wl" too.
2.1 Initial Experiment Setup
1. Set up all laptops in ad hoc mode as shown in �gure 1 as follows.
For each of the laptops, open a terminal and type the following command to
become root(super administrator).
sudo su
the password is: wl
Type the following command:(Note: the essid should be di�erent for di�erent
testbed groups. If your testbed group ID is X, please use "test groupX". We take
test group1 as an example in the following code.)
iwcon�g wlan0 essid test group1 mode ad�hoc
iwcon�g wlan0 essid test group1 mode ad�hoc
ifcon�g wlan0 up
Note that the above command should be typed twice. Type the following command
for all laptops. Assign IP address in any order.
2
ifcon�g wlan0 10.1..x netmask 255.255.255.0 up
Now type the following in all laptops to see output.
iwcon�g wlan0
Sample Output:
wlan0 IEEE 802.11bg ESSID:"test group1"
Mode:Ad�Hoc Frequency:2.412 GHz Cell: C6:89:FE:B3:3C:80
Tx�Power=20 dBm
Retry long limit :7 RTS thr:o� Fragment thr:o�
Encryption key:o�
Power Management:o�
Please note that the 'Cell' value above must be the same on all laptops to make
sure that all of them are part of the same ad-hoc network.
Now type the following in all laptops to see output.
ifcon�g wlan0
Sample Output:
wlan0 Link encap:Ethernet HWaddr c8:3a:35:c3:45:95
inet addr :10.1.1.1 Bcast:10.1.1.255 Mask:255.255.255.0
inet6 addr: fe80 :: ca3a:35� : fec3:4595/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:39 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier :0
collisions :0 txqueuelen:1000
RX bytes:7399 (7.3 KB) TX bytes:3827 (3.8 KB)
Note down the MAC address(Hwaddr �eld) for each of the laptops.
2. Make sure all laptops are reachable from each other using ping.
Next use iptables to block computer C from computer A and computer A from
computer C as follows:
On computer A type the following:
iptables �A INPUT �m mac ��mac�source
�j DROP
On computer C type the following:
iptables �A INPUT �m mac ��mac�source
�j DROP
Now ping computer C from computer A. You should not be able to send any
packets. Next ping computer B from computer A. Then, ping computer B from
computer C. In both cases, the ping should be successful.
The ad-hoc routing setup is now ready.
3
2.2 Evaluation of Route Discovery
Purpose: Preliminary investigation regarding the details of discovering a route to a
nonadjacent node.
Instructions: You are advised to answer questions as and when they appear. You may
�nd it harder or answer them at a later stage.
Steps:
1. On computer A, type in
route �n
Save the results as adovresult1.1. (Note: you can redirect output to save �les
"route -n > aodvresult1.1").
2. Start the AODV daemon on all computer by typing in the following on each of
them and keep it running (do not press "ctrl+C" or close the window, if you need
to use the terminal, open a new one):
aodvd �i ra0 �l �r 0.8
Redirect output to temp.txt on Computer A. Stop after 10 seconds. On computer
A, observe the debug messages printed.
3. On computer A, type in again
route �n
Save results as aodvresult1.2.
Before proceeding, try answering the following questions:
Question.1 Compare aodvresult1.1 and aodvresult1.2. Do you have routes to
both computer B and computer C? If not, why? Is it because AODV does
not function as intended?
Question.2 From your observations of step-2, enumerate the AODV control mes-
sages transmitted/received by computer A and their respective sources. What
is the purpose of each kind of message?(You can answer this part later if you
are not sure).
4. On computer A, repeat step 2 but do not stop after 10 seconds. Then open xterm
terminal on computer A and try to ping computer C by entering the following
command:
ping 10.1..3
5. As soon as you get a ping response, open a third xterm terminal and print
route �n
Save the result as aodvresult1.3.
Stop immediately both aodv command (hyper terminal) and ping command (xterm
terminal) on computer A.
4
Question.3 From your observation of step-3, enumerate the AODV control mes-
sages transmitted/received by computer A in temp.txt and their respective
sources. What is the purpose of each kind of new messages?
Question.4 What di�erence do you observe between the routing table entries of
aodvresult1.3 and aodvresult1.2? What is the result for this di�erence?
Question.5 What di�erence do you observe between the routing table entries of
aodvresult1.3 and aodvresult1.2? What is the reason for this di�erence?
6. Repeat step4. As soon as you get response, stop pinging.
7. Wait for around 1 minute. Then again type on computer A:
route �n
Save results as aodvresult1.4
Question.6 What di�erence do you observe between aodvresult1.4 and aodvre-
sult1.3? What is the reason for this di�erence, and what is the mechanism
that AODV uses to accomplish it?
8. Stop all programs running on the laptops.
9. Restart the AODV daemon on computer B, computer A and computer C (in the
same order) by typing in the following on each of them:
aodvd �i ra0 �l �r 0.8
On computer C, observe the debug messages printed.
10. Open xterm on computer A and try to ping computer C.
ping 10.1..3
Stop aodv on computer C after getting ping response. Observe the debug messages
printed by the AODV daemon on the terminal.
Question.7 From your observations of step 10, enumerate the AODV control
messages transmitted/received by computer C and their respective sources.
Try to explain the meaning of the message.
2.3 Open Question
It is not mandatory, you will get extra points for this part.
1. Is it feasible to simulate a 3 hops chain(or star topology) using 4 laptops in a lab
con�ne? Give your experiment plan about aodv of 3 hops, and test your idea.
2. Is there a feasible way to quickly estimate the throughput or latency of multi-hops
transmission.(You can use any software tools under linux) Give you estimation
value and your measure method.
5
A Some basics of Linux
1. If you don't familiar with any command, you could use man command to help
you. For example, you don't understand how to use ifcon�g or iwcon�g, you could
simply type:
$ man ifcon�g
$ man iwcon�g
2. If you encounter errors like Operation not permitted, you may use sudo before
your command.
$ sudo ifcon�g wlan0 up
or you can also into the su mode:
$ sudo su
3. If anything happends unanticipated, you could use Ctrl+C to turn o� the current
command:
wl@wl�desktop:~$ ping 10.1.2.3
PING 10.1.2.3 (10.1.2.3) 56(84) bytes of data.
^C
��� 10.1.2.3 ping statistics ���
4 packets transmitted, 0 received , 100% packet loss, time 3024ms
wl@wl�desktop:~$
6
B The installation of aodv-uu
If you want to complete lab3 in your own laptops, you need to install AODV-UU(an
implementation of the Ad hoc On-demand Distance Vector routing protocol) and ipta-
bles(a �rewall rule speci�es criteria for a packet and a target).
1. Download the aodv-uu package from http://sourceforge.net/projects/aodvuu/.
2. Unpack the package aodv-uu-0.9.6.tar.gz downloaded.
3. Get to the path.
$ cd Downloads/aodv�uu�0.9.6/
4. Watch the readme �le.
$ ls
$ gedit README
5. The install
$ make
$ make install
After installation successful, you could use it with the proper command.
7
C About the name of the wireless card
For di�erent distributions of Linux OS or di�erent desktops, you may notice that the
name of the wireless card could be di�erent.
You may change the name to your expectation by editing the �le /etc/udev/rules.d/70-
persistent-net.rules manually:
$ sudo gedit /etc/udev/rules.d/70�persistent�net.rules
You may open the �le similar as follows:
# This �le maintains persistent names for network interfaces .
# See udev(7) for syntax.
#
# Entries are automatically added by the 75�persistent�net�generator.rules
# �le ; however you are also free to add your own entries.
# PCI device 0x14e4:0x169b (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?�", ATTRfaddressg=="
00:1d:09:14:73:8a", ATTRfdev idg=="0x0", ATTRftypeg=="1", KERNEL
=="eth�", NAME="eth0"
# PCI device 0x1814:0x0301 (rt61pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?�", ATTRfaddressg=="
c8:3a:35:c3:45:95", ATTRfdev idg=="0x0", ATTRftypeg=="1", KERNEL
=="wlan�", NAME="wlan0"
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?�", ATTRfaddressg=="
50:78:4c:54:15:66", ATTRfdev idg=="0x0", ATTRftypeg=="1", KERNEL
=="eth�", NAME="eth1"
The device name could be modi�ed manualy. Note that di�erent device has di�erent
Mac address.
8
Title:
1 Description of Ad Hoc routing Testbed
2 Exercises
2.1 Initial Experiment Setup
2.2 Evaluation of Route Discovery
2.3 Open Question
A Some basics of Linux
B The installation of aodv-uu
C About the name of the wireless card
本文档为【Ad hoc路由实验】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。