Difference between revisions of "HOWTO use ns-3 in the ORBIT testbed environment"

From Nsnam
Jump to: navigation, search
(New page: {{TOC}} We provide a realtime emulation package that allows us to connect ns-3 to real networks on real machines. Typically the real network will be a testbed of some kind. ORBIT is a t...)
 
Line 5: Line 5:
 
some kind.  ORBIT is a two-tier laboratory emulator/field trial network project of  
 
some kind.  ORBIT is a two-tier laboratory emulator/field trial network project of  
 
WINLAB (Wireless Information Network Laboratory), at Rutgers.  This wireless network
 
WINLAB (Wireless Information Network Laboratory), at Rutgers.  This wireless network
emulator provides a large two-dimensional grid of 400 802.11 radio nodes.  THis
+
emulator provides a large two-dimensional grid of 400 802.11 radio nodes as well as
HOWTO shows how ns-3 scripts can be used to drive these radio nodes.
+
a number of smaller "sandbox" testbeds to allow one to test without reserving the
 +
main gridThis  HOWTO shows how ns-3 scripts can be used to drive these radio nodes.
  
 
== HOWTO use ns-3 in the ORBIT testbed environment ==
 
== HOWTO use ns-3 in the ORBIT testbed environment ==
  
We assume that you have some familiarity with the ORBIT system and have  
+
We assume that you have some experience with the ORBIT system.  If you are new to
 +
ORBIT, please take a look at http://www.orbit-lab.org/ and go through the "Basic
 +
Tutorial" and the "Tutorials on controlling the testbed nodes" at a minimum.  We
 +
will assume throughout this HOWTO that you have registered for an ORBIT account and
 +
have made a reservation on the ORBIT Scheduler for a testbed.  This HOWTO assumes
 +
that you are on the sandbox one (sb1) testbed.
  
1Start the VMware virtual machines
+
We provide a node image on the ORBIT system that includes everything you need to
    a.  Select the "Start this virtual machine" command on the "ns-3-test-1"
+
get an ns-3 environment up and running on your testbed nodesThis includes the
        virtual machine in the VMware Server Console;
+
GNU toolchain, a copy of a precompiled ns-3.3 repository, emacs editor, etcThe
    bRecall that you type <Ctrl>+<Alt> to exit the VM;
+
first step is to get this environment up on the nodes in your testbed.  In ORBIT
     cSelect the "Start this virtual machine" command on the "ns-3-test-2"
+
terminology, we need to "image the nodes." This is a somewhat time-consuming
        virtual machine in the VMware Server Console;
+
process since you are actually copying disk images to the sandbox nodes.
2Clone and build the ns-3-emu experimental repositories on both machines
+
 
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
+
1Connect to the sandbox console, image the sandbox nodes and power them up
        interact with the VM
+
     assh your-orbit-user-name@console.sb1.orbit-lab.org;
     b.  Log in as your normal user;
+
    borbit load all ns-3.3-ndz
     c.  Change into the repos directory;
+
     c.  orbit tell on all
     d.  Clone the repository
+
 
        hg clone http://code.nsnam.org/craigdo/ns-3-emu
+
When you are done with this step, the sandbox nodes will have been powered up and
     e.  Build the code
+
will be in the process of booting.  You now need to connect to the individual
        ./waf -d debug configure
+
nodes in the sandbox and configure them.  You may find it convenient to open
        ./waf
+
a couple of terminal windows for this processYou may see a route not found error
     f<Ctrl>+<Alt> to exit the VM
+
until the nodes are actually done rebooting as a result of the power on step (1.c)
     gSelect the "ns-3-test-2" virtual machine and click in the console to
+
above.  Note that we configure "ath0" on node [1,1] tp be an access point, and  
        interact with the VM
+
"ath0" on node [1,2] to be a station.  We have to place the cards in promiscuous
    hLog in as your normal user;
+
mode for the emu net device to work.
     iChange into the repos directory;
+
 
     jClone the repository
+
2.  Connect to node [1,1] and configure its wireless
        hg clone http://code.nsnam.org/craigdo/ns-3-emu
+
    a.  ssh root@node1-1
     kBuild the code
+
     b.  wlanconfig ath0 destroy
        ./waf -d debug configure
+
     c.  wlanconfig ath0 create wlandev wifi0 wlanmode ap
        ./waf
+
     d.  ifconfig ath0 192.168.1.1 netmask 255.255.255.0
3Configure the network interfaces
+
    e. ifconfig atho promisc up
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
+
 
        interact with the VM
+
3. Connect to node [1,2] and configure its wireless
     b.  Log in as root (su or sudo as you wish);
+
    a.  ssh root@node1-2
     c.  Put the test network interface into promiscuous mode
+
    b.  wlanconfig ath0 destroy
        ifconfig eth1 promisc
+
    c.  wlanconfig ath0 create wlandev wifi0 wlanmode sta
    d.  <Ctrl>+<Alt> to exit the VM
+
    d.  ifconfig ath0 192.168.1.2 netmask 255.255.255.0
    e.  Select the "ns-3-test-2" virtual machine and click in the console to
+
     e.  ifconfig atho promisc up
        interact with the VM
+
 
    fLog in as root (su or sudo as you wish);
+
Before going any further, let's make sure that the wireless cards can talk to
    gPut the test network interface into promiscuous mode
+
each other. From now on, when I refer to [1,1] assume that it means the ssh
        ifconfig eth1 promisc
+
window into root@node1-1 and when I refer to [1,2] it means root@node1-2.
    h<Ctrl>+<Alt> to exit the VM
+
 
4.  Run the server script as root (I habitually use ns-3-test-2 as the server)
+
4. Ping from [1,1] to [1,2]
since the socket calls for the emulated net device require root privileges
+
     aping 192.168.1.2
    a.  Select the "ns-3-test-2" virtual machine and click in the console to
+
 
        interact with the VM
+
5.  Ping from [1,2] to [1,1]
    b.  ./waf --run emu-udp-echo-server
+
     aping 192.168.1.1
    c<Ctrl>+<Alt> to exit the VM
+
 
    d.  '''''You have about 50 seconds to get back and start the client
+
Now that you have a working hardware configuration, you can go ahead and get
        before the server exits'''''
+
ns-3 up and running.  The image you loaded is of a vanilla ns-3.3 distribution.
5.  Run the client script as root (I habitually use ns-3-test-1 as the client)
+
In that distro there are no example programs handy which can drive the two nodes
since the socket calls for the emulated net device require root privileges
+
in the sandbox.  We provide a couple of example progams on one of our developers'
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
+
private repositories to get you started. 
        interact with the VM
+
 
    b.  ./waf --run emu-udp-echo-client
+
6Pull the examples into [1,1] and build them
    c.  The client will run for about ten seconds;
+
     acd /home/repos/ns-3.3
6Take a look at the client pcap file and find a couple of ARP exchanges and
+
     b.  hg pull http://code.nsnam.org/craigdo/ns-3.3-orbit
the expected UDP echo requests and replies.
+
     c.  ./waf
     a.  tcpdump -nn -tt -r emu-udp-echo-client-0-0.pcap
+
 
 +
7Pull the examples into [1,2] and build them
 +
     a.  cd /home/repos/ns-3.3
 +
     b.  hg pull http://code.nsnam.org/craigdo/ns-3.3-orbit
 +
     c.  ./waf
 +
 
 +
Now you can run the example ns-3 client server scripts on the testbedWe have
 +
configured [1,1] device "ath0" as an access point, and [1,2] device "ath0" as a
 +
stationBoth devices must be in promiscuous mode.  This can all be verified by
 +
using "ifconfig" and "iwconfig" on the appropriate console.
 +
 
 +
In this simple example, we are just going to manually start one ns-3 simulation
 +
script to act as a server for a trivial UDP echo applicationOnce the server
 +
is started on [1,1] for example, you can then go to the console for [1,2] and  
 +
run the UPD echo client scriptLet's do itRemember you don't have all day
 +
to dawdle after running the server -- it exits automatically after 60 seconds.
 +
 
 +
8.  Run the server on [1,1]
 +
     a.  ./waf --run emu-udp-echo-server
 +
 
 +
9Run the client on [1,2]
 +
     a.  ./waf --run emu-udp-echo-client
 +
 
 +
Congratulations, you have now run your ns-3 simulation scripts on a testbed.
  
 
----
 
----
  
[[User:Craigdo|Craigdo]] 01:09, 31 December 2008 (UTC)
+
[[User:Craigdo|Craigdo]] 01:47, 31 December 2008 (UTC)

Revision as of 01:47, 31 December 2008

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

We provide a realtime emulation package that allows us to connect ns-3 to real networks on real machines. Typically the real network will be a testbed of some kind. ORBIT is a two-tier laboratory emulator/field trial network project of WINLAB (Wireless Information Network Laboratory), at Rutgers. This wireless network emulator provides a large two-dimensional grid of 400 802.11 radio nodes as well as a number of smaller "sandbox" testbeds to allow one to test without reserving the main grid. This HOWTO shows how ns-3 scripts can be used to drive these radio nodes.

HOWTO use ns-3 in the ORBIT testbed environment

We assume that you have some experience with the ORBIT system. If you are new to ORBIT, please take a look at http://www.orbit-lab.org/ and go through the "Basic Tutorial" and the "Tutorials on controlling the testbed nodes" at a minimum. We will assume throughout this HOWTO that you have registered for an ORBIT account and have made a reservation on the ORBIT Scheduler for a testbed. This HOWTO assumes that you are on the sandbox one (sb1) testbed.

We provide a node image on the ORBIT system that includes everything you need to get an ns-3 environment up and running on your testbed nodes. This includes the GNU toolchain, a copy of a precompiled ns-3.3 repository, emacs editor, etc. The first step is to get this environment up on the nodes in your testbed. In ORBIT terminology, we need to "image the nodes." This is a somewhat time-consuming process since you are actually copying disk images to the sandbox nodes.

1. Connect to the sandbox console, image the sandbox nodes and power them up

   a.  ssh your-orbit-user-name@console.sb1.orbit-lab.org;
   b.  orbit load all ns-3.3-ndz
   c.  orbit tell on all

When you are done with this step, the sandbox nodes will have been powered up and will be in the process of booting. You now need to connect to the individual nodes in the sandbox and configure them. You may find it convenient to open a couple of terminal windows for this process. You may see a route not found error until the nodes are actually done rebooting as a result of the power on step (1.c) above. Note that we configure "ath0" on node [1,1] tp be an access point, and "ath0" on node [1,2] to be a station. We have to place the cards in promiscuous mode for the emu net device to work.

2. Connect to node [1,1] and configure its wireless

   a.  ssh root@node1-1
   b.  wlanconfig ath0 destroy
   c.  wlanconfig ath0 create wlandev wifi0 wlanmode ap
   d.  ifconfig ath0 192.168.1.1 netmask 255.255.255.0
   e.  ifconfig atho promisc up

3. Connect to node [1,2] and configure its wireless

   a.  ssh root@node1-2
   b.  wlanconfig ath0 destroy
   c.  wlanconfig ath0 create wlandev wifi0 wlanmode sta
   d.  ifconfig ath0 192.168.1.2 netmask 255.255.255.0
   e.  ifconfig atho promisc up

Before going any further, let's make sure that the wireless cards can talk to each other. From now on, when I refer to [1,1] assume that it means the ssh window into root@node1-1 and when I refer to [1,2] it means root@node1-2.

4. Ping from [1,1] to [1,2]

   a.  ping 192.168.1.2

5. Ping from [1,2] to [1,1]

   a.  ping 192.168.1.1

Now that you have a working hardware configuration, you can go ahead and get ns-3 up and running. The image you loaded is of a vanilla ns-3.3 distribution. In that distro there are no example programs handy which can drive the two nodes in the sandbox. We provide a couple of example progams on one of our developers' private repositories to get you started.

6. Pull the examples into [1,1] and build them

   a.  cd /home/repos/ns-3.3
   b.  hg pull http://code.nsnam.org/craigdo/ns-3.3-orbit
   c.  ./waf

7. Pull the examples into [1,2] and build them

   a.  cd /home/repos/ns-3.3
   b.  hg pull http://code.nsnam.org/craigdo/ns-3.3-orbit
   c.  ./waf

Now you can run the example ns-3 client server scripts on the testbed. We have configured [1,1] device "ath0" as an access point, and [1,2] device "ath0" as a station. Both devices must be in promiscuous mode. This can all be verified by using "ifconfig" and "iwconfig" on the appropriate console.

In this simple example, we are just going to manually start one ns-3 simulation script to act as a server for a trivial UDP echo application. Once the server is started on [1,1] for example, you can then go to the console for [1,2] and run the UPD echo client script. Let's do it. Remember you don't have all day to dawdle after running the server -- it exits automatically after 60 seconds.

8. Run the server on [1,1]

   a.  ./waf --run emu-udp-echo-server

9. Run the client on [1,2]

   a.  ./waf --run emu-udp-echo-client

Congratulations, you have now run your ns-3 simulation scripts on a testbed.


Craigdo 01:47, 31 December 2008 (UTC)