Difference between revisions of "Tutorial"

From VNUML-WIKI
Jump to: navigation, search
Line 1: Line 1:
 
<h1 class="firstHeading">VNUML Tutorial</h1>
 
<h1 class="firstHeading">VNUML Tutorial</h1>
 +
__TOC__
  
<h2 style="text-align: center;">VNUML Tutorial<br>
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<small>version 1.6</small></h2>
 
  
<h3 style="text-align: center;">Authors:<br>
+
<html>
Ferm&iacute;n Gal&aacute;n
+
<head>
(<a href="mailto:galan at dit.upm.es">galan at dit.upm.es</a>)<br>
+
  <meta name="generator" content=
David Fern&aacute;ndez (<a href="mailto:david at dit.upm.es">david at dit.upm.es</a>)</h3>
+
  "HTML Tidy for Linux/x86 (vers 1st September 2003), see www.w3.org">
  
<h4 style="text-align: center;">August 12th, 2005</h4><br>
+
  <title>VNUML Tutorial 1.7</title>
 +
  <meta http-equiv="Content-Language" content="es">
 +
  <meta http-equiv="Content-Type" content=
 +
  "text/html; charset=iso-8859-1">
 +
  <meta content="Fermín Galán &amp; David Fernández" name="Author">
 +
  <link rel="stylesheet" type="text/css" href=
 +
  "../styles/vnuml.css">
 +
  <script language="javascript" src="../js/menu.js" type="text/javascript"></script>
 +
 
 +
</head>
 +
 
 +
<body OnLoad="setVariables();checkLocation()">
 +
 
 +
<div id="object1" style="position:absolute; visibility:show; left:5px; top:30px;
 +
 
 +
z-index:5">
 +
<div style="position: absolute; visibility: hidden; z-index: 1000;" id="overDiv"></div>
 +
<script src="../js/overlib.js" language="JavaScript" type="text/javascript"><!-- overLIB (c) Erik Bosrup --></script>
 +
 
 +
<a name="top">
 +
 
 +
<!-- This part of the file is directly generated from VNUML specification
 +
    using the following command:
 +
        ./extract-vm tutorial.xml "uml1 uml2 uml3 uml4 uml5 host"
 +
-->
 +
 
 +
<script type="text/javascript">
 +
var uml1 =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;vm name="uml1"&gt; <br>' +
 +
'    &lt;filesystem type="cow"&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt; <br>' +
 +
'    &lt;mem&gt;50M&lt;/mem&gt; <br>' +
 +
'    &lt;if id="1" net="Net0"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.0.3"&gt;default&lt;/route&gt; <br>' +
 +
'  &lt;/vm&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
var uml2 =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;vm name="uml2"&gt; <br>' +
 +
'    &lt;filesystem type="cow"&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt; <br>' +
 +
'    &lt;if id="1" net="Net0"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.0.3"&gt;default&lt;/route&gt; <br>' +
 +
'  &lt;/vm&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
var uml3 =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;vm name="uml3"&gt; <br>' +
 +
'    &lt;filesystem type="cow"&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt; <br>' +
 +
'    &lt;if id="1" net="Net0"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;if id="2" net="Net1"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;if id="3" net="Net3"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.3.1&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.3.2"&gt;default&lt;/route&gt; <br>' +
 +
'    &lt;forwarding type="ip" /&gt; <br>' +
 +
'  &lt;/vm&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
var uml4 =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;vm name="uml4"&gt; <br>' +
 +
'    &lt;filesystem type="cow"&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt; <br>' +
 +
'    &lt;if id="1" net="Net1"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;if id="2" net="Net2"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.1.1"&gt;default&lt;/route&gt; <br>' +
 +
'    &lt;forwarding type="ip" /&gt; <br>' +
 +
'  &lt;/vm&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
var uml5 =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;vm name="uml5"&gt; <br>' +
 +
'    &lt;filesystem type="cow"&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt; <br>' +
 +
'    &lt;if id="1" net="Net2"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt; <br>' +
 +
'    &lt;/if&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.2.1"&gt;default&lt;/route&gt; <br>' +
 +
'  &lt;/vm&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
var thehost =
 +
'<span style="font-weight: bold; font-size: 10pt; color: rgb(51, 0, 153);">' +
 +
'<pre><br>' +
 +
'  &lt;host&gt; <br>' +
 +
'    &lt;hostif net="Net3"&gt; <br>' +
 +
'      &lt;ipv4&gt;10.0.3.2&lt;/ipv4&gt; <br>' +
 +
'    &lt;/hostif&gt; <br>' +
 +
'    &lt;route type="ipv4" gw="10.0.3.1"&gt;10.0.0.0/16&lt;/route&gt; <br>' +
 +
'  &lt;/host&gt; <br>' +
 +
'</pre>' +
 +
'</span>'
 +
 
 +
</script>
 +
<!-- End of part generated with extract-vm command -->
 +
 
 +
<!-- ----------------- -->
 +
<!--        MENU      -->
 +
<!-- ----------------- -->
 +
 
 +
 
 +
<table width=160 border=0 cellspacing=1 cellpadding=5>
 +
 
 +
<tr><td class="menutitle" bgcolor="#6699FF"><center><b>
 +
<a href="#top">VNUML Tutorial</a></b></center></td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#introduction">1. Introduction</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#tutorial_requirements">1.1. Tutorial Requirements</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#privileges">1.2. Privileges</a><br/>
 +
</td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#limited_user_privileges">2. Limited User Privileges</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#writting_spec">2.1. Writing VNUML Spec</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#building_simulation">2.2. Building Simulation</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#testing_simulation">2.3. Testing Simulation</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#releasing_simulation">2.4. Releasing Simulation</a><br/>
 +
</td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#user_privileges">3. User Privileges</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#connecting_sim_host">3.1. Connecting Sim. Host</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#executing_commands">3.2. Executing Commands</a><br/>
 +
</td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#full_root_privileges">4. Full Root Privileges</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#host_configuration">4.1. Host Configuration</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#private_management">4.2. Private Management</a><br/>
 +
    &nbsp;&nbsp;&nbsp;<a href="#layer_2_interconnection">4.3. Layer 2 Interconnection</a><br/>
 +
</td></tr>   
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#nat">5. Configuring NAT</a></td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#tips">6. Additional Tips</a></td></tr>
 +
<tr><td class="menu" bgcolor="#99FFFF"><a href="#further_reading">7. Further Reading</a></td></tr>
 +
<!--tr><td class="menu" bgcolor="#99FFFF"><a href="#appendix_0">Appendix: Execution Logs (1.7.0)</a></td></tr-->
 +
<!--tr><td class="menu" bgcolor="#99FFFF"><a href="#appendix_1">Appendix: Execution Logs (1.3.1)</a></td></tr-->
 +
<tr><td class="menutitle" bgcolor="#6699FF"><center><b>
 +
<a href="http://www.dit.upm.es/vnuml">Back to VNUML Home</a></b></center></td></tr>
 +
 
 +
</table>
 +
 
 +
</div>
 +
 
 +
<!-- ----------------- -->
 +
<!--    END OF MENU    -->
 +
<!-- ----------------- -->
 +
 
 +
 
 +
  <div align="left">
 +
    <table cellpadding="0" cellspacing="2" border="0" style=
 +
    "text-align: left; width: 720px;">
 +
      <tbody>
 +
        <tr align="center">
 +
          <td style="vertical-align: top; text-align: right;" colspan=
 +
          "1" width="446" height="225">
 +
            <div style="text-align: center;"></div>
 +
 
 +
            <h2 style="text-align: center;">VNUML Tutorial<br>
 +
            <small>version 1.7</small></h2>
 +
 
 +
            <h3 style="text-align: center;">Authors:<br>
 +
            Ferm&iacute;n Gal&aacute;n (<a href=
 +
            "mailto:galan at dit.upm.es">galan at dit.upm.es</a>)<br>
 +
            David Fern&aacute;ndez (<a href=
 +
            "mailto:david at dit.upm.es">david at dit.upm.es</a>)</h3>
 +
 
 +
            <h4 style="text-align: center;">July 27th, 2006</h4><br>
 +
            <br>
 +
          </td>
  
 
           <td style="text-align: right; vertical-align: top;" width=
 
           <td style="text-align: right; vertical-align: top;" width=
Line 97: Line 282:
 
    typically referred as <b>&quot;virtual machines&quot;</b> or simply <b>&quot;UMLs&quot;</b>.</p>
 
    typically referred as <b>&quot;virtual machines&quot;</b> or simply <b>&quot;UMLs&quot;</b>.</p>
  
         <p>This tutorial covers VNUML language version 1.6 and vnumlparser.pl 1.6.X.</p>
+
         <p>This tutorial covers VNUML language version 1.7 and vnumlparser.pl 1.7.X.</p>
 
          
 
          
 
         <h3><a name="tutorial_requirements">1. 1. Tutorial Requirements</a></h3>
 
         <h3><a name="tutorial_requirements">1. 1. Tutorial Requirements</a></h3>
Line 105: Line 290:
 
<ul>
 
<ul>
  
    <li>VNUML properly installed in your system. Please, refer to the  
+
    <li>VNUML properly installed in your system. Use the most recent stable release. Please,  
    <a href="../install/index.html">VNUML Installation Guide</a> for more details.</li>
+
    refer to the <a href="../install/index.html">VNUML Installation Guide</a> for more details.</li>
 +
   
 +
    <li>UML kernel (we recomend the most recent stable one provided by the VNUML Project).</li>
 +
   
 +
    <li>Root_fs filesystem (we recomend the most recent stable one provided by the VNUML Project).</li>
 
     
 
     
 
    <li>X-window environment. Some steps in the tutorial will launch xterm terminals,
 
    <li>X-window environment. Some steps in the tutorial will launch xterm terminals,
Line 123: Line 312:
 
          
 
          
 
         <p>Old versions of VNUML parser (previous to 1.6.0) were very root-focused. Fortunately,
 
         <p>Old versions of VNUML parser (previous to 1.6.0) were very root-focused. Fortunately,
         VNUML support for conventional users has been highly improved in version 1.6.0.</p>
+
         VNUML support for conventional users was highly improved in version 1.6.0.</p>
 
          
 
          
 
         <p>There are three ways of using VNUML, depending of what privileges you want  
 
         <p>There are three ways of using VNUML, depending of what privileges you want  
Line 191: Line 380:
  
 
<pre class="box">
 
<pre class="box">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-lu&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-lu&lt;/simulation_name&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="none" /&gt;
+
     &lt;vm_mgmt type=&quot;none&quot; /&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
Line 264: Line 441:
 
    <p>Just copy the above XML code to a file named <b>tutorial_limited_user.xml</b>  
 
    <p>Just copy the above XML code to a file named <b>tutorial_limited_user.xml</b>  
 
    and save it (if you don&#39;t want to do the copy-paste, you can  
 
    and save it (if you don&#39;t want to do the copy-paste, you can  
         find it in the examples directory after VNUML installation, usually
+
         find it in the examples directory after VNUML installation in
         /usr/local/share/vnuml/examples).</p>
+
         /usr/share/examples).</p>
  
 
    <p>Some initial comments about this description file:</p>
 
    <p>Some initial comments about this description file:</p>
  
 
             <ul>
 
             <ul>
      <li>The <b>&lt;global&gt;</b> section defines certain parameters and options
+
      <li>The <a href="../reference/index.html#global">&lt;global&gt;</a> section defines certain parameters and options
               that apply to the whole simulation. For example, the default kernel
+
               that apply to the whole simulation. Within it, the <a href="../reference/index.html#vm_defaults">&lt;vm_defaults&gt;</a>
               and filesystem file that will be used for the virtual machines.
+
              tag defines some defaults for all virtual machines, like the kernel and
 +
               filesystem. Note the <a href="../reference/index.html#console">&lt;console&gt;</a> tag, that
 +
              defines that we want a xterm to interact with each virtual machine.
 
           </li>
 
           </li>
  
Line 290: Line 469:
  
 
      <ul>  
 
      <ul>  
 
              <li><a href=
 
              "../reference/index.html#con0">&lt;con0&gt;</a>
 
      tag is used to specify the login mechanism, a xterm in this case,</li>
 
 
      <li><a href="../reference/index.html#if">&lt;if&gt;</a> tag is
 
      <li><a href="../reference/index.html#if">&lt;if&gt;</a> tag is
 
               used to create and describe network interfaces (<a href=
 
               used to create and describe network interfaces (<a href=
Line 304: Line 479:
 
               <li><a href=
 
               <li><a href=
 
               "../reference/index.html#forwarding">&lt;forwarding&gt;</a>
 
               "../reference/index.html#forwarding">&lt;forwarding&gt;</a>
               to enable forwarding.</li>
+
               to enable forwarding. Note we use this tag in uml3 and uml4, the
 +
              virtual machines that will act as routers (the others are end-systems).</li>
  
 
               </ul>
 
               </ul>
Line 345: Line 521:
 
    It can take easily several minutes to boot each UML, so it could
 
    It can take easily several minutes to boot each UML, so it could
 
    take from 1 minute (or less!) to around 10-15 minutes to boot the tutorial scenario (time  
 
    take from 1 minute (or less!) to around 10-15 minutes to boot the tutorial scenario (time  
         depends greatly on the host machine characteristics).</p>
+
         depends greatly on the host machine characteristics). Maybe even you
 +
        get the following prompt:</p>
 +
       
 +
<pre class="box">
 +
Boot timeout for virtual machine uml1 reached.  Abort, Retry, or Continue? [A/r/c]:
 +
</pre>
 +
 
 +
        <p>This use to mean that vnumlparser.pl has got tired of waitting for a
 +
        virtual machine. It could be that the virtual machine has not finishing
 +
        booting yet (that means, the login prompt has not appeared yet). Try
 +
        'r' in that case. If the problem persists, contact the vnuml-user
 +
        mailing list.</p>
  
 
         <h3><a name="testing_simulation">2. 3. Testing the Simulation</a></h3>
 
         <h3><a name="testing_simulation">2. 3. Testing the Simulation</a></h3>
Line 454: Line 641:
 
to a file named <b>tutorial_user1.xml</b> and save it (if you don&#39;t want to  
 
to a file named <b>tutorial_user1.xml</b> and save it (if you don&#39;t want to  
 
do the copy-paste, you can find it in the examples directory after VNUML  
 
do the copy-paste, you can find it in the examples directory after VNUML  
installation, usually /usr/local/share/vnuml/examples).</p>
+
installation in /usr/share/examples).</p>
 
 
 
    <div align="center">
 
    <div align="center">
Line 493: Line 680:
 
<pre class="box">
 
<pre class="box">
 
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-u1&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-u1&lt;/simulation_name&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="none" /&gt;
+
     &lt;vm_mgmt type=&quot;none&quot; /&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net3" mode="uml_switch" sock="/var/local/run/vnuml/Net3.ctl" /&gt;
+
   &lt;net name=&quot;Net3&quot; mode=&quot;uml_switch&quot; sock=&quot;/var/run/vnuml/Net3.ctl&quot; /&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="3" net="Net3"&gt;
+
     &lt;if id=&quot;3&quot; net=&quot;Net3&quot;&gt;
 
       &lt;ipv4&gt;10.0.3.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.3.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
Line 585: Line 760:
 
<ol>
 
<ol>
 
<li>The user bauer must be a member of the <em>vnuml</em> group which owns the
 
<li>The user bauer must be a member of the <em>vnuml</em> group which owns the
directory /var/local/run/vnuml, where the UNIX sockets for the uml_switch processes
+
directory /var/run/vnuml, where the UNIX sockets for the uml_switch processes
 
will be stored. (The command below looks intimidating, but really all it does is
 
will be stored. (The command below looks intimidating, but really all it does is
 
add the user bauer to the vnuml group, while preserving its current group membership; maybe
 
add the user bauer to the vnuml group, while preserving its current group membership; maybe
Line 616: Line 791:
 
<li>Start a uml_switch process, linked with the TUN/TAP device created
 
<li>Start a uml_switch process, linked with the TUN/TAP device created
 
previously (tap0) and owned by the vnuml user.  The socket location
 
previously (tap0) and owned by the vnuml user.  The socket location
is arbitrary.  However, the /var/local/run/vnuml directory was created
+
is arbitrary.  However, the /var/run/vnuml directory was created
 
at installation for this purpose.  The socket location will be used as
 
at installation for this purpose.  The socket location will be used as
 
the <strong>sock</strong> attribute in the
 
the <strong>sock</strong> attribute in the
Line 622: Line 797:
  
 
<pre class="box">
 
<pre class="box">
root@host# su -pc 'uml_switch -tap tap0 -unix /var/local/run/vnuml/Net3.ctl &lt; /dev/null &gt; /dev/null &amp;' vnuml
+
root@host# su -pc 'uml_switch -tap tap0 -unix /var/run/vnuml/Net3.ctl &lt; /dev/null &gt; /dev/null &amp;' vnuml
 
</pre>
 
</pre>
 
<li>Give the vnuml group read/write privileges to the socket that is used.
 
<li>Give the vnuml group read/write privileges to the socket that is used.
Line 633: Line 808:
 
<pre class="box">
 
<pre class="box">
 
root@host# sleep 1
 
root@host# sleep 1
root@host# ls -l /var/local/run/vnuml/Net3.ctl
+
root@host# ls -l /var/run/vnuml/Net3.ctl
srwxr-xr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/local/run/vnuml/Net3.ctl
+
srwxr-xr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/run/vnuml/Net3.ctl
root@host# chmod g+rw /var/local/run/vnuml/Net3.ctl
+
root@host# chmod g+rw /var/run/vnuml/Net3.ctl
root@host# ls -l /var/local/run/vnuml/Net3.ctl
+
root@host# ls -l /var/run/vnuml/Net3.ctl
srwxrwxr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/local/run/vnuml/Net3.ctl
+
srwxrwxr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/run/vnuml/Net3.ctl
 
</pre>
 
</pre>
  
<p>Now that the /var/local/run/vnuml/Net3.ctl exists and is readable
+
<p>Now that the /var/run/vnuml/Net3.ctl exists and is readable
 
and writeable by bauer, you can start the simulation.</p>
 
and writeable by bauer, you can start the simulation.</p>
  
Line 700: Line 875:
 
<p>When the simulation has been released, note that the uml_switch process for Net3
 
<p>When the simulation has been released, note that the uml_switch process for Net3
 
is still running, and its accompanying UNIX socket still exists in
 
is still running, and its accompanying UNIX socket still exists in
/var/local/run/vnuml/Net3.ctl.  Also, the tap0 device is still configured,
+
/var/run/vnuml/Net3.ctl.  Also, the tap0 device is still configured,
 
and its gateway still exists.  As long as this setup
 
and its gateway still exists.  As long as this setup
 
remains, new simulation scenarios may be built using the same configuration without
 
remains, new simulation scenarios may be built using the same configuration without
Line 709: Line 884:
  
 
<pre class="box">
 
<pre class="box">
root@host# kill `lsof -t /var/local/run/vnuml/Net3.ctl`
+
root@host# kill `lsof -t /var/run/vnuml/Net3.ctl`
/var/local/run/vnuml/Net3.ctl:  6280
+
/var/run/vnuml/Net3.ctl:  6280
root@host# rm /var/local/run/vnuml/Net3.ctl
+
root@host# rm /var/run/vnuml/Net3.ctl
 
</pre>
 
</pre>
  
Line 752: Line 927:
 
to a file named <b>tutorial_user2.xml</b> and save it (if you don't want to  
 
to a file named <b>tutorial_user2.xml</b> and save it (if you don't want to  
 
do the copy-paste, you can find it in the examples directory after VNUML  
 
do the copy-paste, you can find it in the examples directory after VNUML  
installation, usually /usr/local/share/vnuml/examples).</p>
+
installation in /usr/share/examples).</p>
  
 
<div align="center">
 
<div align="center">
Line 759: Line 934:
 
 
 
<pre class="box">
 
<pre class="box">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-u2&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-u2&lt;/simulation_name&gt;
 
     &lt;ssh_version&gt;1&lt;/ssh_version&gt;
 
     &lt;ssh_version&gt;1&lt;/ssh_version&gt;
 
     &lt;ssh_key&gt;~/.ssh/identity.pub&lt;/ssh_key&gt;
 
     &lt;ssh_key&gt;~/.ssh/identity.pub&lt;/ssh_key&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="net" network="10.250.0.0" mask="24"&gt;
+
     &lt;vm_mgmt type=&quot;net&quot; network=&quot;10.250.0.0&quot; mask=&quot;24&quot;&gt;
       &lt;mgmt_net sock="/var/local/run/vnuml/Mgmt_net.ctl" hostip="10.250.0.1"/&gt;
+
       &lt;mgmt_net sock=&quot;/var/run/vnuml/Mgmt_net.ctl&quot; hostip=&quot;10.250.0.1&quot;/&gt;
 
     &lt;/vm_mgmt&gt;
 
     &lt;/vm_mgmt&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
     &lt;exec seq="start" type="verbatim"&gt;nohup /usr/bin/hello &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; &lt;/exec&gt;
+
     &lt;exec seq=&quot;start&quot; type=&quot;verbatim&quot;&gt;nohup /usr/bin/hello &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; &lt;/exec&gt;
     &lt;exec seq="stop" type="verbatim"&gt;killall hello&lt;/exec&gt;
+
     &lt;exec seq=&quot;stop&quot; type=&quot;verbatim&quot;&gt;killall hello&lt;/exec&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
Line 863: Line 1,026:
 
Set 'tap0' persistent and owned by uid 1037
 
Set 'tap0' persistent and owned by uid 1037
 
root@host# ifconfig tap0 10.250.0.1 netmask 255.255.255.0 up
 
root@host# ifconfig tap0 10.250.0.1 netmask 255.255.255.0 up
root@host# su -pc 'uml_switch -tap tap0 -unix /var/local/run/vnuml/Mgmt_net.ctl &lt; /dev/null &gt; /dev/null &amp;' vnuml
+
root@host# su -pc 'uml_switch -tap tap0 -unix /var/run/vnuml/Mgmt_net.ctl &lt; /dev/null &gt; /dev/null &amp;' vnuml
 
root@host# sleep 1
 
root@host# sleep 1
root@host# chmod g+rw /var/local/run/vnuml/Mgmt_net.ctl
+
root@host# chmod g+rw /var/run/vnuml/Mgmt_net.ctl
 
</pre>
 
</pre>
  
Line 917: Line 1,080:
 
<pre class="box">
 
<pre class="box">
 
bauer@host$ ssh -1 root@10.250.0.4
 
bauer@host$ ssh -1 root@10.250.0.4
Warning: No xauth data; using fake authentication data for X11 forwarding.
+
Last login: Fri Jun 16 10:33:46 2006
Warning: Remote host denied X11 forwarding.
+
Linux (none) 2.6.15.7-bs3-tls-xt-2m #1 Wed Jul 19 15:23:08 CEST 2006 i686
Last login: Mon Jul 4 19:00:52 2005 from 10.250.0.1
+
 
 +
The programs included with the Debian GNU/Linux system are free software;
 +
the exact distribution terms for each program are described in the
 +
individual files in /usr/share/doc/*/copyright.
 +
 
 +
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
 +
permitted by applicable law.
 
uml3:~#
 
uml3:~#
 
</pre>
 
</pre>
Line 925: Line 1,094:
 
<p>Note that, given that you can SSH to each virtual machine from host,
 
<p>Note that, given that you can SSH to each virtual machine from host,
 
you don't need xterms (just remove the  
 
you don't need xterms (just remove the  
<a href="../reference/index.html#boot">&lt;boot&gt;</a> tag in the VNUML file)  
+
<a href="../reference/index.html#console">&lt;console&gt;</a> tag in the VNUML file)  
 
if you configure the management network properly. This
 
if you configure the management network properly. This
 
is very useful when you have a lot of virtual machines in your simulation
 
is very useful when you have a lot of virtual machines in your simulation
Line 936: Line 1,105:
 
             execute the commands you desire. You could, for example,
 
             execute the commands you desire. You could, for example,
 
             manually start a web or ftp server inside uml1 and uml5
 
             manually start a web or ftp server inside uml1 and uml5
             virtual machines. You could also start routing daemons in uml3,
+
             virtual machines. You could also start routing daemons in uml3 and
             uml4 and the host in order to set-up dynamic routing for the scenario.
+
             uml4 in order to set-up dynamic routing for the scenario.
 
             You could even start automatically such services from the init scripts
 
             You could even start automatically such services from the init scripts
 
             in the root filesystem being used, although that would probably require
 
             in the root filesystem being used, although that would probably require
Line 1,010: Line 1,179:
 
<pre class="box">
 
<pre class="box">
 
uml1:~ # tail -f /tmp/hello
 
uml1:~ # tail -f /tmp/hello
Hello! Current date: Mon Jul 4 19:13:10 UTC 2005
+
Hello! Current date: Thu Jul 20 10:14:43 UTC 2006
Hello! Current date: Mon Jul 4 19:13:20 UTC 2005
+
Hello! Current date: Thu Jul 20 10:14:53 UTC 2006
Hello! Current date: Mon Jul 4 19:13:30 UTC 2005
+
Hello! Current date: Thu Jul 20 10:15:04 UTC 2006
Hello! Current date: Mon Jul 4 19:13:40 UTC 2005
+
Hello! Current date: Thu Jul 20 10:15:14 UTC 2006
Hello! Current date: Mon Jul 4 19:13:50 UTC 2005
+
Hello! Current date: Thu Jul 20 10:15:25 UTC 2006
Hello! Current date: Mon Jul 4 19:14:00 UTC 2005
+
Hello! Current date: Thu Jul 20 10:15:35 UTC 2006
Hello! Current date: Mon Jul 4 19:14:10 UTC 2005
+
Hello! Current date: Thu Jul 20 10:15:45 UTC 2006
 
</pre>
 
</pre>
  
Line 1,042: Line 1,211:
  
 
<pre class="box">
 
<pre class="box">
root@host# kill `lsof -t /var/local/run/vnuml/Mgmt_net.ctl`
+
root@host# kill `lsof -t /var/run/vnuml/Mgmt_net.ctl`
/var/local/run/vnuml/Mgmt_net.ctl:  13746
+
/var/run/vnuml/Mgmt_net.ctl:  13746
root@host# rm /var/local/run/vnuml/Mgmt_net.ctl
+
root@host# rm /var/run/vnuml/Mgmt_net.ctl
 
root@host# ifconfig tap0 down
 
root@host# ifconfig tap0 down
 
root@host# tunctl -d tap0
 
root@host# tunctl -d tap0
Line 1,075: Line 1,244:
 
          
 
          
 
<pre class="box">
 
<pre class="box">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-r1&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-r1&lt;/simulation_name&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="none" /&gt;
+
     &lt;vm_mgmt type=&quot;none&quot; /&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net3" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net3&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="3" net="Net3"&gt;
+
     &lt;if id=&quot;3&quot; net=&quot;Net3&quot;&gt;
 
       &lt;ipv4&gt;10.0.3.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.3.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
   &lt;host&gt;
 
   &lt;host&gt;
     &lt;hostif net="Net3"&gt;
+
     &lt;hostif net=&quot;Net3&quot;&gt;
 
       &lt;ipv4&gt;10.0.3.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.3.2&lt;/ipv4&gt;
 
     &lt;/hostif&gt;
 
     &lt;/hostif&gt;
     &lt;route type="inet" gw="10.0.3.1"&gt;10.0.0.0/16&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.3.1&quot;&gt;10.0.0.0/16&lt;/route&gt;
   &lt;/host&gt;
+
   &lt;/host&gt;
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
 
</pre>
 
</pre>
Line 1,187: Line 1,344:
  
 
<pre class="box">
 
<pre class="box">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-r2&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-r2&lt;/simulation_name&gt;
 
     &lt;ssh_version&gt;1&lt;/ssh_version&gt;
 
     &lt;ssh_version&gt;1&lt;/ssh_version&gt;
 
     &lt;ssh_key&gt;~/.ssh/identity.pub&lt;/ssh_key&gt;
 
     &lt;ssh_key&gt;~/.ssh/identity.pub&lt;/ssh_key&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="private" network="10.250.0.0" mask="24"&gt;
+
     &lt;vm_mgmt type=&quot;private&quot; network=&quot;10.250.0.0&quot; mask=&quot;24&quot;&gt;
 
       &lt;host_mapping /&gt;
 
       &lt;host_mapping /&gt;
 
     &lt;/vm_mgmt&gt;
 
     &lt;/vm_mgmt&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
+
     &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;xterm&gt;gnome-terminal,-t,-x&lt;/xterm&gt;
 
     &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
     &lt;exec seq="start" type="verbatim"&gt;nohup /usr/bin/hello &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; &lt;/exec&gt;
+
     &lt;exec seq=&quot;start&quot; type=&quot;verbatim&quot;&gt;nohup /usr/bin/hello &amp;lt;/dev/null &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; &lt;/exec&gt;
     &lt;exec seq="stop" type="verbatim"&gt;killall hello&lt;/exec&gt;
+
     &lt;exec seq=&quot;stop&quot; type=&quot;verbatim&quot;&gt;killall hello&lt;/exec&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
+
     &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;xterm&gt;gnome-terminal,-t,-x&lt;/xterm&gt;
 
    &lt;/boot&gt;
 
     &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
+
     &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;xterm&gt;gnome-terminal,-t,-x&lt;/xterm&gt;
 
    &lt;/boot&gt;
 
     &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
+
     &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;xterm&gt;gnome-terminal,-t,-x&lt;/xterm&gt;
 
    &lt;/boot&gt;
 
     &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
+
     &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;xterm&gt;gnome-terminal,-t,-x&lt;/xterm&gt;
 
    &lt;/boot&gt;
 
     &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
Line 1,357: Line 1,502:
  
 
<pre class="box">
 
<pre class="box">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE vnuml SYSTEM "/usr/local/share/xml/vnuml/vnuml.dtd"&gt;
+
&lt;!DOCTYPE vnuml SYSTEM &quot;/usr/share/xml/vnuml/vnuml.dtd&quot;&gt;
  
 
&lt;vnuml&gt;
 
&lt;vnuml&gt;
 
   &lt;global&gt;
 
   &lt;global&gt;
     &lt;version&gt;1.6&lt;/version&gt;
+
     &lt;version&gt;1.7&lt;/version&gt;
 
     &lt;simulation_name&gt;tutorial-r3&lt;/simulation_name&gt;
 
     &lt;simulation_name&gt;tutorial-r3&lt;/simulation_name&gt;
 
     &lt;automac/&gt;
 
     &lt;automac/&gt;
     &lt;vm_mgmt type="none" /&gt;
+
     &lt;vm_mgmt type=&quot;none&quot; /&gt;
     &lt;default_filesystem type="cow"&gt;/usr/local/share/vnuml/filesystems/root_fs_tutorial&lt;/default_filesystem&gt;
+
     &lt;vm_defaults&gt;
    &lt;default_kernel&gt;/usr/local/share/vnuml/kernels/linux&lt;/default_kernel&gt;
+
      &lt;filesystem type=&quot;cow&quot;&gt;/usr/share/vnuml/filesystems/root_fs_tutorial&lt;/filesystem&gt;
 +
      &lt;kernel&gt;/usr/share/vnuml/kernels/linux&lt;/kernel&gt;
 +
      &lt;console id=&quot;0&quot;&gt;xterm&lt;/console&gt;
 +
    &lt;/vm_defaults&gt;
 
   &lt;/global&gt;
 
   &lt;/global&gt;
   &lt;net name="Net0" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net0&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net1" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net1&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net2" mode="uml_switch" /&gt;
+
   &lt;net name=&quot;Net2&quot; mode=&quot;uml_switch&quot; /&gt;
   &lt;net name="Net3" mode="virtual_bridge" external="eth0"/&gt;
+
   &lt;net name=&quot;Net3&quot; mode=&quot;virtual_bridge&quot; external=&quot;eth0&quot;/&gt;
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml2"&gt;
+
   &lt;vm name=&quot;uml2&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml3"&gt;
+
   &lt;vm name=&quot;uml3&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.3&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net1"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net1&quot;&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="3" net="Net3"&gt;
+
     &lt;if id=&quot;3&quot; net=&quot;Net3&quot;&gt;
 
       &lt;ipv4&gt;192.168.0.150&lt;/ipv4&gt;
 
       &lt;ipv4&gt;192.168.0.150&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.2"&gt;10.0.2.0/24&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.2&quot;&gt;10.0.2.0/24&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml4"&gt;
+
   &lt;vm name=&quot;uml4&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net1&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net1"&gt;
 
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.1.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;if id="2" net="Net2"&gt;
+
     &lt;if id=&quot;2&quot; net=&quot;Net2&quot;&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.1.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.1.1&quot;&gt;default&lt;/route&gt;
     &lt;forwarding type="ip" /&gt;
+
     &lt;forwarding type=&quot;ip&quot; /&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
   &lt;vm name="uml5"&gt;
+
   &lt;vm name=&quot;uml5&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net2&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net2"&gt;
 
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.2.2&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.2.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.2.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
 
   &lt;host&gt;
 
   &lt;host&gt;
     &lt;hostif net="Net3"&gt;
+
     &lt;hostif net=&quot;Net3&quot;&gt;
 
       &lt;ipv4&gt;192.168.0.39&lt;/ipv4&gt;
 
       &lt;ipv4&gt;192.168.0.39&lt;/ipv4&gt;
 
     &lt;/hostif&gt;
 
     &lt;/hostif&gt;
     &lt;physicalif name="eth0" ip="192.168.0.39" mask="255.255.255.0" gw="192.168.0.1" /&gt;
+
     &lt;physicalif name=&quot;eth0&quot; ip=&quot;192.168.0.39&quot; mask=&quot;255.255.255.0&quot; gw=&quot;192.168.0.1&quot; /&gt;
     &lt;route type="inet" gw="192.168.0.1"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;192.168.0.1&quot;&gt;default&lt;/route&gt;
 
   &lt;/host&gt;   
 
   &lt;/host&gt;   
 
&lt;/vnuml&gt;
 
&lt;/vnuml&gt;
Line 1,475: Line 1,608:
 
             <br>
 
             <br>
 
           </td>
 
           </td>
         
+
 
 
         </tr><!-- 6. N A T -->
 
         </tr><!-- 6. N A T -->
  
 
         <tr>
 
         <tr>
           <td class="title" colspan="2"><a name="nat">5.
+
           <td class="title" colspan="2"><a name="nat">6.
 
           Configuring NAT</a></td>
 
           Configuring NAT</a></td>
 
         </tr>
 
         </tr>
Line 1,489: Line 1,622:
 
         <p>This section describes a procedure to configure NAT in the host
 
         <p>This section describes a procedure to configure NAT in the host
 
         for the scenarios described in section 3 of this tutorial, althought
 
         for the scenarios described in section 3 of this tutorial, althought
         it could be easily adapted to others VNUML scanerios using layer 3
+
         it could be easily adapted to others VNUML scenarios using layer 3
 
         interconnection at host. The procedure has been provided thanks to  
 
         interconnection at host. The procedure has been provided thanks to  
 
         Carlos Sanmartín.</p>
 
         Carlos Sanmartín.</p>
Line 1,538: Line 1,671:
 
</pre>
 
</pre>
  
      <li>
 
 
</ol>
 
</ol>
  
Line 1,593: Line 1,725:
 
             of vnumlparser.pl, version 1.3.0 and beyond works fine with SKAS: you just need to compile a
 
             of vnumlparser.pl, version 1.3.0 and beyond works fine with SKAS: you just need to compile a
 
             host kernel with SKAS support enabled. <a href="http://user-mode-linux.sourceforge.net/skas.html">More information</a> in the UML Project Web site.</li>
 
             host kernel with SKAS support enabled. <a href="http://user-mode-linux.sourceforge.net/skas.html">More information</a> in the UML Project Web site.</li>
 +
           
 +
            <li>Capture traffic in virtual networks. You can use a patched version of uml_switch (look in
 +
            the contrib/uml_router/ directory inside VNUML package) that, once compiled and installed, can
 +
            be used to capture traffic in selected virtual networks. This is a powerfull feature, allowing
 +
            capturing the traffic in simulation experiments for later study (capturing to a file) or even
 +
            in real time with software tools like Ethereal (although this needs root
 +
            privilegies). Please have a look to the <strong>capture_*</strong> attributes of
 +
            <a href="../reference/index.html#capture">&lt;net&gt;</a> tag
 +
            to know how to configure it. In addition, you will find a variation of the tutorial for limited
 +
            user using capture features in the <strong>tutorial_limited_user_capture.xml</strong> that comes with the VNUML examples).
 +
 +
<pre class="box">
 +
  ...
 +
  &lt;net name=&quot;Net1&quot;
 +
      mode=&quot;uml_switch&quot;
 +
      uml_switch_binary=&quot;/usr/local/bin/uml_switch4capture&quot;
 +
      capture_expression=&quot;icmp&quot;
 +
      capture_file=&quot;/tmp/net1.pcap&quot; /&gt;
 +
  ... 
 +
</pre>
 +
 +
            </li>
 
              
 
              
 
             <li>Adding users and groups in the virtual machines. In the examples shown so far, there is only one
 
             <li>Adding users and groups in the virtual machines. In the examples shown so far, there is only one
Line 1,602: Line 1,756:
 
<pre class="box">
 
<pre class="box">
 
   ...
 
   ...
   &lt;vm name="uml1"&gt;
+
   &lt;vm name=&quot;uml1&quot;&gt;
    &lt;boot&gt;
+
    &lt;if id=&quot;1&quot; net=&quot;Net0&quot;&gt;
      &lt;con0&gt;xterm&lt;/con0&gt;
 
    &lt;/boot&gt;
 
    &lt;if id="1" net="Net0"&gt;
 
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
       &lt;ipv4&gt;10.0.0.1&lt;/ipv4&gt;
 
     &lt;/if&gt;
 
     &lt;/if&gt;
     &lt;route type="inet" gw="10.0.0.3"&gt;default&lt;/route&gt;
+
     &lt;route type=&quot;ipv4&quot; gw=&quot;10.0.0.3&quot;&gt;default&lt;/route&gt;
     &lt;user username="yoda" group="jedi"&gt;
+
     &lt;user username=&quot;yoda&quot; group=&quot;jedi&quot;&gt;
 
       &lt;group&gt;jedi&lt;/group&gt;
 
       &lt;group&gt;jedi&lt;/group&gt;
 
       &lt;group&gt;lightside&lt;/group&gt;
 
       &lt;group&gt;lightside&lt;/group&gt;
 
     &lt;/user&gt;
 
     &lt;/user&gt;
     &lt;user username="anakin" group="sith"&gt;
+
     &lt;user username=&quot;anakin&quot; group=&quot;sith&quot;&gt;
 
       &lt;group&gt;sith&lt;/group&gt;
 
       &lt;group&gt;sith&lt;/group&gt;
       &lt;group&gt;darktside&lt;/group&gt;
+
       &lt;group&gt;darkside&lt;/group&gt;
 
     &lt;/user&gt;
 
     &lt;/user&gt;
 
   &lt;/vm&gt;
 
   &lt;/vm&gt;
Line 1,644: Line 1,795:
 
             <li>UML kernel and filesystem selection. In the examples shown so far, the
 
             <li>UML kernel and filesystem selection. In the examples shown so far, the
 
             kernel and UML filesystem for all the virtual machines is set up with the
 
             kernel and UML filesystem for all the virtual machines is set up with the
             <a href="../reference/index.html#default_kernel">&lt;default_kernel&gt;</a>
+
             <a href="../reference/index.html#vm_defaults">&lt;vm_defaults&gt;</a>.
            and <a href="../reference/index.html#default_filesystem">&lt;default_filesystem&gt;</a>
+
             However, you can specify a different UML kernel using
             tags. However, you can specify a different UML kernel using
 
 
             <a href="../reference/index.html#kernel">&lt;kernel&gt;</a> and  
 
             <a href="../reference/index.html#kernel">&lt;kernel&gt;</a> and  
 
             <a href="../reference/index.html#filesystem">&lt;filesystem&gt;</a> tags
 
             <a href="../reference/index.html#filesystem">&lt;filesystem&gt;</a> tags
Line 1,680: Line 1,830:
 
           </td>
 
           </td>
 
         </tr>
 
         </tr>
 +
       
 +
        <!-- A P P E N D I X :  E X E C U T I O N  L O G S  >
 +
 +
        <tr>
 +
          <td class="title" colspan="2"><a name="appendix_0">Appendix:
 +
          Execution Logs (1.7.0)</a></td>
 +
        </tr>
 +
 +
        <tr>
 +
          <td colspan="2">
 +
            <br>
 +
 +
            <p>The following logs were taken while performing this tutorial
 +
            at morfeo (Debian system running 2.6.10-skas3-7), using verbose switch (-v) of
 +
            vnumlparser.pl version 1.7.0. UMLs run 2.6.10-1m.</p>
 +
 +
            <p>Building topology:</p>
 +
 +
<pre class="box">
 +
root@morfeo# vnumlparser.pl -t tutorial.xml -v
 +
TODO
 +
</pre>
 +
 +
            <p>Executing commands (start):</p>
 +
 +
<pre class="box">
 +
root@morfeo# vnumlparser.pl -x start@tutorial_plus.xml -v
 +
TODO
 +
</pre>
 +
 +
            <p>Executing commands (stop):</p>
 +
 +
<pre class="box">
 +
root@morfeo# vnumlparser.pl -x stop@tutorial_plus.xml -v
 +
TODO
 +
</pre>
 +
 +
            <p>Destroying topology:</p>
 +
 +
<pre class="box">
 +
root@morfeo# vnumlparser.pl -d tutorial_plus.xml -v
 +
TODO
 +
</pre>
 +
 +
          </td>
 +
        </tr-->
 +
       
 +
          <td colspan="2">
 +
            <hr>
 +
 +
            <center>
 +
              <font face="Tahoma"><em>Last update: <script src=
 +
              "../js/fecha.js" type="text/javascript">
 +
              </script> <script language="JavaScript" type=
 +
              "text/javascript">
 +
 +
              var cur = new Date(document.lastModified);
 +
              fixDate(cur);
 +
              var str = getString(cur);
 +
              document.write(str);
 +
              </script><br></em></font>
 +
            </center>
 +
          </td>
 +
        </tr>
 +
      </tbody>
 +
    </table>
 +
  </div>
 +
</body>
 +
</html>

Revision as of 22:54, 14 October 2006

VNUML Tutorial

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

VNUML Tutorial 1.7

VNUML Tutorial
version 1.7

Authors:
Fermín Galán (galan at dit.upm.es)
David Fernández (david at dit.upm.es)

July 27th, 2006



Virtual Network User Mode Linux
Contents

1. Introduction
    1.1. Tutorial Requirements
    1.2. Privileges
2. Limited User Privileges
    2.1. Writing the VNUML Specification
    2.2. Building the Simulation
    2.3. Testing the Simulation
    2.4. Releasing the Simulation
3. User Privileges
    3.1. Connecting Simulation to Host
    3.2. Executing Commands
       3.2.1. Generating SSH key
       3.2.2. Management Network
       3.2.3. Command Sequences
4. Full Root Privileges
    4.1. Host Configuration
    4.2. Private Management
    4.3. Layer 2 Interconnection
5. Configuring NAT
6. Additional Tips
7. Further Reading
1. Introduction

VNUML (Virtual Network User Mode Linux) is a general purpose virtualization tool designed to easily create complex network simulation scenarios based on User Mode Linux (UML) virtualization software. It has been initially developed in the context of Euro6IX research project to simulate IPv6 IX scenarios based on Linux and zebra routing daemon. However, it is a useful tool that can be used to simulate general Linux based network scenarios.

VNUML is aimed to help in testing network applications and services over complex testbeds made of several nodes (even tens) and networks inside one Linux machine, without involving the investment and management complexity needed to create it using real equipment.

This tutorial explains in detail how to use VNUML tool to simulate a simple networking scenario. It is intended as a hands-on approach for people that wants to start using VNUML tool, as well as an overview of the philosophy and features behind VNUML tool for people that do not want to install it yet.

Although VNUML hides from the user most of the details needed to use UML virtualization software, a minimum knowledge about UML and how it works is needed. The reader is referred to UML Web site to gain that knowledge.

Throughout this document and the rest of the documentation, we refer to the machine where VNUML is running as the "host". The Linux virtual machines that run over the host using UML virtualization software are typically referred as "virtual machines" or simply "UMLs".

This tutorial covers VNUML language version 1.7 and vnumlparser.pl 1.7.X.

1. 1. Tutorial Requirements

In order to properly follow this tutorial you need:

  • VNUML properly installed in your system. Use the most recent stable release. Please, refer to the VNUML Installation Guide for more details.
  • UML kernel (we recomend the most recent stable one provided by the VNUML Project).
  • Root_fs filesystem (we recomend the most recent stable one provided by the VNUML Project).
  • X-window environment. Some steps in the tutorial will launch xterm terminals, so you need a X server.
  • Be able to log as root in the host (for step 3 and step 4).
  • The 10.0.x.x and 10.250.x.x address ranges are used in the VNUML specifications shown in this tutorial. If these ranges collide with assigned addresses in you host environment you must to change them to other prefixes.

1. 2. Privileges

Old versions of VNUML parser (previous to 1.6.0) were very root-focused. Fortunately, VNUML support for conventional users was highly improved in version 1.6.0.

There are three ways of using VNUML, depending of what privileges you want to use:

  • Limited User Privileges. To run vnumlparser.pl without root privileges. The main limitation is that there is no network access to the virtual machines from/to host and, therefore, no access to the external network the host is connected to (if any). The only way to interact with the virtual machines is through direct login (typically, a xterm). As a consequence, vnumlparser.pl can not be used to automatically run command sequences on the virtual machines.
  • User Privileges. To run vnumlparser.pl without root privileges, but use root privileges to enable host network access (management network) and access to external networks using the root as router/NAT (layer 3 interconnection). Command sequences can be run by vnumlparser.pl in the virtual machines using the management network.
  • Full Root Privileges.To run vnumlparser.pl as root. This allow host configuration performed by vnumlparser.pl, private management, mapping of virtual machine names in /etc/hosts and direct connection of virtual machines to external networks the host is connected to (layer 2 interconnection).

The rest of the tutorial describe these three ways in detail, starting with Limited User Privileges, going to User Privileges and finally, Full Root Privileges.


2. Limited User Privileges

2. 1. Writing the VNUML Specification

VNUML tool is made of two main components: the VNUML language used for describing simulations in XML; and the interpreter of the language (vnumlparser.pl), that builds and manages the simulation, hiding all UML complex details to the user.

If you managed to successfully install VNUML parser and all related software packages, one of the hardest steps is over :). Now it is time to create the XML description of the scenario to be simulated using VNUML language (see VNUML Language Reference for a complete description of the language).

The specification of the tutorial scenario in VNUML language follows:

Tutorial Limited User Scenario
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">

<vnuml>
  <global>
    <version>1.7</version>
    <simulation_name>tutorial-lu</simulation_name>
    <automac/>
    <vm_mgmt type="none" />
    <vm_defaults>
       <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
       <kernel>/usr/share/vnuml/kernels/linux</kernel>
       <console id="0">xterm</console>
    </vm_defaults>
  </global>
  <net name="Net0" mode="uml_switch" />
  <net name="Net1" mode="uml_switch" />
  <net name="Net2" mode="uml_switch" />
  <vm name="uml1">
    <if id="1" net="Net0">
      <ipv4>10.0.0.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml2">
    <if id="1" net="Net0">
      <ipv4>10.0.0.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml3">
    <if id="1" net="Net0">
      <ipv4>10.0.0.3</ipv4>
    </if>
    <if id="2" net="Net1">
      <ipv4>10.0.1.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml4">
    <if id="1" net="Net1">
      <ipv4>10.0.1.2</ipv4>
    </if>
    <if id="2" net="Net2">
      <ipv4>10.0.2.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.1">default</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml5">
    <if id="1" net="Net2">
      <ipv4>10.0.2.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>
  </vm>
</vnuml>

Just copy the above XML code to a file named tutorial_limited_user.xml and save it (if you don't want to do the copy-paste, you can find it in the examples directory after VNUML installation in /usr/share/examples).

Some initial comments about this description file:

  • The <global> section defines certain parameters and options that apply to the whole simulation. Within it, the <vm_defaults> tag defines some defaults for all virtual machines, like the kernel and filesystem. Note the <console> tag, that defines that we want a xterm to interact with each virtual machine.
  • Virtual networks are created using the <net> tag. Each network is identified by a name (e.g., "Net0") which is used later in virtual machines descriptions to define the network each virtual interface is connected to.
  • Virtual machines (or UMLs) are created and described using the <vm> tag. Inside <vm> section, several different tags can be included to define each UML characteristics. There are lot of tags that can be used in a virtual machine but, well, this is a tutorial :), so only the basic ones are shown here:
    • <if> tag is used to create and describe network interfaces (<ipv4> tag is used to set up the IP address; <ipv6> is supported also),
    • <route> tag is used to add static routes, and
    • <forwarding> to enable forwarding. Note we use this tag in uml3 and uml4, the virtual machines that will act as routers (the others are end-systems).

2. 2. Building the Simulation

Once you have the VNUML specification written, you can build the scenario using "-t" switch of VNUML parser. That is:

bauer@host$ vnumlparser.pl -t tutorial_limited_user.xml -v

This command builds the virtual network topology described in tutorial_limited_user.xml file and boots all the virtual machines defined inside it.

After the command execution, you will see a lot of output messages, showing what the parser is exactly doing. That is because "-v" (verbose) switch is being used (we recommend always using "-v" to see how things are going).

By default, the output of each UML is redirected to the null device; if you want to see that output (getting a even more verbose output) use "-o" switch (for example "-o /tmp/boot").

After a few seconds, you should see five xterms popping up in sequence: each one correspond to one of the virtual machines defined in the simulation. After the booting process you would identify each one by the name in the login prompt (uml1, uml2, uml3, uml4 and uml5). VNUML allows several modes to interact with the virtual machines, xterm is the only way allowed if you don't have root privileges.

Be patient, because the boot process of each UML takes a while (think about how long it takes a conventional Linux kernel to boot; virtualized ones can take even more). It can take easily several minutes to boot each UML, so it could take from 1 minute (or less!) to around 10-15 minutes to boot the tutorial scenario (time depends greatly on the host machine characteristics). Maybe even you get the following prompt:

Boot timeout for virtual machine uml1 reached.  Abort, Retry, or Continue? [A/r/c]:

This use to mean that vnumlparser.pl has got tired of waitting for a virtual machine. It could be that the virtual machine has not finishing booting yet (that means, the login prompt has not appeared yet). Try 'r' in that case. If the problem persists, contact the vnuml-user mailing list.

2. 3. Testing the Simulation

You can log in the virtual machines as root user using xxxx (for times the 'x' letter) as password. After logging, you can execute commands as in a conventional GNU/Linux machine. For example try: 'ls /', 'ifconfig', 'df -h' or 'uname -ra'.

To check connectivity between virtual machines you can use ping or traceroute, as shown in the examples below. For example, from uml1 try (you should see a similar trace, if everything is going right):

uml1:~ # traceroute -n 10.0.2.2
traceroute to 10.0.2.2 (10.0.2.2), 30 hops max, 38 byte packets
 1  10.0.0.3  1.282 ms  0.726 ms  0.678 ms
 2  10.0.1.2  1.243 ms  1.462 ms  1.010 ms
 3  10.0.2.2  1.396 ms  1.345 ms  1.303 ms

From uml5 try:

uml5:~ # traceroute -n 10.0.0.1
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 38 byte packets
 1  10.0.2.1  0.916 ms  0.743 ms  0.681 ms
 2  10.0.1.1  1.072 ms  1.019 ms  1.009 ms
 3  10.0.0.1  1.420 ms  1.363 ms  1.352 ms

You will see (using ifconfig) that the interfaces in the virtual machines starts with eth1, not with eth0 as usual. Actually the eth0 interface is reserved to the management network, that will be described later.

2. 4. Releasing the Simulation Scenario

Once you have finished playing around with the simulation scenario, you can release it in a "polite way" by means of "-d" switch of VNUML parser.

bauer@host$ vnumlparser.pl -d tutorial_limited_user.xml -v

This sends a CAD (Ctrl+Alt+Delete) to each virtual machine, then you will see how the halting process begins. After waiting for a while (think that a conventional kernel can take a couple of minutes to halt, so a set of virtualized ones take quite a bit longer), the simulation scenario should be released (all virtual machines should have been halted, xterms closed and virtual networks released).

After releasing the scenario in this way, you can recreate it with "-t". Note that releasing a scenario does not mean that filesystems changes are lost. On the contrary, any change performed on them remains after the scenario has been released and restarted again. You can check it: 'touch /root/foo.bar' and you will see how the file /root/foo.bar remains next time you start using "-t" (the magic behind this resides in certain files under ~/.vnuml that stores user additions to the virtual machine filesystems: this files can be erases using the "-P", keep reading :).

You can also use the -F switch in the releasing mode, as follows:

bauer@host$ vnumlparser.pl -d tutorial_limited_user.xml -v -F

Instead of sending the CAD signal to the virtual machines, this sends a HALT signal, that is stronger: the virtual kernel halts immediately. This could corrupt the virtual filesystems so you only should use it when plain -d has failed.

There is even a stronger way to release the simulation: the purge mode (-P), but it should only be used as a last-resort measure. See VNUML User Manual for more details when -d mode fails (including the purge mode -P).

When you get familiar starting and releasing simulation, continue to main section in the tutorial: User Privileges.


3. User Privileges

In this mode, you are supposed to run vnumparser.pl as conventional user as in limited user mode, but you also have root access in order to run some commands as superuser (maybe using sudo). You will be able to connect the simulation to the host (this way virtual machines could reach Internet, if the host acts as router/NAT) and execute automatically command sequences in the virtual machines, as will be described following.

3. 1. Connecting Simulations to Host

The following is a variation of the tutorial_user_limited.xml file. Copy it to a file named tutorial_user1.xml and save it (if you don't want to do the copy-paste, you can find it in the examples directory after VNUML installation in /usr/share/examples).

Tutorial User Scenario (1)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">

<vnuml>
  <global>
    <version>1.7</version>
    <simulation_name>tutorial-u1</simulation_name>
    <automac/>
    <vm_mgmt type="none" />
    <vm_defaults>
       <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
       <kernel>/usr/share/vnuml/kernels/linux</kernel>
       <console id="0">xterm</console>
    </vm_defaults>
  </global>
  <net name="Net0" mode="uml_switch" />
  <net name="Net1" mode="uml_switch" />
  <net name="Net2" mode="uml_switch" />
  <net name="Net3" mode="uml_switch" sock="/var/run/vnuml/Net3.ctl" />
  <vm name="uml1">
    <if id="1" net="Net0">
      <ipv4>10.0.0.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml2">
    <if id="1" net="Net0">
      <ipv4>10.0.0.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml3">
    <if id="1" net="Net0">
      <ipv4>10.0.0.3</ipv4>
    </if>
    <if id="2" net="Net1">
      <ipv4>10.0.1.1</ipv4>
    </if>
    <if id="3" net="Net3">
      <ipv4>10.0.3.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml4">
    <if id="1" net="Net1">
      <ipv4>10.0.1.2</ipv4>
    </if>
    <if id="2" net="Net2">
      <ipv4>10.0.2.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.1">default</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml5">
    <if id="1" net="Net2">
      <ipv4>10.0.2.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>
  </vm>
</vnuml>

The difference is the Net3 network in a <net> tag, linked to the virtual machine uml3 in a <if> tag. This is the network that will be used to get connectivity to the host.

In order to have access to the host machine when running vnumlparser.pl as a non-privileged user, certain configurations must be performed by a privileged user prior to building the simulation scenario. In this example, the non-privileged user that will run vnumlparser.pl is bauer.

As part of the VNUML install process, a non-privileged user vnuml was created (check it now with 'id vnuml'). This user is a member of the uml-net group, which owns the /dev/net/tun cloning device. It will own the uml_switch process that will be started for the Net3 network, so that this process won't need to be run by root.

  1. The user bauer must be a member of the vnuml group which owns the directory /var/run/vnuml, where the UNIX sockets for the uml_switch processes will be stored. (The command below looks intimidating, but really all it does is add the user bauer to the vnuml group, while preserving its current group membership; maybe you prefer simple edit the /etc/group file). Note: as group membership is not updated in running shells, after adding user bauer to vnuml group, user bauer has to start a new shell or xterm session before executing the simulation.
  2. root@host# usermod -G vnuml,`groups bauer | sed 's/^.\+:[[:space:]]*//;s/[[:space:]]\\+/,/g'` bauer
    
  3. Create a TUN/TAP device owned by the vnuml user. This TUN/TAP device acts as the termination point for the host connection in the Net3 virtual network.
  4. root@host# tunctl -u vnuml -t tap0    
    Set 'tap0' persistent and owned by uid 1037
    
  5. Set an address for the host in the Net3 network (for example, 10.0.3.2) and configure a static route in the host to reach all the virtual machines using uml3 as gateway.
  6. root@host# ifconfig tap0 10.0.3.2 netmask 255.255.255.0 up
    root@host# route -A inet add -net 10.0.0.0/16 gw 10.0.3.1
    
  7. Start a uml_switch process, linked with the TUN/TAP device created previously (tap0) and owned by the vnuml user. The socket location is arbitrary. However, the /var/run/vnuml directory was created at installation for this purpose. The socket location will be used as the sock attribute in the <net> tag for Net3.
  8. root@host# su -pc 'uml_switch -tap tap0 -unix /var/run/vnuml/Net3.ctl < /dev/null > /dev/null &' vnuml
    
  9. Give the vnuml group read/write privileges to the socket that is used. Note that the UNIX socket for the uml_switch process isn't created instantly, so if these commands are scripted, a minor wait (sleep) is necessary before setting permissions on the file. (Of course, the 'ls' commands are not really needed, but they are useful to check the chmod commands has been sucessfull).
  10. root@host# sleep 1
    root@host# ls -l /var/run/vnuml/Net3.ctl
    srwxr-xr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/run/vnuml/Net3.ctl
    root@host# chmod g+rw /var/run/vnuml/Net3.ctl
    root@host# ls -l /var/run/vnuml/Net3.ctl
    srwxrwxr-x  1 vnuml vnuml 0 2005-07-29 11:48 /var/run/vnuml/Net3.ctl
    

    Now that the /var/run/vnuml/Net3.ctl exists and is readable and writeable by bauer, you can start the simulation.

    bauer@host$ vnumlparser.pl -t tutorial_user1.xml -v
    

    You should see the xterms starting as usual. After they have finished booting, you could check that now the host is part of the simulation. From uml1 you can try:

    uml1:~ # traceroute -n 10.0.3.2
    traceroute to 10.0.3.2 (10.0.3.2), 30 hops max, 38 byte packets
     1  10.0.0.3  1.779 ms  2.572 ms  1.359 ms
     2  10.0.3.2  1.785 ms  1.641 ms  1.744 ms
    

    From uml5 you can try:

    uml5:~ # traceroute -n 10.0.3.2
    traceroute to 10.0.3.2 (10.0.3.2), 30 hops max, 38 byte packets
     1  10.0.2.1  1.407 ms  0.857 ms  1.243 ms
     2  10.0.1.1  1.265 ms  1.019 ms  0.980 ms
     3  10.0.3.2  1.545 ms  3.156 ms  2.033 ms
    

    From host try:

    bauer@host$ traceroute -n 10.0.0.1
    traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 40 byte packets
     1  10.0.3.1  0.000 ms   0.000 ms   0.000 ms
     2  10.0.0.1  0.000 ms   0.000 ms   0.000 ms
    bauer@host$ traceroute -n 10.0.2.2
    traceroute to 10.0.2.2 (10.0.2.2), 30 hops max, 40 byte packets
     1  10.0.3.1  0.000 ms   0.000 ms   0.000 ms
     2  10.0.1.2  0.000 ms   0.000 ms   0.000 ms
     3  10.0.2.2  0.000 ms   0.000 ms   0.000 ms
    

    Virtual machines can reach the host this way. The scenario could be improved by configuring routing and NATing properly in the host, in order for virtual machines to reach any host on the Internet. Such a setup would be a layer 3 interconnection: the host acts as router/NAT between virtual machines and the external network. Details to configure NAT this way can be found later in this document. A stronger interconnection (layer 2) can be implemented, so virtual machines are connected to the external network directly, but root privileges are needed. We describe layer 2 interconnection later.

    To release the simulation:

    bauer@host$ vnumlparser.pl -d tutorial_user1.xml -v
    

    When the simulation has been released, note that the uml_switch process for Net3 is still running, and its accompanying UNIX socket still exists in /var/run/vnuml/Net3.ctl. Also, the tap0 device is still configured, and its gateway still exists. As long as this setup remains, new simulation scenarios may be built using the same configuration without requiring it to be set up again.

    When the user has finished running simulations that involve the network set up for Net3, the uml_switch process can be killed, and the socket removed:

    root@host# kill `lsof -t /var/run/vnuml/Net3.ctl`
    /var/run/vnuml/Net3.ctl:  6280
    root@host# rm /var/run/vnuml/Net3.ctl
    
    Now the tap0 device may be deconfigured:

    root@host# ifconfig tap0 down
    root@host# tunctl -d tap0
    Set 'tap0' nonpersistent
    

    3. 2. Executing Commands

    3. 2. 1. Generating SSH key

    VNUML parser uses SSH to access and manage the UMLs. To avoid being asked for a password whenever this happens (quite often) you must generate a public key that will be installed automatically in the UMLs by the VNUML parser (<ssh_key> tag).

    To create the public key just type:

    bauer@host$ ssh-keygen -t rsa1
    

    Select the default file to save the key (~/.ssh/identity). The passphrase is not relevant (although we recommend to use an empty passphrase, in order no user input required whenever the key is used).

    Anyway, the first time (and only once) that SSH is used, you will have to confirm the server key answering 'yes' to the question you will be asked.

    3. 2. 2. Management Network

    The following is a variation of the tutorial_user_limited.xml file. Copy it to a file named tutorial_user2.xml and save it (if you don't want to do the copy-paste, you can find it in the examples directory after VNUML installation in /usr/share/examples).

    Tutorial User Scenario (2)
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
    
    <vnuml>
      <global>
        <version>1.7</version>
        <simulation_name>tutorial-u2</simulation_name>
        <ssh_version>1</ssh_version>
        <ssh_key>~/.ssh/identity.pub</ssh_key>
        <automac/>
        <vm_mgmt type="net" network="10.250.0.0" mask="24">
           <mgmt_net sock="/var/run/vnuml/Mgmt_net.ctl" hostip="10.250.0.1"/>
        </vm_mgmt>
        <vm_defaults>
           <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
           <kernel>/usr/share/vnuml/kernels/linux</kernel>
           <console id="0">xterm</console>
        </vm_defaults>
      </global>
      <net name="Net0" mode="uml_switch" />
      <net name="Net1" mode="uml_switch" />
      <net name="Net2" mode="uml_switch" />
      <vm name="uml1">
        <if id="1" net="Net0">
          <ipv4>10.0.0.1</ipv4>
        </if>
        <route type="ipv4" gw="10.0.0.3">default</route>
        <exec seq="start" type="verbatim">nohup /usr/bin/hello &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp; </exec>
        <exec seq="stop" type="verbatim">killall hello</exec>
      </vm>
      <vm name="uml2">
        <if id="1" net="Net0">
          <ipv4>10.0.0.2</ipv4>
        </if>
        <route type="ipv4" gw="10.0.0.3">default</route>
      </vm>
      <vm name="uml3">
        <if id="1" net="Net0">
          <ipv4>10.0.0.3</ipv4>
        </if>
        <if id="2" net="Net1">
          <ipv4>10.0.1.1</ipv4>
        </if>
        <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
        <forwarding type="ip" />
      </vm>
      <vm name="uml4">
        <if id="1" net="Net1">
          <ipv4>10.0.1.2</ipv4>
        </if>
        <if id="2" net="Net2">
          <ipv4>10.0.2.1</ipv4>
        </if>
        <route type="ipv4" gw="10.0.1.1">default</route>
        <forwarding type="ip" />
      </vm>
      <vm name="uml5">
        <if id="1" net="Net2">
          <ipv4>10.0.2.2</ipv4>
        </if>
        <route type="ipv4" gw="10.0.2.1">default</route>
      </vm>
    </vnuml>
    

    VNUML uses SSH to send command sequences to the virtual machines. The SSH protocol version and the SSH public key to be used are specified in the <ssh_version> and <ssh_key> tags, respectively. Note that the SSH key file is the one generated in the previous step.

    In order to send commands to the virtual machines, a special kind of network is set up for management. There are two kind of management networks: private--establishes a peer-to-peer connection between the host and each one of the virtual machines (this requires that vnumlparser.pl be run as root); and net--a uml_switched network is used. This is set up with the type attribute in the <vm_mgmt> tag.

    When using type="net" the network and mask attributes specify a network address range that vnumlparser.pl will use to assign addresses to the virtual machines. The hostip attribute in the <mgmt_net> tag will be skipped in that range, reserved for use by the host.

    Let's see how the whole thing is working. As root, set up a tap device and start the uml_switch process (similar to what was done in the previous example):

    root@host# tunctl -u vnuml -t tap0    
    Set 'tap0' persistent and owned by uid 1037
    root@host# ifconfig tap0 10.250.0.1 netmask 255.255.255.0 up
    root@host# su -pc 'uml_switch -tap tap0 -unix /var/run/vnuml/Mgmt_net.ctl < /dev/null > /dev/null &' vnuml
    root@host# sleep 1
    root@host# chmod g+rw /var/run/vnuml/Mgmt_net.ctl
    

    Next, build the simulation:

    bauer@host$ vnumlparser.pl -t tutorial_user2.xml -v
    

    After logging in to the xterms, you can check using ifconfig that an additional interface is configured in each machine: the eth0 interface. All virtual machines are connected to the host (and between them, as side effect), with the following addresses:

    host 10.250.0.1 assigned with the ifconfig command, before building simulation
    uml1 10.250.0.2 assigned automatically by vnumlparser.pl
    uml2 10.250.0.3 assigned automatically by vnumlparser.pl
    uml3 10.250.0.4 assigned automatically by vnumlparser.pl
    uml4 10.250.0.5 assigned automatically by vnumlparser.pl
    uml5 10.250.0.6 assigned automatically by vnumlparser.pl

    You can login in each virtual machine from host using SSH. For example, to log in uml3:

    bauer@host$ ssh -1 root@10.250.0.4
    Last login: Fri Jun 16 10:33:46 2006
    Linux (none) 2.6.15.7-bs3-tls-xt-2m #1 Wed Jul 19 15:23:08 CEST 2006 i686
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    uml3:~#
    

    Note that, given that you can SSH to each virtual machine from host, you don't need xterms (just remove the <console> tag in the VNUML file) if you configure the management network properly. This is very useful when you have a lot of virtual machines in your simulation (ten or more) and don't want to be overwhelmed by the xterms.

    3. 2. 3. Command Sequences

    Once the simulated scenario is up and running, you can get access to each virtual machine using ssh and execute the commands you desire. You could, for example, manually start a web or ftp server inside uml1 and uml5 virtual machines. You could also start routing daemons in uml3 and uml4 in order to set-up dynamic routing for the scenario. You could even start automatically such services from the init scripts in the root filesystem being used, although that would probably require the use of a different filesystem for each UML.

    However, in order to be able to easily create and reproduce simulation scenarios, a simple and powerful way to specify the commands that each virtual machine has to execute to start the scenario is needed, as well as the commands to stop the simulation and return the virtual machine to a known state.

    That is basically what VNUML offers: a way to automate the execution of commands in the virtual machines and host using the execute commands mode (-x switch). By means of the <exec> tag included inside each virtual machine definition, you can specify the commands that will be executed. Commands are grouped using a command sequence identifier, specified in the seq attribute of the <exec> tag. In this tutorial we will to consider two command sequences: "start" and "stop".

    To show this functionality in this tutorial we will use the /usr/bin/hello program included in the tutorial root filesystem. It is just a quite simple program whose only function is to output 'hello' word to file /tmp/hello every 10 seconds (it is only for testing purposes, we suppose you'll use VNUML for more useful tasks :).

    In order to test it, look at the lines at the end of uml1 description in tutorial_user2.xml:

    <exec seq="start" type="verbatim"> nohup /usr/bin/hello &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp; </exec>
    <exec seq="stop" type="verbatim">killall hello</exec>
    

    Basically, we have specified the following command to be executed in uml1 whenever the simulation is started (note that <, > and & characters had to be escaped in XML files):

    nohup /usr/bin/hello </dev/null >/dev/null 2>&1 &
    

    (Why not simply use 'nohup /usr/bin/hello &'? There are ssh related problems that force to redirect standard input and output; look at VNUML User Manual for more details).

    And the following one to be executed in uml1 whenever the simulation is stopped:

    killall hello
    

    Start the simulation using:

    bauer@host$ vnumlparser.pl -x start@tutorial_user2.xml -v
    

    Note that the process is much shorter than when building the simulation scenario (mode -t). Check the existence and growing of /tmp/hello file in uml1: the hello daemon is working.

    uml1:~ # tail -f /tmp/hello
    Hello! Current date: Thu Jul 20 10:14:43 UTC 2006
    Hello! Current date: Thu Jul 20 10:14:53 UTC 2006
    Hello! Current date: Thu Jul 20 10:15:04 UTC 2006
    Hello! Current date: Thu Jul 20 10:15:14 UTC 2006
    Hello! Current date: Thu Jul 20 10:15:25 UTC 2006
    Hello! Current date: Thu Jul 20 10:15:35 UTC 2006
    Hello! Current date: Thu Jul 20 10:15:45 UTC 2006
    

    In a similar way you can stop the simulation (killing the hello daemon) with:

    bauer@host$ vnumlparser.pl -x stop@tutorial_user2.xml -v
    

    Access again to uml1 and check that hello daemon is not working now ('ps axw | grep hello' for example) and that /tmp/hello file has stopped growing.

    Once you have finished playing around with the simulation scenario, release it as usual:.

    bauer@host$ vnumlparser.pl -d tutorial_user2.xml -v
    

    As with the previous example, in order to reset to the original state, the uml_switch process will need to be killed and its accompanying UNIX socket removed. Also the tap device will need will need to be deconfigured and removed.

    root@host# kill `lsof -t /var/run/vnuml/Mgmt_net.ctl`
    /var/run/vnuml/Mgmt_net.ctl:  13746
    root@host# rm /var/run/vnuml/Mgmt_net.ctl
    root@host# ifconfig tap0 down
    root@host# tunctl -d tap0
    Set 'tap0' nonpersistent
    

4. Full Root Privileges

4. 1. Host Configuration

The <host> tag, that can be only be used if root runs vnumlparser.pl allows to automate host configuration. For example, the following example (tutorial_root1.xml) is functionally equivalent to tutorial_user1.xml (described here), but vnumlparser.pl deals with the tap0 creation and uml_switch starting. Note also that sock attribute in <host> Net3 is not used.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">

<vnuml>
  <global>
    <version>1.7</version>
    <simulation_name>tutorial-r1</simulation_name>
    <automac/>
    <vm_mgmt type="none" />
    <vm_defaults>
       <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
       <kernel>/usr/share/vnuml/kernels/linux</kernel>
       <console id="0">xterm</console>
    </vm_defaults>
  </global>
  <net name="Net0" mode="uml_switch" />
  <net name="Net1" mode="uml_switch" />
  <net name="Net2" mode="uml_switch" />
  <net name="Net3" mode="uml_switch" />
  <vm name="uml1">
    <if id="1" net="Net0">
      <ipv4>10.0.0.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml2">
    <if id="1" net="Net0">
      <ipv4>10.0.0.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml3">
    <if id="1" net="Net0">
      <ipv4>10.0.0.3</ipv4>
    </if>
    <if id="2" net="Net1">
      <ipv4>10.0.1.1</ipv4>
    </if>
    <if id="3" net="Net3">
      <ipv4>10.0.3.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml4">
    <if id="1" net="Net1">
      <ipv4>10.0.1.2</ipv4>
    </if>
    <if id="2" net="Net2">
      <ipv4>10.0.2.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.1">default</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml5">
    <if id="1" net="Net2">
      <ipv4>10.0.2.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>
  </vm>
  <host>
    <hostif net="Net3">
       <ipv4>10.0.3.2</ipv4>
    </hostif>
    <route type="ipv4" gw="10.0.3.1">10.0.0.0/16</route>
  </host>
</vnuml>

To build, test and release the example use the usual commands:

root@host# vnumlparser.pl -t tutorial_root1.xml -v
(...)
root@host# traceroute -n 10.0.0.1
traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 40 byte packets
 1  10.0.3.1  0.000 ms   0.000 ms   0.000 ms
 2  10.0.0.1  0.000 ms   0.000 ms   0.000 ms
root@host# traceroute -n 10.0.2.2
traceroute to 10.0.2.2 (10.0.2.2), 30 hops max, 40 byte packets
 1  10.0.3.1  0.000 ms   0.000 ms   0.000 ms
 2  10.0.1.2  0.000 ms   0.000 ms   0.000 ms
 3  10.0.2.2  0.000 ms   0.000 ms   0.000 ms
 root@host# vnumlparser.pl -d tutorial_root1.xml -v
(...)

4. 2. Private Management

You can use type="private" in <vm_mgmt> to establish peer-to-peer connection between the host and each one of the virtual machines (/30 networks). The <mgmt_net> tag is not used in this case. The following example (tutorial_root2.xml) is functionally equivalent to tutorial_user2.xml (described here), but using private management.

Tutorial Root Scenario (2)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">

<vnuml>
  <global>
    <version>1.7</version>
    <simulation_name>tutorial-r2</simulation_name>
    <ssh_version>1</ssh_version>
    <ssh_key>~/.ssh/identity.pub</ssh_key>
    <automac/>
    <vm_mgmt type="private" network="10.250.0.0" mask="24">
       <host_mapping />
    </vm_mgmt>
    <vm_defaults>
       <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
       <kernel>/usr/share/vnuml/kernels/linux</kernel>
       <console id="0">xterm</console>
    </vm_defaults>
  </global>
  <net name="Net0" mode="uml_switch" />
  <net name="Net1" mode="uml_switch" />
  <net name="Net2" mode="uml_switch" />
  <vm name="uml1">
    <console id="0">xterm</console>
    <if id="1" net="Net0">
      <ipv4>10.0.0.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
    <exec seq="start" type="verbatim">nohup /usr/bin/hello &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp; </exec>
    <exec seq="stop" type="verbatim">killall hello</exec>
  </vm>
  <vm name="uml2">
    <console id="0">xterm</console>
    <if id="1" net="Net0">
      <ipv4>10.0.0.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml3">
    <console id="0">xterm</console>
    <if id="1" net="Net0">
      <ipv4>10.0.0.3</ipv4>
    </if>
    <if id="2" net="Net1">
      <ipv4>10.0.1.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml4">
    <console id="0">xterm</console>
    <if id="1" net="Net1">
      <ipv4>10.0.1.2</ipv4>
    </if>
    <if id="2" net="Net2">
      <ipv4>10.0.2.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.1">default</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml5">
    <console id="0">xterm</console>
    <if id="1" net="Net2">
      <ipv4>10.0.2.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>
  </vm>
</vnuml>

The address assignment is as follows:

uml connection host-side uml-side
uml1 10.250.0.1 10.250.0.2
uml2 10.250.0.5 10.250.0.6
uml3 10.250.0.9 10.250.0.10
uml4 10.250.0.13 10.250.0.14
uml5 10.250.0.17 10.250.0.18

Previously to build the simulation, you have to generate the SSH public key for the root user, as described in the generate ssh key section of this tutorial. Otherwise, vnumlparser.pl will complaint about the ~/.ssh/idenity.pub file.

The example uses the <host_mapping> tag, only allowed to root. This tag enables virtual machine name mapping in /etc/hosts while the simulation is running:

root@host# vnumlparser.pl -t tutorial_root2.xml -v
...
root@host# cat /etc/hosts 
...
# BEGIN: tutorial-r2
# topology built: lun jul  4 21:48:08 CEST 2005
10.250.0.2 uml1
10.250.0.6 uml2
10.250.0.10 uml3
10.250.0.14 uml4
10.250.0.18 uml5
# END: tutorial-r2
...
root@host# vnumlparser.pl -d tutorial_root2.xml -v
...
root@host# cat /etc/hosts 
...
# BEGIN: tutorial-r2
# topology destroyed: lun jul  4 22:04:16 CEST 2005
# END: tutorial-r2

Therefore, you can use 'ssh -1 uml1' instead of 'ssh -1 10.250.0.2', for example: more intuitive!

4. 3. Layer 2 interconnection

Previously, we stated that is possible to connect a virtual machine directly to the host external network (layer 2 interconnection). To do so, a special kind of virtual network, specified with attribute type="virtual_bridge" in <net> tag. In addition, the name of the physical interface in the host is specified with the external attribute.

The following VNUML description (tutorial_root3.xml) is a variation of tutorial_user1.xml (described here), that directly connects uml3 with the host external network, using IP 192.168.0.150 (of course, you have to change this address to one with meaning in your host external network).

Tutorial Root Scenario (3)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">

<vnuml>
  <global>
    <version>1.7</version>
    <simulation_name>tutorial-r3</simulation_name>
    <automac/>
    <vm_mgmt type="none" />
    <vm_defaults>
       <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
       <kernel>/usr/share/vnuml/kernels/linux</kernel>
       <console id="0">xterm</console>
    </vm_defaults>
  </global>
  <net name="Net0" mode="uml_switch" />
  <net name="Net1" mode="uml_switch" />
  <net name="Net2" mode="uml_switch" />
  <net name="Net3" mode="virtual_bridge" external="eth0"/>
  <vm name="uml1">
    <if id="1" net="Net0">
      <ipv4>10.0.0.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml2">
    <if id="1" net="Net0">
      <ipv4>10.0.0.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.0.3">default</route>
  </vm>
  <vm name="uml3">
    <if id="1" net="Net0">
      <ipv4>10.0.0.3</ipv4>
    </if>
    <if id="2" net="Net1">
      <ipv4>10.0.1.1</ipv4>
    </if>
    <if id="3" net="Net3">
      <ipv4>192.168.0.150</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml4">
    <if id="1" net="Net1">
      <ipv4>10.0.1.2</ipv4>
    </if>
    <if id="2" net="Net2">
      <ipv4>10.0.2.1</ipv4>
    </if>
    <route type="ipv4" gw="10.0.1.1">default</route>
    <forwarding type="ip" />
  </vm>
  <vm name="uml5">
    <if id="1" net="Net2">
      <ipv4>10.0.2.2</ipv4>
    </if>
    <route type="ipv4" gw="10.0.2.1">default</route>
  </vm>
  <host>
    <hostif net="Net3">
       <ipv4>192.168.0.39</ipv4>
    </hostif>
    <physicalif name="eth0" ip="192.168.0.39" mask="255.255.255.0" gw="192.168.0.1" />
    <route type="ipv4" gw="192.168.0.1">default</route>
  </host>  
</vnuml>

The <host> section is not mandatory, but very recommended due to the virtual bridging set up process during "-t" deconfigures the physical interface in the host. The <ipv4> and <route> tags ensures the host remains properly configured by vnumlparser.pl after "-t" mode (we are supposing that the host address in eth0 is 192.168.0.39 and the default gateway in the external network 192.168.0.1).

During virtual bridge releasing during "-d", the external connection is also deconfigured. To restore configuration the <physicalif> tag is needed.

After building the simulation you can check that uml3 reach the gateway and the host interface in the external network:

uml3:~# ping -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=150 time=0.629 ms

--- 192.168.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.629/0.629/0.629/0.000 ms
uml3:~# ping -c 1 192.168.0.39
PING 192.168.0.39 (192.168.0.39) 56(84) bytes of data.
64 bytes from 192.168.0.39: icmp_seq=1 ttl=64 time=31.1 ms

--- 192.168.0.39 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 31.162/31.162/31.162/0.000 ms

6. Configuring NAT

This section describes a procedure to configure NAT in the host for the scenarios described in section 3 of this tutorial, althought it could be easily adapted to others VNUML scenarios using layer 3 interconnection at host. The procedure has been provided thanks to Carlos Sanmartín.

How to configure NAT? Well, we can use iptables(8), included in linux kernels from 2.4.x We can have included into kernel or load it with a module:

root@host:~# modprobe ipt_MASQUERADE

It will load ip_tables, ip_conntrack and iptable_nat.

Let's follow next steps:

  1. We have to enable forwarding into kernel, for managing packets which target isn't is our host.
    root@host:~# echo 1 > /proc/sys/net/ipv4/ip_forward
    
    For same configuration at any startup, we can add to /etc/sysctl.conf:
    net.ipv4.ip_forward=1
    
  2. We have to enable NAT rule, for translating virtual machines addresses to host output interface IP address (we suppose eth0 is the output interface):
    root@host:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    
  3. Finally, we have to add a default route for managing outgoing packages, at uml3:
    root@uml3:~# route add default gw 10.0.3.2
    

It looks like this:

uml3:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        *               255.255.255.0   U     0      0        0 eth1
10.0.1.0        *               255.255.255.0   U     0      0        0 eth2
10.0.2.0        10.0.1.2        255.255.255.0   UG    0      0        0 eth2
10.0.3.0        *               255.255.255.0   U     0      0        0 eth3
default         10.0.3.2        0.0.0.0         UG    0      0        0 eth3

Now, we can try:

uml1:~# ping -c 1 www.google.es
PING www.l.google.com (66.249.93.104) 56(84) bytes of data.
64 bytes from 66.249.93.104: icmp_seq=1 ttl=235 time=56.7 ms

--- www.l.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 56.781/56.781/56.781/0.000 ms

Enjoy it!

For further information, please visit: the Masquerading Simple HOWTO.


6. Additional Tips

In addition to the basic tutorial you can try the following tips:

  • Improve performance. A virtualized kernel runs slower than a conventional one. Anyway, UML provides a mechanism of improving efficiency using SKAS mode. Different from previous versions of vnumlparser.pl, version 1.3.0 and beyond works fine with SKAS: you just need to compile a host kernel with SKAS support enabled. More information in the UML Project Web site.
  • Capture traffic in virtual networks. You can use a patched version of uml_switch (look in the contrib/uml_router/ directory inside VNUML package) that, once compiled and installed, can be used to capture traffic in selected virtual networks. This is a powerfull feature, allowing capturing the traffic in simulation experiments for later study (capturing to a file) or even in real time with software tools like Ethereal (although this needs root privilegies). Please have a look to the capture_* attributes of <net> tag to know how to configure it. In addition, you will find a variation of the tutorial for limited user using capture features in the tutorial_limited_user_capture.xml that comes with the VNUML examples).
      ...
      <net name="Net1" 
           mode="uml_switch" 
           uml_switch_binary="/usr/local/bin/uml_switch4capture"
           capture_expression="icmp"
           capture_file="/tmp/net1.pcap" />
      ...  
    
  • Adding users and groups in the virtual machines. In the examples shown so far, there is only one user in the virtual machines: the root user. However, vnumlparser.pl can add users to the virtual machines using <user> tag. Try replacing the following vm section for uml1 in the tutorial_limited_user.xml file (or use the tutorial_limited_user2.xml file that comes with the VNUML examples):
      ...
      <vm name="uml1">
        <if id="1" net="Net0">
          <ipv4>10.0.0.1</ipv4>
        </if>
        <route type="ipv4" gw="10.0.0.3">default</route>
        <user username="yoda" group="jedi">
           <group>jedi</group>
           <group>lightside</group>
        </user>
        <user username="anakin" group="sith">
           <group>sith</group>
           <group>darkside</group>
        </user>
      </vm>
      ...
    
    Once built the simulation, you can check how the yoda and anakin users are created in uml1:
    uml1:~# id yoda
    uid=1002(yoda) gid=1003(jedi) groups=1003(jedi),1004(lightside)
    uml1:~# id anakin
    uid=1001(anakin) gid=1001(sith) groups=1001(sith),1002(darkside)
    
  • UML kernel and filesystem selection. In the examples shown so far, the kernel and UML filesystem for all the virtual machines is set up with the <vm_defaults>. However, you can specify a different UML kernel using <kernel> and <filesystem> tags in a per-vm basis.

7. Further Reading

This tutorial does not show all features of VNUML tool. Concurrent simulation execution, filetree copying, hostfs filesystems, blocking modes, VLAN integration and other interesting capabilities are available in VNUML. To know about them in detail you should next read VNUML User Manual and VNUML Language Reference. If you need to hack vnumparser.pl to adapt it to your needs, you should read the source code (we think it's very clear! :). A VNUML Developers Manual could be released in the future if needed.




Last update: