Difference between revisions of "HOWTO make ns-3 interact with the real world"

From Nsnam
Jump to: navigation, search
(Created page with '{{TOC}} 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…')
 
m (Signal Propagation Emulation Integration: Typo corrected)
 
(97 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 specific functions to accomplish their goalsSince 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.
+
ns-3 is a simulator.  Its primary function is to simulate networks of communicating nodes and the traffic between themTo do this, ns-3 provides its primary abstractions of computing nodes with applications to generate traffic; and net devices and channels to move the traffic.
  
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.
+
Often, however, it is desirable to mix and match real and simulated entities.  For example, in order to validate a network model, one might create a simulation scenario, run the simulated model and gather statistics.  Then one might move to real hardware and run the same scenario.  One would then compare the results of the two run to verify that the simulation is indeed a faithful representation of the hardware to some specified degree under specified circumstancesOne might also envision a scenario in which a network configuration is prohobitively expensive to create using real hardware.  In this case, one might want to simulate a large network, but use real applications to drive the simulation through some virtualization scheme.
  
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 VirtualBoxWe 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).
+
There are a number of ways that once could conceive of connecting various real and simulated componentsThis HOWTO discusses the ns-3 mechanisms for combining these components.
  
[[Image:Screenshot_fc11.png]]
+
== HOWTO make ns-3 interact with the real world ==
  
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].
+
Given the abstractions of computing nodes and networks; and the physical state of real or simulated, one can compose a table of possible configurations:
  
== HOWTO use VirtualBox to run simulations on Windows machines ==
+
{| border=1 cellspacing=0 cellpadding=5
 +
!
 +
! colspan="3" align="center" | Networks
 +
|-
 +
! rowspan="3" align="center" | Nodes
 +
| || align="center" | '''Real''' || align = "center" | '''Simulated'''
 +
|-
 +
| align= "center" | '''Real''' || align="center" | Your Computer and Network || align="center" style="background:#efefef;" | ns-3 TAP
 +
|-
 +
| align="center" | '''Simulated''' || align="center" style="background:#efefef;" | ns-3 EMU || align="center" | ns-3 Native Simulation
 +
|}
  
1.  The first thing you must do is get the VirtualBox binaries.
+
To read this table, find the "physicality" (real or simulated) of the networks in a column and the "physicality" of the nodes in a row and find the technology you want to look at the intersectionFor example, if you want to use a simulated network and real computing nodes, you are directed to something called "ns-3 TAP." If you want to use simulated nodes and real networks, you are expected to use a technology called "ns-3 EMU." From the perspective of this HOWTO, these are the interesting cases of integrating real and simulated hosts and networks; and these cases are shaded in gray.
    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 linkYou will get the usual '''File Download - Security'''
+
        '''Warning''' dialogJust 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''' dialogJust select '''Run'''.
+
  
2.  Step through the '''Sun VirtualBox Setup Wizard'''.
+
=== Preliminaries ===
    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.
+
The first step for anyone interested in ns-3 simulations of any kind is to visit [http://www.nsnam.org/docs/release/tutorial.html The ns-3 Tutorial] and work through the entire documentThere are lots of answers to common questions there; and you can become a fairly sophisticated ns-3 user just by spending a few hours there.
    a.  Press the '''Install''' button to start the installation process.
+
    bYou 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.
+
  
4Register 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.
+
If you are not up to speed on the material covered in the tutorial, you will most likely not understand the ns-3 scenari givenWe will assume some facility with ns-3, so you are encouraged to spend the time with the tutorialReally.  Please.
  
----
+
== Simulated Nodes and Simulated Networks ==
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].
+
If you are interested in using ns-3 to simulate both nodes and devices, there are dozens of great examples to be found in the ns-3 distributions under the examples directory.  Spending some time perusing the examples will be time well spent.  Make sure to go through the tutorial first (do you sense a pattern here), and you will find them fairly easy going.
----
+
 
 +
== Real Nodes and Simulated Networks ==
 +
This is an important use-case for ns-3.  We want to be able to use real applications, but we don't want to have to actually assemble large networks of computers and attempt to control them. In this mode, we really want to create '''virtual''' nodes and connect them through simulated networks.  A better way to think of this is real applications running on virtual computers, talking over '''simulated''' networks.
 +
 
 +
There are many different virtualization solutions available to work with.  Technically, what we are talking about is platform virtualization.  Platform virtualization can be further broken down into full virtualization and paravirtualization.  You can think of these as heavyweight and lightweight solutions, respectively.
 +
 
 +
=== Full Virtualization ===
 +
 
 +
In full virtualization, a virtual machine environment is created that completely simulates some underlying hardware and OS environment.  Using this technology, one can make a single system appear to be multiple systems of the same or different types.  For example, one could run a virtualization system on Windows that gave the appearance of multiple Windows systems, multiple Linux systems or some mix of these or other environments.  One example of a full virtualization system is [http://en.wikipedia.org/wiki/VMware_Workstation VMWare].  Another is [http://www.virtualbox.org VirtualBox]Full virtualization environments are considered heavyweight systems since every aspect of a target machine must be simulated, and individual virtual machines must be completely isolated from one another.
 +
 
 +
=== Paravirtualization ===
 +
 
 +
In paravirtualization, a virtual machine environment is created but an underlying machine is not completely simulated.  In one form, this requires porting of the guest (virtualized) operating system to a virtualization environmentIn another form, the underlying host operating system is used to create the illusion of virtualization of some parts of the underlying host hardware. The second form of paravirtualization is most lightweight and therefore most suitable to running many instances of virtual (simulated) nodes in ns-3.  Examples of paravirtualization systems of this kind are [http://www.ibm.com/developerworks/linux/library/l-lxc-containers/ Linux Containers] and [http://wiki.openvz.org/Main_Page OpenVZ].  This kind of solution will allow one to create virtual Linux guest systems on a Linux host system, but would not allow one to create virtual Windows systems on a Linux host system.
 +
 
 +
=== Mix and Match ===
 +
 
 +
The technology to use for virtualization will vary according to your needs.  Since ns-3 is primarily a Linux-based system, we concentrate on virutalization systems for Linux.  Full virtualization and paravirtualization schemes may be combined to suit individual needs.  For example, I have a Windows machine at home.  In order to run ns-3 under Linux, I personally use [http://www.virtualbox.org VirtualBox], a full virtualization system.  I run a virtual machine running the Fedora 12 OS which supports Linux Containers (lxc).  I then use the paravirtualization of the lxc tools to create multiple virtual hosts which I then wire together using ns-3 simulated networks.  Although this configuration is not going to win any speed contests, it is a much ligher-weight solution than running multiple fully virtualized Linux systems under VMware, for example; and makes a reasonable development system.  If I have the need for speed, I will turn to a server-grade multiple core system running Linux directly, and use paravirtualization there to combine raw power and lightweight virtualization.
 +
 
 +
=== ns-3 TapBridge ===
 +
 
 +
Fortunately, the same basic mechanism allows ns-3 to work with both virtualization and paravirtualization systems.  Since ns-3 is a Linux-based system, we use a Linux mechanism to implement the required functionality.  We call this mechanism the ns-3 TAP mecanism.  This uses a special net device called a TapBridge; Tap coming from the tun/tap device which is the Linux device driver used to make the connection from ns-3 to the Linux guest operating system, and Bridge since it conceptually extends a Linux (brctl) bridge into ns-3.
 +
 
 +
=== HOWTOs ===
 +
 
 +
If you decide to go the route of paravirtualization, we have a HOWTO that describes the process of creating virtual machines using Linux Containers:  [[HOWTO Use Linux Containers to set up virtual networks]].  If you have a Windows machine and you would like to get Fedora 12 running as a fully virtualized system, see [[HOWTO use VirtualBox to run simulations on Windows machines]] for a description of how to get Fedora 12 on your system before proceeding with the first HOWTO.
 +
 
 +
If you decide to go with full virtualization, we have a HOWTO that describes the process of creating virtual machines using VMware:  [[HOWTO use VMware to set up virtual networks (Windows)]].
 +
 
 +
== Simulated Nodes and Real Networks ==
  
5Download a Linux CD image.
+
While this is perhaps not as often used as the ns-3 TAP case, using simulated nodes along with real networks can also be important when validating modelsIn general, one needs to have some assurance that a model has some connection to some reality -- that a model is an accurate representation of a real system. In other words, if you are going to use a simulation model to try and predict how some real system is going to behave, you must have some reason to believe your results -- i.e., that you can trust that an inference made from the model translates into a correct prediction for the real system.  
    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 [http://www.nsnam.org/wiki/index.php/Main_Page 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 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 [http://fedoraproject.org/ The Fedora Project] and then to [http://fedoraproject.org/en/get-fedora 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.
+
Every model has a target system that it is attempting to simulate to some level of detail and accuracyThe process of getting the model behavior to agree with the target system behavior is called model validationThe process used to validate a model is conceptually quite simple. One compares the behavior of the model to the behavior of the target system, and makes adjustments to the model to improve the correlationBeing able to use ns-3 applications to drive both simulated networks and real networks makes these comparisons easier.
    a.  Go to the Sun VirtualBox window you started in step 3.
+
    bPress the "New" button.  This will start a '''New Virtual Machine Wizard'''.
+
    c.  Press '''Next >''' in the wizard.
+
    dGive 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.
+
    iKeeping 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 sideOn the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.
+
It may also be the case that one has a simulated application one is using to drive ns-3 scenariThe perspective above could be inverted and the real network could be used to validate the simulated applictation by allowing it to connect with real clients or servers, for example.
    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.
+
In either situation, the use cases are addressed by the ns-3 EMU net deviceEMU is from network '''emu'''lationNetwork emulation is a term that refers to the ability to allow the simulator to inject traffic into a live network and vice versa.   
    a.  Select the '''Start''' icon in the Sun VirtualBox windowIt 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'''.
+
    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 guideDo 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.
+
=== Testbed Integration ===
    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.
+
Often the "live network" is a testbed facility of some kindThe [http://www.orbit-lab.org/ ORBIT] testbed is perhaps the best known of these facilities.  It is a large two-dimensional grid of 400 802.11 radio nodes which can be dynamically interconnected into specified topologiesThe idea is to have a controlled environment that helps gain reproducibilityWe have several HOWTOs discussing how to integrate ns-3 and ORBIT:
    a.  Select the '''Start''' icon in the Sun VirtualBox window.  It is shaped like
+
        a green arrow.
+
    bYou'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 [http://www.nsnam.org/wiki/index.php/Installation#Prerequisites here].
+
* [[HOWTO use ns-3 scripts to drive real hardware (experimental)]]
    a.  yum install libxml2 libxml2-devel
+
* [[HOWTO use ns-3 directly on the ORBIT testbed hardware]]
    b.  yum install gcc gcc-c++ make automake autoconf binutils
+
* [[HOWTO use ns-3 in the ORBIT testbed environment]]
    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
+
=== Signal Propagation Emulation Integration ===
    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"!
+
Another approach is to use real network cards along with a wireless signal propagation emulator.  This allows for even more reproducible results than on a testbed with the advantage of not requiring a space the size of a hockey rink.  One example of this approach is the [http://www.cs.cmu.edu/~emulator/ CMU Wireless Emulator].  This system uses a wireless network emulator that accurately emulates wireless signal propagation.  The emulator takes in the signals generated by wireless network cards and subjects them to the same effects that occur in the real world (e.g. attenuation, multi-path fading, etc.).  It then feeds the combined signals back into the wireless cards.  We have one HOWTO describing how this system is integrated with ns-3.
  
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 [http://www.virtualbox.org/manual/UserManual.html#id2507643 here] in the user manual.
+
* [[HOWTO use ns-3 directly on the CMU wireless emulator]]
  
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.
+
== Real Nodes and Real Networks ==
 +
I'm afraid ns-3 isn't going to be able to help you with this oneMaybe you should consider replacing some of those expensive nodes and networks with simulations.
  
 
----
 
----
[[User:Craigdo|Craigdo]] 03:13, 9 February 2010 (UTC)
+
[[User:Craigdo|Craigdo]] 05:55, 17 February 2010 (UTC)

Latest revision as of 08:49, 1 August 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 a simulator. Its primary function is to simulate networks of communicating nodes and the traffic between them. To do this, ns-3 provides its primary abstractions of computing nodes with applications to generate traffic; and net devices and channels to move the traffic.

Often, however, it is desirable to mix and match real and simulated entities. For example, in order to validate a network model, one might create a simulation scenario, run the simulated model and gather statistics. Then one might move to real hardware and run the same scenario. One would then compare the results of the two run to verify that the simulation is indeed a faithful representation of the hardware to some specified degree under specified circumstances. One might also envision a scenario in which a network configuration is prohobitively expensive to create using real hardware. In this case, one might want to simulate a large network, but use real applications to drive the simulation through some virtualization scheme.

There are a number of ways that once could conceive of connecting various real and simulated components. This HOWTO discusses the ns-3 mechanisms for combining these components.

HOWTO make ns-3 interact with the real world

Given the abstractions of computing nodes and networks; and the physical state of real or simulated, one can compose a table of possible configurations:

Networks
Nodes Real Simulated
Real Your Computer and Network ns-3 TAP
Simulated ns-3 EMU ns-3 Native Simulation

To read this table, find the "physicality" (real or simulated) of the networks in a column and the "physicality" of the nodes in a row and find the technology you want to look at the intersection. For example, if you want to use a simulated network and real computing nodes, you are directed to something called "ns-3 TAP." If you want to use simulated nodes and real networks, you are expected to use a technology called "ns-3 EMU." From the perspective of this HOWTO, these are the interesting cases of integrating real and simulated hosts and networks; and these cases are shaded in gray.

Preliminaries

The first step for anyone interested in ns-3 simulations of any kind is to visit The ns-3 Tutorial and work through the entire document. There are lots of answers to common questions there; and you can become a fairly sophisticated ns-3 user just by spending a few hours there.

If you are not up to speed on the material covered in the tutorial, you will most likely not understand the ns-3 scenari given. We will assume some facility with ns-3, so you are encouraged to spend the time with the tutorial. Really. Please.

Simulated Nodes and Simulated Networks

If you are interested in using ns-3 to simulate both nodes and devices, there are dozens of great examples to be found in the ns-3 distributions under the examples directory. Spending some time perusing the examples will be time well spent. Make sure to go through the tutorial first (do you sense a pattern here), and you will find them fairly easy going.

Real Nodes and Simulated Networks

This is an important use-case for ns-3. We want to be able to use real applications, but we don't want to have to actually assemble large networks of computers and attempt to control them. In this mode, we really want to create virtual nodes and connect them through simulated networks. A better way to think of this is real applications running on virtual computers, talking over simulated networks.

There are many different virtualization solutions available to work with. Technically, what we are talking about is platform virtualization. Platform virtualization can be further broken down into full virtualization and paravirtualization. You can think of these as heavyweight and lightweight solutions, respectively.

Full Virtualization

In full virtualization, a virtual machine environment is created that completely simulates some underlying hardware and OS environment. Using this technology, one can make a single system appear to be multiple systems of the same or different types. For example, one could run a virtualization system on Windows that gave the appearance of multiple Windows systems, multiple Linux systems or some mix of these or other environments. One example of a full virtualization system is VMWare. Another is VirtualBox. Full virtualization environments are considered heavyweight systems since every aspect of a target machine must be simulated, and individual virtual machines must be completely isolated from one another.

Paravirtualization

In paravirtualization, a virtual machine environment is created but an underlying machine is not completely simulated. In one form, this requires porting of the guest (virtualized) operating system to a virtualization environment. In another form, the underlying host operating system is used to create the illusion of virtualization of some parts of the underlying host hardware. The second form of paravirtualization is most lightweight and therefore most suitable to running many instances of virtual (simulated) nodes in ns-3. Examples of paravirtualization systems of this kind are Linux Containers and OpenVZ. This kind of solution will allow one to create virtual Linux guest systems on a Linux host system, but would not allow one to create virtual Windows systems on a Linux host system.

Mix and Match

The technology to use for virtualization will vary according to your needs. Since ns-3 is primarily a Linux-based system, we concentrate on virutalization systems for Linux. Full virtualization and paravirtualization schemes may be combined to suit individual needs. For example, I have a Windows machine at home. In order to run ns-3 under Linux, I personally use VirtualBox, a full virtualization system. I run a virtual machine running the Fedora 12 OS which supports Linux Containers (lxc). I then use the paravirtualization of the lxc tools to create multiple virtual hosts which I then wire together using ns-3 simulated networks. Although this configuration is not going to win any speed contests, it is a much ligher-weight solution than running multiple fully virtualized Linux systems under VMware, for example; and makes a reasonable development system. If I have the need for speed, I will turn to a server-grade multiple core system running Linux directly, and use paravirtualization there to combine raw power and lightweight virtualization.

ns-3 TapBridge

Fortunately, the same basic mechanism allows ns-3 to work with both virtualization and paravirtualization systems. Since ns-3 is a Linux-based system, we use a Linux mechanism to implement the required functionality. We call this mechanism the ns-3 TAP mecanism. This uses a special net device called a TapBridge; Tap coming from the tun/tap device which is the Linux device driver used to make the connection from ns-3 to the Linux guest operating system, and Bridge since it conceptually extends a Linux (brctl) bridge into ns-3.

HOWTOs

If you decide to go the route of paravirtualization, we have a HOWTO that describes the process of creating virtual machines using Linux Containers: HOWTO Use Linux Containers to set up virtual networks. If you have a Windows machine and you would like to get Fedora 12 running as a fully virtualized system, see HOWTO use VirtualBox to run simulations on Windows machines for a description of how to get Fedora 12 on your system before proceeding with the first HOWTO.

If you decide to go with full virtualization, we have a HOWTO that describes the process of creating virtual machines using VMware: HOWTO use VMware to set up virtual networks (Windows).

Simulated Nodes and Real Networks

While this is perhaps not as often used as the ns-3 TAP case, using simulated nodes along with real networks can also be important when validating models. In general, one needs to have some assurance that a model has some connection to some reality -- that a model is an accurate representation of a real system. In other words, if you are going to use a simulation model to try and predict how some real system is going to behave, you must have some reason to believe your results -- i.e., that you can trust that an inference made from the model translates into a correct prediction for the real system.

Every model has a target system that it is attempting to simulate to some level of detail and accuracy. The process of getting the model behavior to agree with the target system behavior is called model validation. The process used to validate a model is conceptually quite simple. One compares the behavior of the model to the behavior of the target system, and makes adjustments to the model to improve the correlation. Being able to use ns-3 applications to drive both simulated networks and real networks makes these comparisons easier.

It may also be the case that one has a simulated application one is using to drive ns-3 scenari. The perspective above could be inverted and the real network could be used to validate the simulated applictation by allowing it to connect with real clients or servers, for example.

In either situation, the use cases are addressed by the ns-3 EMU net device. EMU is from network emulation. Network emulation is a term that refers to the ability to allow the simulator to inject traffic into a live network and vice versa.

Testbed Integration

Often the "live network" is a testbed facility of some kind. The ORBIT testbed is perhaps the best known of these facilities. It is a large two-dimensional grid of 400 802.11 radio nodes which can be dynamically interconnected into specified topologies. The idea is to have a controlled environment that helps gain reproducibility. We have several HOWTOs discussing how to integrate ns-3 and ORBIT:

Signal Propagation Emulation Integration

Another approach is to use real network cards along with a wireless signal propagation emulator. This allows for even more reproducible results than on a testbed with the advantage of not requiring a space the size of a hockey rink. One example of this approach is the CMU Wireless Emulator. This system uses a wireless network emulator that accurately emulates wireless signal propagation. The emulator takes in the signals generated by wireless network cards and subjects them to the same effects that occur in the real world (e.g. attenuation, multi-path fading, etc.). It then feeds the combined signals back into the wireless cards. We have one HOWTO describing how this system is integrated with ns-3.

Real Nodes and Real Networks

I'm afraid ns-3 isn't going to be able to help you with this one. Maybe you should consider replacing some of those expensive nodes and networks with simulations.


Craigdo 05:55, 17 February 2010 (UTC)