Example-VLANs

From VNUML-WIKI
Jump to: navigation, search

VNUML VLANs Example

Authors:
Fermín Galán (galan at dit.upm.es)
version 1.8, October 3rd, 2007

Scenario

This example shows four simultaions to be executed concurrently. First vlan-test-1 boots three virtual machines, each one connected to one VLAN in the host physical interface eth0 (in particular VLANs 10, 22, and 23). The other three simulations (vlan-test-2a, vlan-test-2b y vlan-test-2c) boots one virtual machine each one, connected to one of the three VLANs. Note that the same <net> is used for vlan-test-1 and the correnponding vlan-test-2X. In all the case, eth0 is the physical interface where the VLANs will be created.

VNUML Description

vlan-test-1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>vlan-test-1</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="0">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
         <shell>/bin/sh</shell>
      </vm_defaults>
   </global>
   
   <net name="vlan-10" mode="virtual_bridge" external="eth0" vlan="10"/>
   <net name="vlan-22" mode="virtual_bridge" external="eth0" vlan="22"/>
   <net name="vlan-23" mode="virtual_bridge" external="eth0" vlan="23"/>

   <vm name="uml10">   
      <if id="1" net="vlan-10">
         <ipv4 mask="255.255.255.0">192.168.11.60</ipv4>
      </if>
      <route type="ipv4" gw="192.168.11.1">default</route>
   </vm>

   <vm name="uml22">  
      <if id="1" net="vlan-22">
         <ipv4 mask="255.255.255.192">195.1.86.3</ipv4>
      </if>
      <route type="ipv4" gw="195.1.86.1">default</route>
   </vm>

   <vm name="uml23">
      <if id="1" net="vlan-23">
         <ipv4 mask="255.255.255.192">195.1.88.3</ipv4>
      </if>
      <route type="ipv4" gw="195.1.88.1">default</route>
   </vm>
</vnuml>

vlan-test-2a

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd">
<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>vlan-test-2a</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="12">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <shell>/bin/sh</shell>
      </vm_defaults>
   </global>

   <net name="vlan-10" mode="virtual_bridge" external="eth0" vlan="10"/>

   <vm name="uml10a">
      <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <if id="1" net="vlan-10">
         <ipv4 mask="255.255.255.0">192.168.11.61</ipv4>
      </if>
      <route type="ipv4" gw="192.168.11.1">default</route>
   </vm>

</vnuml>

vlan-test-2b

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

   <global>
      <version>1.8</version>
      <simulation_name>vlan-test-2b</simulation_name>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <automac offset="2"/>
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="20">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <shell>/bin/sh</shell>
      </vm_defaults>
   </global>

   <net name="vlan-22" mode="virtual_bridge" external="eth0" vlan="22"/>

   <vm name="uml22b">
      <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <if id="1" net="vlan-22">
         <ipv4 mask="255.255.255.192">195.1.86.4</ipv4>
      </if>
      <route type="ipv4" gw="195.1.86.1">default</route>
   </vm>

</vnuml>

vlan-test-2c

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

<vnuml>
   <global>
      <version>1.8</version>
      <simulation_name>vlan-test-2c</simulation_name>
      <ssh_key>/root/.ssh/identity.pub</ssh_key>
      <automac offset="3"/>
      <vm_mgmt type="private" network="192.168.0.0" mask="24" offset="32">
         <host_mapping/>
      </vm_mgmt>
      <vm_defaults>
         <shell>/bin/sh</shell>
      </vm_defaults>
   </global>

   <net name="vlan-23" mode="virtual_bridge" external="eth0" vlan="23"/>

   <vm name="uml23c">
      <filesystem type="cow">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem>
      <if id="1" net="vlan-23">
         <ipv4 mask="255.255.255.192">195.1.88.4</ipv4>
      </if>
      <route type="ipv4" gw="195.1.88.1">default</route>
   </vm>
</vnuml>

Download

Old Releases