HOWTO use VirtualBox to run simulations on Windows machines
ns-3 is primarily a Linux platform and advanced ns-3 features will use Linux specific functions to accomplish their goals. Since Windows is such as widely used platorm, ns-3 does provide a supported solution for running in that environment using a Linux-emulation environment called Cygwin. However, Cygwin is not a perfect emulation of any Linux. This means there will be features available on Linux systems that are simply not usable on Windows systems.
Fortnately, a technology called virtualization exists to allow one to share computer hardware between operating systems and allow you use Linux systems essentially as if they were running natively on your hardware. This happens as your Windows is running, so it appears as if Windows and Linux were sharing your hardware.
There are several virtualization schemes currently available. Two of the most popular are VMware (see HOWTO use VMware to set up virtual networks (Windows)) and VirtualBox. We will cover VirtualBox in this HOWTO.
HOWTO use VirtualBox to run simulations on Windows machines
1. The first thing you must do is get the VirtualBox binaries.
a. Go to [http://www.virtualbox.org/wiki/Downloads the VirtualBox downloads page] b. Download and run the VirtualBox binary for Windows Hosts by clicking on the x86/amd64 link. You will get the usual File Download - Security Warning dialog. Just click Run to download and run the about 70 megabyte file. c. After the file downloads, you will get the usual Windows Internet Explorer - Security Warning dialog. Just select Run.
2. Step through the Sun VirtualBox Setup Wizard.
a. Press the Next > button. b. Accept the terms of the license agrreement (if you desire) by clicking the corresponding radio button. c. Press the Next > button. d. Review the features that will be installed if you desire. I just accept them as-is. e. Press the Next > button. f. Decide if you want a desktop and quick lanch icon. If you expect to use ns-3 a lot it is probably worthwhile, but completely up to your preference g. Press the Next > button.
3. Perform the actual installation. Warning: This step will temporarily disconnect you from the Internet.
a. Press the Install button to start the installation process. b. You will see a number of dialog boxes (six) complaining that VirtualBox has not passed Windows Logo Testing. Press Continue Anyway. c. When you see the Sun VirtualBox installation is complete message leave the Start Sun VirtualBox after installation radio button selected. d. Press the Finish' button.
3. Register with Sun Online. VirtualBox will ask you to register with Sun Online. If you already have a Sun Online account, enter it or just fill out the account creation part of the page and press Register. If the restration process complains about a bad IP address, just create a new account.
4. Download a Linux CD image.
a. Decide which version of Linux you are going to use. If you have no strong preference, I would use the same version that ns-3 does most of its testing on. Look here for the ns-3 wiki. Follow the [http://ns-regression.ee.washington.edu:8010/waterfall Buildbot Waterfall Display]] link, and notice the list of platforms. At the time of this writing, most of them are fc10. This means Fedora Core 10. Fedora it is; and they are at Fedora 11 as of this writing. b. Go to The Fedora Project and then to Get Fedora and download a CD image. You will get the usual File Download - Do you want to open or save this file? dialog. Just click Save and tell the system where to put the almost 700 megabyte file.
5. Start a new virtual machine
a. Go to the Sun VirtualBox window you started in step 3. b. Press the "New" button. This will start a New Virtual Machine Wizard. c. Press Next > in the wizard. d. Give your new virtual machine a name, say "ns-3-fedora-11. e. In the OS Type box, select Linux as the Operating System and Fedora as the Version. f. Press Next > in the wizard. g. Keeping in mind how much physical memory you have in your host machine, give the new virtual machine some memory. This won't be available for your host machine. I choose 512 MB on my 2 GB Windows machine. h. Press Next > in the wizard. i. Keeping in mind how much hard disk space you have in your host machine give teh new virtual machine some memory. You will need disk for the base OS, the toolchain and at least one ns-3 distribution, which will require about 1.2 gig at the time of this writing. j. Press Next > in the New Virtual Machine Wizard to start the Create New Virtual Disk Wizard. k. Press Next > in the Create New Virtual Disk Wizard. l. Leave the Dynamically expanding storage radio button selected and press Next > in the Create New Virtual Disk Wizard. m. Select a maximum size for the disk (I use 10 GB) and press Next > in the Create New Virtual Disk Wizard. o. Press Finish in the Create New Virtual Disk Wizard to create your disk. p. This takes you back to the New Virtual Machine Wizard which will be giving you a summary of the new virtual machine parameters. Press Finish in the Create New Virtual Disk Wizard to create your new virtual machine.
6. "Insert" your boot CD. In the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-11" in the powered off state on the left side. On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-11" displayed.
a. Click on the CD/DVD-ROM item. b. Select the Mount CD/DVD Drive check box. c. Select the ISO Image FIle radio button. d. Browse for the ISO Image File. e. Select the "Add" Icon and browse to the ISO image file for Fedora 11 you saved in step 4. f. Press Select and then OK.
7. Power up the virtual machine and install Fedora 11.
a. Select the "Start" icon in the Sun VirtualBox window. It is shaped like a green arrow. b. Read the information dialog about how to get in and out of the virual machine window and press OK. c. Read the information dialog about color mode and press OK. d. Click into the new virtual machine window, select Capture and watch Fedora 11 start to install (this will take a while). e. When the login box appears, press "Log In" and then double click the Install to Hard Disk icon. f. Press 'Next to bein the Fedora 11 installation process and copy the image to the virtual machine hard drive. This is going to take somex considerable time since you are installing a whole operating system. We won't cover how to proceed here in detail since this is not a Fedora 11 installation guide. Google is your friend if you have problems. g. Eventually you'll see "Congratulations, your Fedora installation is comlete. Press Close. h. Shut down the Fedora system.
8. "Remove" your boot CD. In the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-11" in the powered off state on the left side. On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-11" displayed.
a. Click on the CD/DVD-ROM item. b. Deselect the Mount CD/DVD Drive check box. c. Press OK.
9. Bring up your shiny new Fedora 11 system.
a. Select the "Start" icon in the Sun VirtualBox window. It is shaped like a green arrow. b. You'll have to do a few more setup steps (create a user) in the Fedora Setup Agent. This will reboot one more time and then you can log in with your new user name.
10. Install the GNU toolchain and some tools. If you have configured sudo, you can run the following commands (or others according to your taste) using sudo, otherwise log on as root.
a. yum install libxml2 libxml2-dev b. yum install gcc gcc-c++ make automake autoconf binutils c. yum install openssh-server openssh-client openssl libssl-dev d. yum install python-dev mercurial scons flex bison e. yum install tcpdump gdb emacs
11. Get and Test ns-3-dev
a. Make sure you have exited from su root, if you did that in step 10. b. cd ~ c. mkdir repos d. cd repos e. hg clone http://code.nsnam.org/ns-3-allinone f. cd ns-3-allinone g. ./download.py h. ./build.py i. cd ns-3-dev j. ./test.py k. ./waf --regression
As an old math professor once said, "I feel joy"!
If you are really going to use a virtual machine as a primary development platform, you will probably be annoyed by the limitation of the device driver to 800x600 resolution. You can fix this by installing the so-called VirtualBox Guest Additions. This will aso get rid of the annoying "mouse capture" and "mouse release" business. If you install the Guest Additions, you can resize your virtual desktop to any size you want and mouse in and out of it just as if you were in a Windows window. Recommended. See the VirtualBox documentation for instructions.
Craigdo 19:48, 7 November 2009 (UTC)