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

From Nsnam
Jump to: navigation, search
Line 44: Line 44:
 
     b.  Log in as root (su or sudo as you wish);
 
     b.  Log in as root (su or sudo as you wish);
 
     c.  Put the test network interface into promiscuous mode
 
     c.  Put the test network interface into promiscuous mode
         ifconfig eth1 promisc up
+
         ifconfig eth1 promisc
 
     d.  <Ctrl>+<Alt> to exit the VM
 
     d.  <Ctrl>+<Alt> to exit the VM
 
     e.  Select the "ns-3-test-2" virtual machine and click in the console to
 
     e.  Select the "ns-3-test-2" virtual machine and click in the console to
Line 50: Line 50:
 
     f.  Log in as root (su or sudo as you wish);
 
     f.  Log in as root (su or sudo as you wish);
 
     g.  Put the test network interface into promiscuous mode
 
     g.  Put the test network interface into promiscuous mode
         ifconfig eth1 promisc up
+
         ifconfig eth1 promisc
 
     h.  <Ctrl>+<Alt> to exit the VM
 
     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.  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
 
     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
Line 60: Line 61:
 
         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
 
     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 emu-udp-echo-client
 
     c.  The client will run for about ten seconds;
 
     c.  The client will run for about ten seconds;
6.  Take a look at the client pcap file
+
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
 
     a.  tcpdump -nn -tt -r emu-udp-echo-client-0-0.pcap
  
[[User:Craigdo|Craigdo]] 21:54, 13 August 2008 (EDT)
+
[[User:Craigdo|Craigdo]] 23:38, 14 August 2008 (EDT)

Revision as of 03:38, 15 August 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. 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 (experimental)

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. Clone 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
       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/craigdo/ns-3-emu
   e.  Build the code
       ./waf -d debug 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/craigdo/ns-3-emu
   k.  Build the code
       ./waf -d debug 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)

   sonce 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)