Difference between revisions of "Example-Twohost"

From VNUML-WIKI
Jump to: navigation, search
(Scenario)
(VNUML Description)
 
(6 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
  '''Jasmy Azry B. Johari (jasmy at rndtm.net.my)'''
 
  '''Jasmy Azry B. Johari (jasmy at rndtm.net.my)'''
 
  '''Fermín Galán (galan at dit.upm.es)'''
 
  '''Fermín Galán (galan at dit.upm.es)'''
  '''version 1.7, November 23rd, 2006'''
+
  '''version 1.8, October 3rd, 2007'''
 
</big>
 
</big>
  
Line 50: Line 50:
 
<pre>
 
<pre>
 
  <?xml version="1.0" encoding="UTF-8"?>
 
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
+
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
 
+
<vnuml>
<vnuml>
+
  <global>
    <global>
+
      <version>1.8</version>
      <version>1.7</version>
+
      <simulation_name>umlA</simulation_name>
      <simulation_name>umlA</simulation_name>
+
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
+
      <automac offset="0"/>
      <automac offset="0"/>
+
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="52">
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="100">
+
        <host_mapping/>
          <host_mapping/>
+
      </vm_mgmt>
      </vm_mgmt>
+
      <vm_defaults>
      <vm_defaults>
+
        <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
          <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
+
      </vm_defaults>
      </vm_defaults>
+
  </global>
    </global>
+
 
   
+
  <net name="Net0" mode="uml_switch"/>
    <net name="Net0" mode="uml_switch" />
+
  <net name="Net1" mode="uml_switch"/>
    <net name="Net1" mode="uml_switch" />
+
  <net name="Net2" mode="uml_switch"/>
    <net name="Net2" mode="uml_switch" />
+
  <net name="Net3" mode="virtual_bridge" external="eth0"/>
    <net name="Net3" mode="virtual_bridge" external="eth0" />
+
 
+
  <vm name="umlA1">
    <vm name="umlA1">
+
      <mem>50M</mem>
      <mem>50M</mem>
+
      <if id="1" net="Net0">
      <if id="1" net="Net0">
+
        <ipv4>10.0.0.1</ipv4>
          <ipv4>10.0.0.1</ipv4>
+
      </if>
      </if>
+
      <route type="ipv4" gw="10.0.0.3">default</route>
      <route type="ipv4" gw="10.0.0.3">default</route>
+
  </vm>
    </vm>
+
  <vm name="umlA2">
 
+
      <if id="1" net="Net0">
    <vm name="umlA2">
+
        <ipv4>10.0.0.2</ipv4>
      <if id="1" net="Net0">
+
      </if>
          <ipv4>10.0.0.2</ipv4>
+
      <route type="ipv4" gw="10.0.0.3">default</route>
      </if>
+
  </vm>
      <route type="ipv4" gw="10.0.0.3">default</route>
+
  <vm name="umlA3">
    </vm>
+
      <if id="1" net="Net0">
 
+
        <ipv4>10.0.0.3</ipv4>
    <vm name="umlA3">
+
      </if>
      <if id="1" net="Net0">
+
      <if id="2" net="Net1">
          <ipv4>10.0.0.3</ipv4>
+
        <ipv4>10.0.1.1</ipv4>
      </if>
+
      </if>
      <if id="2" net="Net1">
+
      <if id="3" net="Net3">
          <ipv4>10.0.1.1</ipv4>
+
        <ipv4>10.10.3.1</ipv4>
      </if>
+
      </if>
      <if id="3" net="Net3">
+
      <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
          <ipv4>10.10.3.1</ipv4>
+
      <route type="ipv4" gw="10.10.3.4">default</route>
      </if>
+
      <forwarding type="ip"/>
      <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
+
  </vm>
      <route type="ipv4" gw="10.10.3.4">default</route>
+
  <vm name="umlA4">
      <forwarding type="ip"/>
+
      <if id="1" net="Net1">
    </vm>
+
        <ipv4>10.0.1.2</ipv4>
+
      </if>
    <vm name="umlA4">
+
      <if id="2" net="Net2">
      <if id="1" net="Net1">
+
        <ipv4>10.0.2.1</ipv4>
          <ipv4>10.0.1.2</ipv4>
+
      </if>
      </if>
+
      <route type="ipv4" gw="10.0.1.1">default</route>
      <if id="2" net="Net2">
+
      <forwarding type="ip"/>
        <ipv4>10.0.2.1</ipv4>
+
  </vm>
      </if>
+
  <vm name="umlA5">
      <route type="ipv4" gw="10.0.1.1">default</route>
+
      <if id="1" net="Net2">
      <forwarding type="ip"/>
+
        <ipv4>10.0.2.2</ipv4>
    </vm>
+
      </if>
 
+
      <route type="ipv4" gw="10.0.2.1">default</route>
    <vm name="umlA5">
+
  </vm>
      <if id="1" net="Net2">
+
  <host>
          <ipv4>10.0.2.2</ipv4>
+
      <hostif net="Net3">
      </if>
+
        <ipv4 mask="255.255.255.0">10.10.3.2</ipv4>
      <route type="ipv4" gw="10.0.2.1">default</route>
+
      </hostif>
    </vm>
+
      <physicalif name="eth0" type="ipv4" ip="10.10.3.2" mask="255.255.255.0" gw="10.10.3.3"/>
 
+
      <route type="ipv4" gw="10.10.3.1">10.0.0.0/16</route>
    <host>
+
      <route type="ipv4" gw="10.10.3.4">default</route>
      <hostif net="Net3">
+
      <forwarding type="ip"/>
          <ipv4 mask="255.255.255.0">10.10.3.2</ipv4>
+
  </host>
      </hostif>
+
</vnuml>
      <physicalif name="eth0" type="ipv4" ip="10.10.3.2" mask="255.255.255.0" gw="10.10.3.3"/>
 
      <route type="ipv4" gw="10.10.3.1">10.0.0.0/16</route>
 
      <route type="ipv4" gw="10.10.3.4">default</route>
 
      <forwarding type="ip"/>
 
    </host>
 
 
 
</vnuml>
 
 
</pre>
 
</pre>
  
Line 136: Line 129:
 
<pre>
 
<pre>
 
  <?xml version="1.0" encoding="UTF-8"?>
 
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
+
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
 
+
<vnuml>
<vnuml>
+
  <global>
 
+
      <version>1.8</version>
    <global>
+
      <simulation_name>umlB</simulation_name>
      <version>1.7</version>
+
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <simulation_name>umlB</simulation_name>
+
      <automac offset="1"/>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
+
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="100">
      <automac offset="1"/>
+
        <host_mapping/>
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="100">
+
      </vm_mgmt>
          <host_mapping/>
+
      <vm_defaults>
      </vm_mgmt>
+
        <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <vm_defaults>
+
      </vm_defaults>
          <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
+
  </global>
      </vm_defaults>
+
 
    </global>
+
  <net name="Net4" mode="uml_switch"/>
   
+
  <net name="Net5" mode="uml_switch"/>
    <net name="Net4" mode="uml_switch" />
+
  <net name="Net6" mode="uml_switch"/>
    <net name="Net5" mode="uml_switch" />
+
  <net name="Net3" mode="virtual_bridge" external="eth0"/>
    <net name="Net6" mode="uml_switch" />
+
 
    <net name="Net3" mode="virtual_bridge" external="eth0" />
+
  <vm name="umlB1">
   
+
      <mem>50M</mem>
    <vm name="umlB1">
+
      <if id="1" net="Net4">
      <mem>50M</mem>
+
        <ipv4>10.1.0.1</ipv4>
      <if id="1" net="Net4">
+
      </if>
          <ipv4>10.1.0.1</ipv4>
+
      <route type="ipv4" gw="10.1.0.3">default</route>
      </if>
+
  </vm>
      <route type="ipv4" gw="10.1.0.3">default</route>
+
  <vm name="umlB2">
    </vm>
+
      <if id="1" net="Net4">
 
+
        <ipv4>10.1.0.2</ipv4>
    <vm name="umlB2">
+
      </if>
      <if id="1" net="Net4">
+
      <route type="ipv4" gw="10.1.0.3">default</route>
          <ipv4>10.1.0.2</ipv4>
+
  </vm>
      </if>
+
  <vm name="umlB3">
      <route type="ipv4" gw="10.1.0.3">default</route>
+
      <if id="1" net="Net4">
    </vm>
+
        <ipv4>10.1.0.3</ipv4>
 
+
      </if>
    <vm name="umlB3">
+
      <if id="2" net="Net5">
      <if id="1" net="Net4">
+
        <ipv4>10.1.1.1</ipv4>
          <ipv4>10.1.0.3</ipv4>
+
      </if>
      </if>
+
      <if id="3" net="Net3">
      <if id="2" net="Net5">
+
        <ipv4>10.10.3.4</ipv4>
          <ipv4>10.1.1.1</ipv4>
+
      </if>
      </if>
+
      <route type="ipv4" gw="10.1.1.2">10.1.2.0/24</route>
      <if id="3" net="Net3">
+
      <route type="ipv4" gw="10.10.3.1">default</route>
          <ipv4>10.10.3.4</ipv4>
+
      <forwarding type="ip"/>
      </if>
+
  </vm>
      <route type="ipv4" gw="10.1.1.2">10.1.2.0/24</route>
+
  <vm name="umlB4">
      <route type="ipv4" gw="10.10.3.1">default</route>
+
      <if id="1" net="Net5">
      <forwarding type="ip"/>
+
        <ipv4>10.1.1.2</ipv4>
    </vm>
+
      </if>
+
      <if id="2" net="Net6">
    <vm name="umlB4">
+
        <ipv4>10.1.2.1</ipv4>
      <if id="1" net="Net5">
+
      </if>
          <ipv4>10.1.1.2</ipv4>
+
      <route type="ipv4" gw="10.1.1.1">default</route>
      </if>
+
      <forwarding type="ip"/>
      <if id="2" net="Net6">
+
  </vm>
          <ipv4>10.1.2.1</ipv4>
+
  <vm name="umlB5">
      </if>
+
      <if id="1" net="Net6">
      <route type="ipv4" gw="10.1.1.1">default</route>
+
        <ipv4>10.1.2.2</ipv4>
      <forwarding type="ip"/>
+
      </if>
    </vm>
+
      <route type="ipv4" gw="10.1.2.1">default</route>
 
+
  </vm>
    <vm name="umlB5">
+
 
      <if id="1" net="Net6">
+
  <host>
          <ipv4>10.1.2.2</ipv4>
+
      <hostif net="Net3">
      </if>
+
        <ipv4 mask="255.255.255.0">10.10.3.3</ipv4>
      <route type="ipv4" gw="10.1.2.1">default</route>
+
      </hostif>
    </vm>
+
      <physicalif name="eth0" type="ipv4" ip="10.10.3.3" mask="255.255.255.0" gw="10.10.3.2"/>
   
+
      <route type="ipv4" gw="10.10.3.4">10.1.0.0/16</route>
    <host>
+
      <route type="ipv4" gw="10.10.3.1">default</route>
      <hostif net="Net3">
+
      <forwarding type="ip"/>
          <ipv4 mask="255.255.255.0">10.10.3.3</ipv4>
+
  </host>
      </hostif>
+
</vnuml>
      <physicalif name="eth0" type="ipv4" ip="10.10.3.3" mask="255.255.255.0" gw="10.10.3.2"/>
 
      <route type="ipv4" gw="10.10.3.4">10.1.0.0/16</route>
 
      <route type="ipv4" gw="10.10.3.1">default</route>
 
      <forwarding type="ip"/>
 
    </host>
 
 
 
</vnuml>
 
 
</pre>
 
</pre>
  
 
== Download ==
 
== Download ==
  
* VNUML specification file: [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/umlA.xml umlA.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/umlB.xml umlB.xml]
+
* VNUML specification files: [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/umlA.xml umlA.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/umlB.xml umlB.xml]
  
 
== Old Releases ==
 
== Old Releases ==
Line 227: Line 213:
 
* [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/1.3/bi-tutorial.html 1.3]
 
* [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/1.3/bi-tutorial.html 1.3]
 
* [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/1.6/bi-tutorial.html 1.6]
 
* [http://jungla.dit.upm.es/~vnuml/doc/examples/bi-tutorial/1.6/bi-tutorial.html 1.6]
 +
* [[Example-bi-tutorial-1.7|1.7]]

Latest revision as of 11:52, 16 October 2007

Two Hosts Example

Authors:
Jasmy Azry B. Johari (jasmy at rndtm.net.my)
Fermín Galán (galan at dit.upm.es)
version 1.8, October 3rd, 2007


Scenario

This example (provided originally by Jasmy Azry B. Johari from Telekom Malaysia) shows a two-hosts simulation. There are two host (A and B), connected throught a network segment (eth1 interface in both host). One VNUML specification (umlA.xml) is built in host A and a second VNUML specification (umlB.xml) is built in host B. Each piece of simulation is based on the VNUML basic example.

Note the use of offset="1" in the <automac> tags in umlB.xml, to avoid umlA3 and umlB3 have the same MAC address in Net3.The example assumes that both hosts are connected using the eth0 in both cases.


Bi-tutorial


Each piece of simulation must be started in each host:

hostA# vnumlparser.pl -t umlA.xml -v
...
hostB# vnumlparser.pl -t umlB.xml -v

Traceroute traces (umlB5 -> umlA5 and umlA1 -> umlB5):

umlB5:~# traceroute 10.0.2.2 -n
traceroute to 10.0.2.2 (10.0.2.2), 30 hops max, 38 byte packets
 1  10.1.2.1 (10.1.2.1)  0.875 ms  0.816 ms  0.655 ms
 2  10.1.1.1 (10.1.1.1)  1.058 ms  1.697 ms  1.032 ms
 3  10.10.3.1 (10.10.3.1)  1.659 ms  1.874 ms  1.729 ms
 4  10.0.1.2 (10.0.1.2)  1.890 ms  2.454 ms  1.690 ms
 5  10.0.2.2 (10.0.2.2)  1.988 ms  2.295 ms  1.906 ms

umlA1:~# traceroute 10.1.2.2 -n
traceroute to 10.1.2.2 (10.1.2.2), 30 hops max, 38 byte packets
 1  10.0.0.3 (10.0.0.3)  1.198 ms  1.429 ms  1.173 ms
 2  10.10.3.4 (10.10.3.4)  1.869 ms  3.275 ms  1.586 ms
 3  10.1.1.2 (10.1.1.2)  2.021 ms  2.182 ms  1.774 ms
 4  10.1.2.2 (10.1.2.2)  2.297 ms  2.456 ms  2.040 ms

VNUML Description

Host A (umlA.xml):

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>umlA</simulation_name>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <automac offset="0"/>
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="52">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      </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="umlA1">
      <mem>50M</mem>
      <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="umlA2">
      <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="umlA3">
      <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.10.3.1</ipv4>
      </if>
      <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route>
      <route type="ipv4" gw="10.10.3.4">default</route>
      <forwarding type="ip"/>
   </vm>
   <vm name="umlA4">
      <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="umlA5">
      <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 mask="255.255.255.0">10.10.3.2</ipv4>
      </hostif>
      <physicalif name="eth0" type="ipv4" ip="10.10.3.2" mask="255.255.255.0" gw="10.10.3.3"/>
      <route type="ipv4" gw="10.10.3.1">10.0.0.0/16</route>
      <route type="ipv4" gw="10.10.3.4">default</route>
      <forwarding type="ip"/>
   </host>
</vnuml>

Host B (umlB.xml):

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>umlB</simulation_name>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <automac offset="1"/>
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="100">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      </vm_defaults>
   </global>
   
   <net name="Net4" mode="uml_switch"/>
   <net name="Net5" mode="uml_switch"/>
   <net name="Net6" mode="uml_switch"/>
   <net name="Net3" mode="virtual_bridge" external="eth0"/>
   
   <vm name="umlB1">
      <mem>50M</mem>
      <if id="1" net="Net4">
         <ipv4>10.1.0.1</ipv4>
      </if>
      <route type="ipv4" gw="10.1.0.3">default</route>
   </vm>
   <vm name="umlB2">
      <if id="1" net="Net4">
         <ipv4>10.1.0.2</ipv4>
      </if>
      <route type="ipv4" gw="10.1.0.3">default</route>
   </vm>
   <vm name="umlB3">
      <if id="1" net="Net4">
         <ipv4>10.1.0.3</ipv4>
      </if>
      <if id="2" net="Net5">
         <ipv4>10.1.1.1</ipv4>
      </if>
      <if id="3" net="Net3">
         <ipv4>10.10.3.4</ipv4>
      </if>
      <route type="ipv4" gw="10.1.1.2">10.1.2.0/24</route>
      <route type="ipv4" gw="10.10.3.1">default</route>
      <forwarding type="ip"/>
   </vm>
   <vm name="umlB4">
      <if id="1" net="Net5">
         <ipv4>10.1.1.2</ipv4>
      </if>
      <if id="2" net="Net6">
         <ipv4>10.1.2.1</ipv4>
      </if>
      <route type="ipv4" gw="10.1.1.1">default</route>
      <forwarding type="ip"/>
   </vm>
   <vm name="umlB5">
      <if id="1" net="Net6">
         <ipv4>10.1.2.2</ipv4>
      </if>
      <route type="ipv4" gw="10.1.2.1">default</route>
   </vm>
   
   <host>
      <hostif net="Net3">
         <ipv4 mask="255.255.255.0">10.10.3.3</ipv4>
      </hostif>
      <physicalif name="eth0" type="ipv4" ip="10.10.3.3" mask="255.255.255.0" gw="10.10.3.2"/>
      <route type="ipv4" gw="10.10.3.4">10.1.0.0/16</route>
      <route type="ipv4" gw="10.10.3.1">default</route>
      <forwarding type="ip"/>
   </host>
</vnuml>

Download

Old Releases