HOWTO use ns-3 scripts to drive real hardware (experimental)

From Nsnam
Revision as of 14:58, 25 February 2010 by Tomh (Talk | contribs) (update HOWTO use ns-3 scripts to drive real hardware (experimental))

Jump to: navigation, search

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. The immediate problem for this HOWTO is, of course, that we don't have a testbed handy. What we'll do is show how this can be done in VMware using a couple of virtual machines connected on a dedicated network. In order to get this HOWTO to work, you will have to set up a VMware environment with two virtual machines, "ns-3-test-1" and "ns-3-test-2" as described in HOWTO use VMware to set up virtual networks (Windows). Once you have this done, you can pick up at the instructions below.

HOWTO use ns-3 scripts to drive real hardware

1. Start the VMware virtual machines

   a.  Select the "Start this virtual machine" command on the "ns-3-test-1"
       virtual machine in the VMware Server Console;
   b.  Recall that you type <Ctrl>+<Alt> to exit the VM;
   c.  Select the "Start this virtual machine" command on the "ns-3-test-2"
       virtual machine in the VMware Server Console;

2. Get a recent release of ns-3 or the development version ns-3-dev

   a.  Select the "ns-3-test-1" virtual machine and click in the console to
       interact with the VM
   b.  Log in as your normal user;
   c.  Change into the repos directory;
   d.  Clone the repository
       hg clone http://code.nsnam.org/ns-3-dev
   e.  Build the code
       ./waf configure
       ./waf
   f.  <Ctrl>+<Alt> to exit the VM
   g.  Select the "ns-3-test-2" virtual machine and click in the console to
       interact with the VM
   h.  Log in as your normal user;
   i.  Change into the repos directory;
   j.  Clone the repository
       hg clone http://code.nsnam.org/ns-3-dev
   k.  Build the code
       ./waf configure
       ./waf

3. Configure the network interfaces

   a.  Select the "ns-3-test-1" virtual machine and click in the console to
       interact with the VM
   b.  Log in as root (su or sudo as you wish);
   c.  Put the test network interface into promiscuous mode
       ifconfig eth1 promisc
   d.  <Ctrl>+<Alt> to exit the VM
   e.  Select the "ns-3-test-2" virtual machine and click in the console to
       interact with the VM
   f.  Log in as root (su or sudo as you wish);
   g.  Put the test network interface into promiscuous mode
       ifconfig eth1 promisc
   h.  <Ctrl>+<Alt> to exit the VM

4. Run the server script as root (I habitually use ns-3-test-2 as the server) since the socket calls for the emulated net device require root privileges

   a.  Select the "ns-3-test-2" virtual machine and click in the console to
       interact with the VM
   b.  ./waf --run emu-udp-echo-server
   c.  <Ctrl>+<Alt> to exit the VM
   d.  You have about 50 seconds to get back and start the client
       before the server exits

5. Run the client script as root (I habitually use ns-3-test-1 as the client) since the socket calls for the emulated net device require root privileges

   a.  Select the "ns-3-test-1" virtual machine and click in the console to
       interact with the VM
   b.  ./waf --run emu-udp-echo-client
   c.  The client will run for about ten seconds;

6. Take a look at the client pcap file and find a couple of ARP exchanges and the expected UDP echo requests and replies.

   a.  tcpdump -nn -tt -r emu-udp-echo-client-0-0.pcap

Craigdo 23:38, 14 August 2008 (EDT)