Difference between revisions of "HOWTO Use Linux Containers to set up virtual networks"

From Nsnam
Jump to: navigation, search
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
  
One of the interesing ways ns-3 simulations can be integrated with real hardware is to create a simulated network and use "real" hosts to drive the network.  Often, the number of real hosts is relatively large, and so acquiring that number of real computers would be prohibitively expensive.  It is possible to use virtualization technology to create software implementations, called virtual machines, that execute software as if they were real hosts.
+
One of the interesing ways ns-3 simulations can be integrated with real hardware is to create a simulated network and use "real" hosts to drive the network.  Often, the number of real hosts is relatively large, and so acquiring that number of real computers would be prohibitively expensive.  It is possible to use virtualization technology to create software implementations, called virtual machines, that execute software as if they were real hosts.  If you have not done so, we recommend going over [[HOWTO make ns-3 interact with the real world]] to review your options.
  
If you have not done so, we recommend going over
+
This HOWTO discusses how one would configure and use a modern Linux system (e.g., Fedora 12) to run ns-3 systems using paravirtualization of resources with Linux Containers (lxc).
  
 +
== HOWTO Use Linux Containers to set up virtual networks ==
 +
=== Background ===
 +
Always know your tools.  In this context, the first step for those unfamiliar with Linux Containers is to get an idea of what it is we are talking about and where they live.  Linux Containers, also called "lxc tools," are a relatively new feature of Linux as of this writing.  They are an offshoot of what are called "chroot jails."  A quick explanation of the FreeBSD version can be found [http://en.wikipedia.org/wiki/FreeBSD_jail here].  It may be worth a quick read before continuing to help you understand some background and terminology better.
  
main points of using simulation software is that you don't have
+
If you peruse the web looking for references to Linux Containers, you will find that much of the existing documentation is based on [http://lxc.teegra.net/ this document]This is a rather low-level document, more of a reference than a HOWTO that makes Linux Containers actually look more complicated than they are to get started with[http://www.ibm.com/developerworks/linux/library/l-lxc-containers/ IBM DeveloperWorks] provides what they call a "tour and setup" document; but I find this document a little too abstract and high-level.  
to buy lots of hardware in order to investigate large configurationsWe
+
have a realtime emulation package that allows us to connect ns-3 to real
+
networks on real machines.  The problem, of course, is that you need lots
+
of real machines to run real programsUsing VMware, we replace "real
+
machines" with "virtual machines" and configure virtual networks of virtual
+
machines instead of having to work with tons of real hardware.
+
  
== HOWTO use VMware to set up virtual networks (Windows) ==
+
In this HOWTO, we will attempt to bridge the gap and give you a "just-right" presentation of Linux Containers and ns-3 that should get you started doing useful work without damaging too many brain cells.
  
1.  Get the VMware server software
+
'''We assume that youe a kernel that supports Linux Containers installed and configured on your host systemFedora 12 comes with Linux Containers enabled "out of the box" and we assume you are running that system."
    a.  You may read in various release notes or documentation that you need
+
 
        Microsoft servers of various kindsThis is not the case.  You can  
+
=== Get and Understand the Linux Container Tools ===
        run VMware server on XP just fine;
+
 
    bGo to http://www.vmware.com/download/server/ to get the software;
+
The first step in the process is to get the Linux Container Tools onto your systemAlthough the Fedora 12 system comes with Linux Containers enabled, it does not necessarily have the user tools installed.  You will need to install these tools, and also make sure you have the ability to create and configure bridges, and the ability to create and configure tap devices.  If you are a sudoer, you can type the following to install the required tools.
    cSelect the Download Now button (download as usual);
+
 
    dInstall the software in the usual way;
+
  sudo yum install lxc bridge-utils tunctl
    eIgnore warnings about requiring Microsoft IIS to continue.
+
 
 +
To see a summary of the Linux Container tool (lxc), you can now begin looking at man pagesThe place to star is with the '''lxc''' man page. Give that a read, keeping in mind that some details are not relevant at this time. Feel free to ignore the parts about kernel requirements and configuration and ssh daemonsSo go ahead and do,
 +
 
 +
  man lxc
 +
 
 +
and have a read.
 +
 
 +
The one configuration step you may have to do on Fedora 12 is to mount a cgroup directoryThis directory does not exist by default, so if you are the fist user to need that support you will have to create the directory and mount itGetting all of this to work will be easier if you are root, so we will assume you have this kind of privilege.  Go ahead and create teh cgroup directory and mount it.  This is done by,
 +
 
 +
  su
 +
  mkdir /cgroup
 +
  mount -t cgroup cgroup /cgroup
 +
 
 +
If you want to make this mount persistent, you will have to edit '''fstab'''.
  
 
----
 
----
 
[[User:Craigdo|Craigdo]] 17:47, 17 February 2010 (UTC)
 
[[User:Craigdo|Craigdo]] 17:47, 17 February 2010 (UTC)

Revision as of 18:30, 17 February 2010

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

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

One of the interesing ways ns-3 simulations can be integrated with real hardware is to create a simulated network and use "real" hosts to drive the network. Often, the number of real hosts is relatively large, and so acquiring that number of real computers would be prohibitively expensive. It is possible to use virtualization technology to create software implementations, called virtual machines, that execute software as if they were real hosts. If you have not done so, we recommend going over HOWTO make ns-3 interact with the real world to review your options.

This HOWTO discusses how one would configure and use a modern Linux system (e.g., Fedora 12) to run ns-3 systems using paravirtualization of resources with Linux Containers (lxc).

HOWTO Use Linux Containers to set up virtual networks

Background

Always know your tools. In this context, the first step for those unfamiliar with Linux Containers is to get an idea of what it is we are talking about and where they live. Linux Containers, also called "lxc tools," are a relatively new feature of Linux as of this writing. They are an offshoot of what are called "chroot jails." A quick explanation of the FreeBSD version can be found here. It may be worth a quick read before continuing to help you understand some background and terminology better.

If you peruse the web looking for references to Linux Containers, you will find that much of the existing documentation is based on this document. This is a rather low-level document, more of a reference than a HOWTO that makes Linux Containers actually look more complicated than they are to get started with. IBM DeveloperWorks provides what they call a "tour and setup" document; but I find this document a little too abstract and high-level.

In this HOWTO, we will attempt to bridge the gap and give you a "just-right" presentation of Linux Containers and ns-3 that should get you started doing useful work without damaging too many brain cells.

We assume that youe a kernel that supports Linux Containers installed and configured on your host system. Fedora 12 comes with Linux Containers enabled "out of the box" and we assume you are running that system."

Get and Understand the Linux Container Tools

The first step in the process is to get the Linux Container Tools onto your system. Although the Fedora 12 system comes with Linux Containers enabled, it does not necessarily have the user tools installed. You will need to install these tools, and also make sure you have the ability to create and configure bridges, and the ability to create and configure tap devices. If you are a sudoer, you can type the following to install the required tools.

 sudo yum install lxc bridge-utils tunctl

To see a summary of the Linux Container tool (lxc), you can now begin looking at man pages. The place to star is with the lxc man page. Give that a read, keeping in mind that some details are not relevant at this time. Feel free to ignore the parts about kernel requirements and configuration and ssh daemons. So go ahead and do,

 man lxc

and have a read.

The one configuration step you may have to do on Fedora 12 is to mount a cgroup directory. This directory does not exist by default, so if you are the fist user to need that support you will have to create the directory and mount it. Getting all of this to work will be easier if you are root, so we will assume you have this kind of privilege. Go ahead and create teh cgroup directory and mount it. This is done by,

 su
 mkdir /cgroup
 mount -t cgroup cgroup /cgroup

If you want to make this mount persistent, you will have to edit fstab.


Craigdo 17:47, 17 February 2010 (UTC)