|
|
(7 intermediate revisions by 2 users not shown) |
Line 8: |
Line 8: |
| to get this HOWTO to work, you will have to set up a VMware environment with | | 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 | | 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 == |
|
| |
|
| == 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. 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 |
|
| |
|
| 1. Get the VMware server software
| | [[User:Craigdo|Craigdo]] 23:38, 14 August 2008 (EDT) |
| a. You may read in various release notes or documentation that you need
| |
| Microsoft servers of various kinds. This is not the case. You can
| |
| run VMware server on XP just fine;
| |
| b. Go to http://www.vmware.com/download/server/ to get the software;
| |
| c. Select the Download Now button (download as usual);
| |
| d. Install the software in the usual way;
| |
| e. Ignore warnings about requiring Microsoft IIS to continue.
| |
| 2. Request a Serial Number
| |
| a. Go to http://register.vmware.com/content/registration.html
| |
| b. Fill out the page and select "Submit";
| |
| c. You will be redirected to a page with your new serial number;
| |
| d. Copy the serial number;
| |
| e. Run the VMware server;
| |
| f. Select the menu item Help->Enter Serial Number ...
| |
| g. Paste in the new serial number.
| |
| 3. Install a Virtual Machine
| |
| a. Exit the VMware Server.
| |
| b. We prefer Ubuntu JeOS (Just enough OS). You can download the code from
| |
| the VMware "Virtual Appliance Marketplace" by going to
| |
| http://www.vmware.com/appliances/directory/1136 and selecting "Download
| |
| this Appliance" link from the "Download" box to the right of the
| |
| appliance name (Ubuntu 7.10 JeOS v1.031 with VMware drivers (70MB));
| |
| c. Download the appliance and unzip the file. You should have a directory
| |
| named "ub710jeos". Copy this directory to the "c:\Virtual Machines"
| |
| (VMware) directory.
| |
| d. Run the VMware server. If you get a complaint about not having a disk
| |
| in your CD-ROM, just continue;
| |
| e. Select the "Local Host" radio button and press "OK";
| |
| f. Select the File->Open menu option and Browse for the
| |
| "ub710jeos" directory and open the "ub710jeos.vmx" file;
| |
| 5. Start the new Virtual Machine
| |
| a. Select the "Start this virtual machine" command on the VMware Server
| |
| Console;
| |
| b. You will get a dialog box asking about a new UUID. Select the "Create"
| |
| radio button and press "OK";
| |
| c. Ubuntu JeOS will start in a "console window." If you want to type into
| |
| the JeOS VM, you must click your mouse in the console window. If you
| |
| want to exit to Windows, press <ctrl>+<alt> and you will pop out of
| |
| the VM;
| |
| d. Login as user: root, password root;
| |
| e. Change the password (passwd)if you are connected to the real world and
| |
| like your system intact.
| |
| f. Ping www.google.com to test network connectivity.
| |
| 5. Freshen the Software Distribution
| |
| a. apt-get update
| |
| b. apt-get install
| |
| c. apt-get install pkg-config libxml2 libxml2-dev
| |
| d. apt-get install gcc g++ make automake autoconf binutils
| |
| e. apt-get install openssh-server openssh-client openssl libssl-dev
| |
| f. apt-get install python-dev mercurial
| |
| g. apt-get install tcpdump gdb emacs
| |
| h. exit
| |
| 6. Log in as User (Appliance comes pre-configured with one user)
| |
| a. log in as user: user, password user
| |
| b. Change your password (passwd) if you are connected to the real world and
| |
| like your system intact
| |
| 7. Get and Test ns-3-dev
| |
| a. mkdir repos
| |
| b. cd repos
| |
| c. hg clone http://code.nsnam.org/ns-3-dev
| |
| d. cd ns-3-dev
| |
| e. ./waf configure -d debug
| |
| f. ./waf
| |
| g. ./waf --regression
| |
| | |
| As an old math professor once said, "I feel joy"!
| |
| | |
| Now it's time for a breather. You have a configured Ubuntu JeOS Virtual Machine
| |
| and you've built and tested ns-3 on it. Now might be a good time to copy this
| |
| VM somewhere safe as your base machine. If you want to clone your machine you can
| |
| use this copy, or if you manage to wedge the VM, you can use the copy as a
| |
| checkpoint and restore a working copy without going through all the pain we just
| |
| suffered through.
| |
| | |
| 8. Checkpoint the VM
| |
| a. log out of the VM (exit);
| |
| b. Press the red rectangle (stop) button on the VMware Server Console;
| |
| c. Open My Computer/Virtual Machines
| |
| d. Copy "ub710jeos" to "ub710jeos checkpoint"
| |
| | |
| Now it's time to start creating that test network that was the reason we started
| |
| this process. We'll use the checkpointed VM we just made and copy it to begin.
| |
| | |
| 9. Create new VM with a Private Network
| |
| a. Copy "c:\Virtual Machines\ub710jeos checkpoint" to another directory in
| |
| the "Virtual Machines" directory and call it "ns-3-test-1"
| |
| b. Select the File->Open menu option and Browse for the
| |
| "ns-3-test-1" directory and open the "ub710jeos.vmx" file;
| |
| e. Select the "Edit virtual machine settings" command on the VMware Server
| |
| Console;
| |
| d. Click on the "Options" tab;
| |
| e. Enter "ns-3-test-1" in the "Virtual machine name" text box;
| |
| f. Click on the "Hardware" tab;
| |
| g. Click on the "Add" button. You will launch the "Add Hardware Wizard";
| |
| h. Click "Next";
| |
| i. Click "Ethernet Adapter" and then "Next";
| |
| j. Click the "Host Only: A private network shared with the host" radio
| |
| button and then "Next";
| |
| k. Click "OK";
| |
| l. Select the "Start this virtual machine" command on the VMware Server
| |
| Console;
| |
| m. You will get a dialog box asking about a new UUID. Select the "Create"
| |
| radio button and press "OK";
| |
| n. Ubuntu JeOS will start in a "console window."
| |
| o. Log in as root (you changed the password, right?)
| |
| p. Edit (vi) "/etc/network/interfaces" and add the following lines
| |
| '''''before''''' the similar delcaration of the primary network interface:
| |
| # The private network interface
| |
| auto eth1
| |
| iface eth1 inet dhcp
| |
| q. Edit (vi) /etc/hosts and replace instances of "ub710jeos" with
| |
| "ns-3-test-1";
| |
| r. Edit (vi) /etc/hostname and replace "ub710jeos" with "ns-3-test-1";
| |
| s. Change the host hame by executing "hostname ns-3-test-1";
| |
| t. Log out of the VM;
| |
| u. Press the red square (stop) button on the VMware Server Console to
| |
| stop the VM.
| |
| | |
| Now you have one VM with a private network on it. You can repeat step nine
| |
| as many times as you want, renaming the VMs ns-test-2, ns-test-3, etc. Go
| |
| ahead and make a ns-test-2 virtual machine just so we can do something
| |
| interesting.
| |
| | |
| 10. Start Your Virtual Test Network
| |
| a. Select the "ns-3-test-1" tab on the VMware Server Console;
| |
| b. Select the "Start this virtual machine" command on the VMware Server
| |
| Console;
| |
| c. Ubuntu JeOS will start in a "console window";
| |
| d. You should see an "ns-3-test-1 login" prompt when it comes up;
| |
| e. Select the "ns-3-test-2" tab on the VMware Server Console;
| |
| f. Select the "Start this virtual machine" command on the VMware Server
| |
| Console;
| |
| g. Ubuntu JeOS will start in a "console window."
| |
| h. You should see an "ns-3-test-2 login" prompt when it comes up;
| |
| | |
| You can now switch between the running virtual machines by selecting the
| |
| appropriate tab on the VMware Server Console. Enter a VM by clicking in the
| |
| console window and exit by pressing <ctrl>+<alt>. Select another tab of a
| |
| running VM and enter that VM by clicking in the console window.
| |
| | |
| 12. Update /etc/hosts and Check Connectivity
| |
| a. Log in to "ns-3-test-1" as root;
| |
| b. Run ifconfig -a and note the IP address of eth1;
| |
| c. Log in to "ns-3-test-2" as root;
| |
| d. Run ifconfig -a and note the IP address of eth1;
| |
| e. Edit (vi) "/etc/hosts" on "ns-3-test-1" and add an appropriate line
| |
| for "ns-3-test-2". On my machine it is
| |
| "192.168.136.129 ns-3-test-2";
| |
| f. Edit (vi) "/etc/hosts" on "ns-3-test-2" and add an appropriate line
| |
| for "ns-3-test-1". On my machine it is
| |
| "192.168.136.128 ns-3-test-1";
| |
| g. On ns-3-test-1 run "ping ns-3-test-2" to verify;
| |
| h. On ns-3-test-2 run "ping ns-3-test-1" to verify;
| |
| | |
| At this point, you probably will want to set up users, shells, aliases, other
| |
| tools (emacs, ddd, etc) or whatever else you will be needing. For example,
| |
| I set up a new user to match my user name on all of the other ns-3-related
| |
| machines I work with, set the shell to bash, copied over my aliases, ssh keys,
| |
| etc., etc., yadda, yadda.
| |
| | |
| CAVEATS
| |
| a. Be careful about carelessly using disk space in these VMs. We have
| |
| intentionally limited the size of the backing disk file to 1 GB so we
| |
| don't consume all of your Windows resources. This does mean that you
| |
| will be limited to perhaps one or two full builds of ns-3 with regression
| |
| traces depending on what other stuff you install. If you run out of
| |
| disk, you can increase it using VMware tools installed for you in the
| |
| Windows "Command Prompt."
| |
| i. Open your "Command Prompt";
| |
| ii. Change into "C:\Program Files\VMWare\VMware Server;
| |
| iii. There is an executable there named "vmware-vdiskmanager.exe";
| |
| iv. Find the full path to the disk image file you want to increase;
| |
| v. Increase the disk size using the following recipe:
| |
| vmware-vdiskmanager -x 16GB "C:\Virtual Machines\ns-3-test-1\ub710jeos.vmdk"
| |
| | |
| Congratulations, you are now ns-3 emulation ready.
| |
| | |
| [[User:Craigdo|Craigdo]] 16:17, 6 August 2008 (EDT) | |
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)