Example-bi-tutorial-1.7

From VNUML-WIKI
Jump to: navigation, search

Two Hosts Example

Authors:
Jasmy Azry B. Johari (jasmy at rndtm.net.my)
Fermín Galán (galan at dit.upm.es)
version 1.7, November 23rd, 2006


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.7</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="100">
          <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.7</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