Difference between revisions of "HOWTO use ns-3 scripts to drive real hardware (experimental)"

From Nsnam
Jump to: navigation, search
(HOWTO use ns-3 scripts to drive real hardware)
 
(5 intermediate revisions by 2 users not shown)
Line 11: Line 11:
 
done, you can pick up at the instructions below.
 
done, you can pick up at the instructions below.
  
== HOWTO use ns-3 scripts to drive real hardware (experimental) ==
+
== HOWTO use ns-3 scripts to drive real hardware ==
  
 
1.  Start the VMware virtual machines
 
1.  Start the VMware virtual machines
Line 19: Line 19:
 
     c.  Select the "Start this virtual machine" command on the "ns-3-test-2"
 
     c.  Select the "Start this virtual machine" command on the "ns-3-test-2"
 
         virtual machine in the VMware Server Console;
 
         virtual machine in the VMware Server Console;
2.  Clone and build the ns-3-emu experimental repositories on both machines
+
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
 
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
 
         interact with the VM
 
         interact with the VM
Line 25: Line 25:
 
     c.  Change into the repos directory;
 
     c.  Change into the repos directory;
 
     d.  Clone the repository
 
     d.  Clone the repository
         hg clone http://code.nsnam.org/craigdo/ns-3-emu
+
         hg clone http://code.nsnam.org/ns-3-dev
 
     e.  Build the code
 
     e.  Build the code
         ./waf -d debug configure
+
         ./waf configure --enable-examples
         ./waf
+
         ./waf build
 
     f.  <Ctrl>+<Alt> to exit the VM
 
     f.  <Ctrl>+<Alt> to exit the VM
 
     g.  Select the "ns-3-test-2" virtual machine and click in the console to
 
     g.  Select the "ns-3-test-2" virtual machine and click in the console to
Line 35: Line 35:
 
     i.  Change into the repos directory;
 
     i.  Change into the repos directory;
 
     j.  Clone the repository
 
     j.  Clone the repository
         hg clone http://code.nsnam.org/craigdo/ns-3-emu
+
         hg clone http://code.nsnam.org/ns-3-dev
 
     k.  Build the code
 
     k.  Build the code
         ./waf -d debug configure
+
         ./waf configure --enable-examples
         ./waf
+
         ./waf build
 
3.  Configure the network interfaces
 
3.  Configure the network interfaces
 
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
 
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
Line 52: Line 52:
 
         ifconfig eth1 promisc
 
         ifconfig eth1 promisc
 
     h.  <Ctrl>+<Alt> to exit the VM
 
     h.  <Ctrl>+<Alt> to exit the VM
 +
    i.  '''Note:''' Modern versions of VMware may ask for a password at the GUI console to enable
 +
        promiscuous mode on the virtual machine interface.
 
4.  Run the server script as root (I habitually use ns-3-test-2 as the server)
 
4.  Run the server script as root (I habitually use ns-3-test-2 as the server)
    sonce the socket calls for the emulated net device require root privileges
+
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
 
     a.  Select the "ns-3-test-2" virtual machine and click in the console to
 
         interact with the VM
 
         interact with the VM
     b.  ./waf --run emu-udp-echo-server
+
     b.  ./waf --run "fd-emu-udp-echo --server --stopTime=30"
 
     c.  <Ctrl>+<Alt> to exit the VM
 
     c.  <Ctrl>+<Alt> to exit the VM
     d.  '''''You have about 50 seconds to get back and start the client
+
     d.  '''''Time is now running to get back and start the client before the server exits'''''
        before the server exits'''''
+
 
5.  Run the client script as root (I habitually use ns-3-test-1 as the client)
 
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
+
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
 
     a.  Select the "ns-3-test-1" virtual machine and click in the console to
 
         interact with the VM
 
         interact with the VM
     b.  ./waf --run emu-udp-echo-client
+
     b.  ./waf --run "fd-emu-udp-echo --client --stopTime=25"
     c.  The client will run for about ten seconds;
+
     c.  The client will run for about 25 seconds;
 
6.  Take a look at the client pcap file and find a couple of ARP exchanges and
 
6.  Take a look at the client pcap file and find a couple of ARP exchanges and
    the expected UDP echo requests and replies.
+
the expected UDP echo requests and replies.
     a.  tcpdump -nn -tt -r emu-udp-echo-client-0-0.pcap
+
     a.  tcpdump -nn -tt -r fd-emu-udp-echo-client-0-1.pcap
  
 
[[User:Craigdo|Craigdo]] 23:38, 14 August 2008 (EDT)
 
[[User:Craigdo|Craigdo]] 23:38, 14 August 2008 (EDT)

Latest revision as of 21:34, 6 October 2014

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 --enable-examples
       ./waf build
   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 --enable-examples
       ./waf build

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
   i.  Note: Modern versions of VMware may ask for a password at the GUI console to enable 
        promiscuous mode on the virtual machine interface.

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 "fd-emu-udp-echo --server --stopTime=30"
   c.  <Ctrl>+<Alt> to exit the VM
   d.  Time is now running 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 "fd-emu-udp-echo --client --stopTime=25"
   c.  The client will run for about 25 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 fd-emu-udp-echo-client-0-1.pcap

Craigdo 23:38, 14 August 2008 (EDT)