Ns3 on VirtualBox

Navigation: Main > ns3  > virtual box setup

= Overview = We reviews all the steps to set up the ns-3 emulation in a virtual Linux machine on your Windows or MAC computer. A similar procedure can be used to set up a native Ubuntu machine. The virtual machine will let you run the ns-3 code, but not in real-time. You can use this mode for development and transfer the final code to the actual testbed later.

The main steps are: = Installation Steps =
 * Ubuntu “Lucid Linx” in VirtualBox
 * Eclipse IDE + C++ Dev Tools
 * ns-3 network simulator
 * Linux containers (LXCs)
 * MPI

Installing an Ubuntu Guest on a Windows Host in VirtualBox

 * 1) Download required installation files:
 * 2) * Oracle VirtualBox Windows
 * 3) * Ubuntu “Lucid Linux” Desktop Edition iso
 * 4) *Select your architecture (32-bit/64-bit) and latest version and download
 * 5) Run the VirtualBox installer and install all necessary software and drivers
 * 6) Create a new virtual machine: Open the VirtualBox Manager that you installed and select Machine > New. Select Next in the Create New Virtual Machine wizard. Under Name, type Ubuntu and make sure that Linux and Ubuntu are selected for Operating System and Version, respectively. Click Next.
 * 7) *In the Memory dialog, set the Base Memory Size to around half of your system’s total physical memory (e.g. for 4GB of physical, enter 2048MB). This can be adjusted later. Next.
 * 8) *Under Virtual Hard Disk, leave defaults and click Next. Click Next
 * 9) *In the Create New Virtual Disk wizard, click next. Under Hard Disk Storage Type, leave defaults and click Next.
 * 10) *Under Virtual Disk Location and Size, enter some reasonable size for the virtual disk image (e.g. 16GBs). Click Next and then Finish on the next screen then Finish again in the Summary dialog.
 * 11) *Note: The image file will only actually take up this much space when the VDI is full since it is “dynamically expanding.”
 * 12) Install the Ubuntu guest:
 * 13) *In VirtualBox Manager, right click the VM you just created (Ubuntu) and select Start.
 * 14) *In the First Run Wizard, click Next. Under Select Installation Media, click the folder icon next to the Media Source drop menu. Browse to where you downloaded the Ubuntu iso file and open it. Next then Finish.
 * 15) *A new window should appear with the Ubuntu installer booting up in the VM. Select Install Ubuntu 10.x from in the first dialog.
 * 16) *United States (New York) should be selected for the Time Zone. Forward. The Keyboard Layout should be USA. Forward.
 * 17) *Under Prepare Disk Space, leave defaults. Forward.
 * 18) *Under Who Are You, enter and username, password and hostname. Next and Install on the following screen. Wait for installation to finish and click Restart Now when prompted.
 * 19) *Your fresh install will boot up. Login to your user account. Almost immediately the Update Manager should appear. Go ahead and Install Updates.
 * 20) Install VirtualBox Guest Additions and set up shared folders
 * 21) *The Guest Additions tools enable improved graphics features/”seamless mode” and shared folders for accessing your Windows filesystem from inside the VM.
 * 22) *With your Ubuntu VM started, select Devices > Install Guest Additions in the VM window.
 * 23) *Open the VBOXADDITIONS_4.x.x_etc mount from the Places menu. Copy the file VBoxLinuxAdditions.run from this directory to your desktop.
 * 24) *Open a new terminal from Applications > Accessories > Terminal. You may want to create a shortcut to the Terminal on your desktop (just drag and drop it from Accessories) for later.
 * 25) *In the terminal, type the following (case-sensitive) commands to install Guest Additions #:Note: press tab to autocomplete a partially-typed command, directory, or filename or double tab for options):
 * cd ~/Desktop Changes the directory to /home/your_username/Desktop ( ‘~’ means your home directory)
 * chmod +x ./VBoxLinuxAdditions.run Sets the installer as executable
 * sudo. ./VBoxLinuxAdditions.run Runs the installer in superuser mode (sudo). ‘./’ means run from the current directory. Wait for the installation to finish.
 * 1) *Now we will set up a shared folder to access your Windows files.
 * 2) **From the VM window, select Devices > Shared Folders.
 * 3) **In the window that comes up, click the folder icon with the plus symbol.
 * 4) **In the Add Share window under Folder Path, type Windows directory you want to share (e.g. to share your C drive, enter C:\). Enter the Linux Folder Name (it may automatically choose C_DRIVE, which is fine). Also select Make Permanent only. Click OK.
 * 5) **Next we will configure the shared folder to be mounted automatically.
 * 6) **In the terminal, type:


 * sudo mkdir /media/C_DRIVE Makes a directory where the share is to be mounted
 * sudo gedit /etc/fstab Opens the fstab file in the graphical editor
 * 1) *In Gedit, copy and append the following line at the end of the file:
 * C_DRIVE /media/ C_DRIVE vboxsf defaults 0 0
 * 1) **Save the file and quit Gedit.
 * 2) *Restart the VM (type sudo reboot in the terminal). Once you log back in, you can optionally create a symlink (shortcut) to the shared folder in your home directory:
 * ln –s /media/C_DRIVE ~/C_DRIVE
 * ln –s /media/C_DRIVE ~/C_DRIVE</tt>

Installing the development environment with ns-3
For the downloading and configuration procedures using the terminal, please refer to Ns-3 Configuration Using the Terminal; for those procedures using the Eclipse IDE, please refer to Ns-3 Configuration Using Eclipse.

Setting up virtual networks in Linux containers
http://www.nsnam.org/wiki/index.php/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks

Loading a VirtualBox Disk Image
<p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;">  1.<span style="font: 7pt/normal "Times New Roman"; font-size-adjust: none; font-stretch: normal;">   Open VirtualBox Manager. Select Machine > New



<p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;">  2.<span style="font: 7pt/normal "Times New Roman"; font-size-adjust: none; font-stretch: normal;">   Select Next on the first dialog. In the Create New Virtual Machine screen, type Maverick under Name. Note that the OS automatically changes to Ubuntu Linux. Click Next.



<p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;">  3.<span style="font: 7pt/normal "Times New Roman"; font-size-adjust: none; font-stretch: normal;">   Set the base memory size to some fraction of your PC’s total resident memory. Next.



<p style="margin: 0in 0in 10pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;">  4.<span style="font: 7pt/normal "Times New Roman"; font-size-adjust: none; font-stretch: normal;">   Under Virtual Hard Disk select ''Use existing hard disk. Now click the tiny little folder icon next to the drop menu and navigate to where you copied the Maverick.vdi'' on your drive. Load that file ( not the .vbox file). Next.



<p style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1;">  5.<span style="font: 7pt/normal "Times New Roman"; font-size-adjust: none; font-stretch: normal;">   Click Create on the last screen. Now you should see the VM listed in the manager window. If all went well, you should be able to click Start and boot into your Ubuntu Server environment.