HOWTO use ns-3 scripts to drive real hardware (experimental)
Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects
HOWTOs - Installation - Troubleshooting - User FAQ - 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)