Difference between revisions of "HOWTO use VirtualBox to run simulations on Windows machines"

From Nsnam
Jump to: navigation, search
(Add link to configure 64-bit VMs on 64-bit Windows 8 or 10 host machines)
 
(65 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
  
ns-3 is primarily a Linux platform and advanced ns-3 features will use Linux
+
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 a widely used platform, ns-3 does provide a supported solution for running in that environment using a Linux-emulation environment called [http://cygwin.com 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.
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 [[http://cygwin.com 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
+
Fortunately, 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 are sharing your hardware.
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
+
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.  The following image is a screenshot of Fedora running as a virtual machine on a Windows XP (classic) desktop.  You can probably make out that the terminal session on Fedora has just completed running the ns-3 test suite (test.py).
popular are VMware (see [[HOWTO use VMware to set up virtual networks (Windows)]])
+
and VirtualBox.  We will cover VirtualBox in this HOWTO.
+
  
There is extensive documemtation available online for VirtualBox.  Look  
+
[[Image:Screenshot_fc11.png]]
[[http://www.virtualbox.org/ here]] for a starting point. Note that by downloading
+
 
the VirtualBox code you are implicitly agreeing to  
+
There is extensive documentation available online for VirtualBox.  Look [http://www.virtualbox.org/ here] for a starting point. Note that by downloading the VirtualBox code you are implicitly agreeing to [http://www.virtualbox.org/wiki/VirtualBox_PUEL this license].
[[http://www.virtualbox.org/wiki/VirtualBox_PUEL this license]].
+
 
 +
If you are using a 64-bit Windows 8 or 10 host machine, follow [http://www.fixedbyvonnie.com/2014/11/virtualbox-showing-32-bit-guest-versions-64-bit-host-os/#.WXBmZoSPLIU this tutorial] in order to configure 64-bit virtual machines (or even have access to the virtual cores of the host in the VirtualBox configuration window).
  
 
== HOWTO use VirtualBox to run simulations on Windows machines ==
 
== HOWTO use VirtualBox to run simulations on Windows machines ==
  
The first thing you must do is to figure out what kind of hardware
+
1.  The first thing you must do is get the VirtualBox binaries.
1.  Get the VMware server software
+
     a.  Go to [http://www.virtualbox.org/wiki/Downloads the VirtualBox downloads page]
    a.  You may read in various release notes or documentation that you need
+
     b.  Download and run the VirtualBox binary for Windows Hosts by clicking on
        Microsoft servers of various kinds.  This is not the case.  You can
+
         the x86/amd64 link.  You will get the usual '''File Download - Security'''
        run VMware server on XP just fine;
+
         '''Warning''' dialog.  Just click '''Run''' to download and run the about
    b.  Go to http://www.vmware.com/download/server/ to get the software;
+
         70 megabyte file.
    c. Select the Download Now button (download as usual);
+
     cAfter the file downloads, you will get the usual Windows '''Internet'''
    d.  Install the software in the usual way;
+
         '''Explorer - Security Warning''' dialogJust select '''Run'''.
    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 UUIDSelect 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.
+
     fPing 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
+
    amkdir 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"!
+
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.
  
Now it's time for a breather.  You have a configured Ubuntu JeOS Virtual Machine
+
3.  Perform the actual installation.  Warning:  This step will temporarily disconnect you from the Internet.
and you've built and tested ns-3 on itNow might be a good time to copy this
+
    a.  Press the '''Install''' button to start the installation process.
VM somewhere safe as your base machineIf you want to clone your machine you can
+
    b.  You will see a number of dialog boxes (six) complaining that VirtualBox
use this copy, or if you manage to wedge the VM, you can use the copy as a
+
        has not passed '''Windows Logo Testing'''.  Press '''Continue Anyway'''.
checkpoint and restore a working copy without going through all the pain we just
+
    cWhen you see the '''Sun VirtualBox installation is complete''' message
suffered through.  
+
        leave the '''Start Sun VirtualBox after installation''' radio button
 +
        selected.
 +
    d.  Press the '''Finish''' button.
  
8Checkpoint the VM
+
4Register with Sun OnlineVirtualBox 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 registration process complains about a bad IP address, just create a new account.
    alog out of the VM (exit);
+
    bPress 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.
+
Sidebar: In this HOWTO, we explain how to download a CD image from the web and use it to install a guest operating system in VirtualBox. There is an alternative, which is to start with a pre-configured OS "Virtual Applicance."  These are VMware things, but VirtualBox can read them. You can browse through hundreds of applicances [http://www.vmware.com/appliances/directory/cat/508 here].
 +
----
  
9Create new VM with a Private Network
+
5Download a Linux CD image.
     a.  Copy "c:\Virtual Machines\ub710jeos checkpoint" to another directory in
+
     a.  Decide which version of Linux you are going to use.  If you have no
         the "Virtual Machines" directory and call it "ns-3-test-1"
+
         strong preference, I would use the same version that ns-3 does most
    bSelect the File->Open menu option and Browse for the
+
        of its testing onLook [http://www.nsnam.org/wiki/index.php/Main_Page here] for the ns-3 wiki.  Follow the
         "ns-3-test-1" directory and open the "ub710jeos.vmx" file;
+
         [http://ns-regression.ee.washington.edu:8010/waterfall Buildbot Waterfall Display] link, and notice the list of platforms.   
    eSelect the "Edit virtual machine settings" command on the VMware Server
+
         At the time of this writing, most of them are fc10This translates
         Console;
+
        to Fedora Core 10You can infer that ns-3 testing is mostly performed
    dClick on the "Options" tab;
+
        on Fedora systems, so Fedora it is; and Fedora 12 is the latest release
    eEnter "ns-3-test-1" in the "Virtual machine name" text box;
+
        as of this writing.
    f.  Click on the "Hardware" tab;
+
     bGo to [http://fedoraproject.org/ The Fedora Project] and then to [http://fedoraproject.org/en/get-fedora Get Fedora] and download a
    g. Click on the "Add" button.  You will launch the "Add Hardware Wizard";
+
         CD image.  You will get the usual '''File Download - Do you want to open'''
     hClick "Next";
+
         '''or save this file?''' dialog.  Just click '''Save''' and tell the system
    i. Click "Ethernet Adapter" and then "Next";
+
         where to put the almost 700 megabyte file.
    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 itYou can repeat step nine
+
6.  Create a new virtual machine.
as many times as you want, renaming the VMs ns-3-test-2, ns-3-test-3, etcGo
+
    a.  Go to the Sun VirtualBox window you started in step 3.
ahead and make a ns-3-test-2 virtual machine just so we can do something
+
    b.  Press the "New" button.  This will start a '''New Virtual Machine Wizard'''.
interesting.
+
    c.  Press '''Next >''' in the wizard.
 +
    d.  Give your new virtual machine a name, say "ns-3-fedora-12".
 +
    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 the 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.
 +
    jPress '''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.
  
10. Start Your Virtual Test Network
+
7. "Insert" your boot CDIn the Sun VirtualBox window, you should now see avirtual machine named "ns-3-fedora-12" in the powered off state on the left sideOn the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.
    aSelect the "ns-3-test-1" tab on the VMware Server Console;
+
     aClick on the '''Storage''' item.
    bSelect the "Start this virtual machine" command on the VMware Server
+
     bUnder '''Storage Tree''' box, '''IDE Controller''', select the secondary master
        Console;
+
        which should say '''Empty''' at this point.
     cUbuntu JeOS will start in a "console window";
+
     cUnder the '''Attributes''' item there is a pulldown labeled '''CD/DVD Device'''.
     dYou should see an "ns-3-test-1 login" prompt when it comes up;
+
        Select the folder icon to the right.  This will load the VirtualBox
     e.  Select the "ns-3-test-2" tab on the VMware Server Console;
+
        '''Virtual Media Manager'''.
     f.  Select the "Start this virtual machine" command on the VMware Server
+
     d.  Select the '''Add''' action and navigate to the folder in which you saved the
         Console;
+
         Fedora 12 iso image aboveSelect the iso image which will '''insert''' it
    gUbuntu JeOS will start in a "console window."
+
        as if it were a real CD.
     hYou should see an "ns-3-test-2 login" prompt when it comes up;
+
     ePress OK to return to the main VirtualBox window.
  
You can now switch between the running virtual machines by selecting the
+
8.  Power up the virtual machine and install Fedora 12.
appropriate tab on the VMware Server ConsoleEnter a VM by clicking in the
+
    a.  Select the '''Start''' icon in the Sun VirtualBox windowIt is shaped like
console window and exit by pressing <ctrl>+<alt>Select another tab of a
+
        a green arrow.
running VM and enter that VM by clicking in the console window.  
+
    b.  Read the information dialog about how to get in and out of the virtual
 +
        machine window and press '''OK'''.
 +
    cRead the information dialog about color mode and press '''OK'''.
 +
    d.  Click into the new virtual machine window, select '''Capture''' and
 +
        watch Fedora 12 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 begin the Fedora 12 installation process and copy the
 +
        image to the virtual machine hard drive.  This is going to take some
 +
        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
 +
        12 installation guide.  Do remember that you will have to initialize your
 +
        virtual hard disk since you just "created" it.  Google is your friend if
 +
        you have problems.
 +
    g.  Eventually you'll see "Congratulations, your Fedora installation is
 +
        complete".  Press '''Close'''.
 +
    h.  Shut down the Fedora system.
  
12. Update /etc/hosts and Check Connectivity
+
9.  "Remove" your boot CDIn the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-12" in the powered off state on the left sideOn the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.
    aLog in to "ns-3-test-1" as root;
+
    a. Click on the '''Storage''' item.
    bRun ifconfig -a and note the IP address of eth1;
+
     bClick on the '''Fedora-12-i686-Live.iso''' CD in the '''IDE Controller''' under '''Storage Tree'''.
    c.  Log in to "ns-3-test-2" as root;
+
     cSelect '''Empty''' under the '''CD/DVD Device''' pulldown.
    dRun ifconfig -a and note the IP address of eth1;
+
     dPress '''OK'''.
    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";
+
     fEdit (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";
+
     gOn ns-3-test-1 run "ping ns-3-test-2" to verify;
+
     hOn 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
+
10. Bring up your shiny new Fedora 12 system.
tools (emacs, ddd, etc) or whatever else you will be needingFor example,
+
    a.  Select the '''Start''' icon in the Sun VirtualBox window.  It is shaped like
I set up a new user to match my user name on all of the other ns-3-related
+
        a green arrow.
machines I work with, set the shell to bash, copied over my aliases, ssh keys,  
+
    b.  You'll have to do a few more setup steps (create a user) in the Fedora
etc., etc., yadda, yadda.
+
        '''Setup Agent'''This will reboot one more time and then you can log
 +
        in with your new user name.
 +
 
 +
11. Install the GNU toolchain and some useful tools.  If you have added yourself as a sudoer, you can run the following commands (or others according to your taste) using sudo, otherwise log on as root.  A more complete list is available [http://www.nsnam.org/wiki/index.php/Installation#Prerequisites here].
 +
    a.  yum install libxml2 libxml2-devel
 +
    b.  yum install gcc gcc-c++ make automake autoconf binutils
 +
    c.  yum install openssh-server openssh-clients openssl
 +
    d.  yum install python python-devel mercurial bzr
 +
    e.  yum install scons flex bison
 +
    f.  yum install tcpdump valgrind gdb emacs
 +
 
 +
12. Get and Test ns-3-dev
 +
    a.  Make sure you have exited from su root, if you did that in step 11.
 +
    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"!
  
CAVEATS
+
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. The screen shot at the top of the page was taken of a my home system which has these additions enabledSee the VirtualBox documentation for instructions, perhaps starting [http://www.virtualbox.org/manual/UserManual.html#id2507643 here] in the user manual.
    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";
+
        iiChange 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.
+
Note that if you installed Fedora 12, you may have to freshen your distribution to get this to work (if you see modprobe errors); and you may have to set KERN_DIR yourself to "/usr/src/kernels/'''your kernel version'''".  Hopefully this will get resolved as the Fedora 12 and VirtualBox combination is fully sorted.
  
[[User:Craigdo|Craigdo]] 16:17, 6 August 2008 (EDT)
+
----
 +
[[User:Craigdo|Craigdo]] 03:13, 9 February 2010 (UTC)

Latest revision as of 09:02, 20 July 2017

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

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 a widely used platform, 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.

Fortunately, 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 are 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. The following image is a screenshot of Fedora running as a virtual machine on a Windows XP (classic) desktop. You can probably make out that the terminal session on Fedora has just completed running the ns-3 test suite (test.py).

Screenshot fc11.png

There is extensive documentation available online for VirtualBox. Look here for a starting point. Note that by downloading the VirtualBox code you are implicitly agreeing to this license.

If you are using a 64-bit Windows 8 or 10 host machine, follow this tutorial in order to configure 64-bit virtual machines (or even have access to the virtual cores of the host in the VirtualBox configuration window).

HOWTO use VirtualBox to run simulations on Windows machines

1. The first thing you must do is get the VirtualBox binaries.

   a.  Go to 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.

4. 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 registration process complains about a bad IP address, just create a new account.


Sidebar: In this HOWTO, we explain how to download a CD image from the web and use it to install a guest operating system in VirtualBox. There is an alternative, which is to start with a pre-configured OS "Virtual Applicance." These are VMware things, but VirtualBox can read them. You can browse through hundreds of applicances here.


5. 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
       Buildbot Waterfall Display link, and notice the list of platforms.  
       At the time of this writing, most of them are fc10.  This translates
       to Fedora Core 10.  You can infer that ns-3 testing is mostly performed
       on Fedora systems, so Fedora it is; and Fedora 12 is the latest release
       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.

6. Create 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-12".
   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 the 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.

7. "Insert" your boot CD. In the Sun VirtualBox window, you should now see avirtual machine named "ns-3-fedora-12" 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-12" displayed.

   a.  Click on the Storage item.
   b.  Under Storage Tree box, IDE Controller, select the secondary master
       which should say Empty at this point.
   c.  Under the Attributes item there is a pulldown labeled CD/DVD Device.
       Select the folder icon to the right.  This will load the VirtualBox
       Virtual Media Manager.
   d.  Select the Add action and navigate to the folder in which you saved the
       Fedora 12 iso image above.  Select the iso image which will insert it
       as if it were a real CD.
   e.  Press OK to return to the main VirtualBox window.

8. Power up the virtual machine and install Fedora 12.

   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 virtual
       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 12 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 begin the Fedora 12 installation process and copy the
       image to the virtual machine hard drive.  This is going to take some
       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
       12 installation guide.  Do remember that you will have to initialize your
       virtual hard disk since you just "created" it.  Google is your friend if 
       you have problems.
   g.  Eventually you'll see "Congratulations, your Fedora installation is 
       complete".  Press Close.
   h.  Shut down the Fedora system.

9. "Remove" your boot CD. In the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-12" 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-12" displayed.

   a.  Click on the Storage item.
   b.  Click on the Fedora-12-i686-Live.iso CD in the IDE Controller under Storage Tree.
   c.  Select Empty under the CD/DVD Device pulldown.
   d.  Press OK.

10. Bring up your shiny new Fedora 12 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.

11. Install the GNU toolchain and some useful tools. If you have added yourself as a sudoer, you can run the following commands (or others according to your taste) using sudo, otherwise log on as root. A more complete list is available here.

   a.  yum install libxml2 libxml2-devel
   b.  yum install gcc gcc-c++ make automake autoconf binutils
   c.  yum install openssh-server openssh-clients openssl
   d.  yum install python python-devel mercurial bzr 
   e.  yum install scons flex bison
   f.  yum install tcpdump valgrind gdb emacs

12. Get and Test ns-3-dev

   a.  Make sure you have exited from su root, if you did that in step 11.
   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. The screen shot at the top of the page was taken of a my home system which has these additions enabled. See the VirtualBox documentation for instructions, perhaps starting here in the user manual.

Note that if you installed Fedora 12, you may have to freshen your distribution to get this to work (if you see modprobe errors); and you may have to set KERN_DIR yourself to "/usr/src/kernels/your kernel version". Hopefully this will get resolved as the Fedora 12 and VirtualBox combination is fully sorted.


Craigdo 03:13, 9 February 2010 (UTC)