Difference between revisions of "Example-basic"
(→Scenario) |
(→Scenario) |
||
Line 18: | Line 18: | ||
<center> | <center> | ||
− | [[Image:basic-ipv4.png|50px | + | [[Image:basic-ipv4.png|center|thumb|50px|Basic IPv4]]<br /> |
'''Figure 1: Basic IPv4 scenario''' | '''Figure 1: Basic IPv4 scenario''' | ||
Revision as of 01:02, 11 March 2007
VNUML Basic Example
Authors: Fermín Galán (galan at dit.upm.es) David Fernández (david at dit.upm.es) version 1.7, March 10th, 2007
Scenario
Following example builds the basic topology shown in figure. We provide an [basic-ipv4.xml IPv4 version] and a [basic-ipv6.xml IPv6 version]. The IPv6 version is slightly different; it uses the eth0 host interface as external connection for UML3.
Note that the /tmp/uml1-conf directory must exists in the host machine in order the <filetree> tag works in UML1 (for example, you can create it with 'mkdir /tmp/uml1-conf' and create and empty file inside with 'touch /tmp/uml1-conf/foobar.conf' to test). In addition, the <exec> tags are intented to test the command execution mode (more information in the User Manual). For example, use 'vnumlparser.pl -x start@basic.xml -v' to run the commands with seq="start" (in addition, the content of /root/uml1-conf directory will be copied to the virtual machine uml1) and 'vnumlparser.pl -x stop@basic.xml -v' to run the commands with seq="stop".
Figure 1: Basic IPv4 scenario
Figure 2: Basic IPv6 scenario
VNUML Description (IPv4)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"> <vnuml> <global> <version>1.7</version> <simulation_name>basic</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> <shell>/bin/sh</shell> </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"> <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> <filetree root="/" when="start">/root/uml1-conf</filetree> <exec seq="start" type="verbatim">ls</exec> <exec seq="start" type="verbatim">pwd</exec> <exec seq="start" type="verbatim">touch /root/example.start</exec> <exec seq="stop" type="verbatim">rm /root/example.start</exec> <exec seq="stop" type="verbatim">touch /root/example.stop</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> <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> <route type="ipv4" gw="10.0.3.2">default</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 mask="255.255.255.0">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>
VNUML Description (IPv6)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"> <vnuml> <global> <version>1.7</version> <simulation_name>basic</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="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"> <mem>50M</mem> <if id="1" net="Net0"> <ipv6>3ffe:ffff:0::1/48</ipv6> </if> <route type="ipv6" gw="3ffe:ffff:0::3">2000::/3</route> <filetree root="/" when="start">/root/uml1-conf</filetree> <exec seq="start" type="verbatim">ls</exec> <exec seq="start" type="verbatim">pwd</exec> <exec seq="start" type="verbatim">touch /root/example.start</exec> <exec seq="stop" type="verbatim">rm /root/example.start</exec> <exec seq="stop" type="verbatim">touch /root/example.stop</exec> </vm> <vm name="uml2"> <if id="1" net="Net0"> <ipv6>3ffe:ffff:0::2/48</ipv6> </if> <route type="ipv6" gw="3ffe:ffff:0::3">2000::/3</route> </vm> <vm name="uml3"> <if id="1" net="Net0"> <ipv6>3ffe:ffff:0::3/48</ipv6> </if> <if id="2" net="Net1"> <ipv6>3ffe:ffff:1::3/48</ipv6> </if> <if id="3" net="Net3"> <ipv6>3ffe:ffff:3::3/48</ipv6> </if> <route type="ipv6" gw="3ffe:ffff:1::4">3ffe:ffff:2::/48</route> <route type="ipv6" gw="3ffe:ffff:3::254">2000::/3</route> <forwarding type="ipv6"/> <exec seq="start" type="verbatim">touch filesample</exec> </vm> <vm name="uml4"> <if id="1" net="Net1"> <ipv6>3ffe:ffff:1::4/48</ipv6> </if> <if id="2" net="Net2"> <ipv6>3ffe:ffff:2::4/48</ipv6> </if> <route type="ipv6" gw="3ffe:ffff:1::3">2000::/3</route> <forwarding type="ipv6"/> </vm> <vm name="uml5"> <if id="1" net="Net2"> <ipv6>3ffe:ffff:2::5/48</ipv6> </if> <route type="ipv6" gw="3ffe:ffff:2::4">2000::/3</route> </vm> <host> <hostif net="Net3"> <ipv4 mask="255.255.255.192">138.4.7.148</ipv4> <ipv6>3ffe:ffff:3::254/48</ipv6> </hostif> <physicalif name="eth0" type="ipv4" ip="138.4.7.148" mask="255.255.255.192" gw="138.4.7.189"/> <route type="ipv4" gw="138.4.7.189">default</route> <route type="ipv6" gw="3ffe:ffff:3::3">3ffe:ffff::/32</route> </host> </vnuml>
Download
- VNUML specification file: