Difference between revisions of "Vnx-tutorial-dynamips"
(→Starting the scenario) |
(→Description) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
VNX includes several example scenarios based on the [http://www.dit.upm.es/vnumlwiki/index.php/Tutorial VNUML tutorial scenario] but including all types of virtual machines supported by VNX (see tutorial_*.xml files in /usr/share/vnx/examples directory). | VNX includes several example scenarios based on the [http://www.dit.upm.es/vnumlwiki/index.php/Tutorial VNUML tutorial scenario] but including all types of virtual machines supported by VNX (see tutorial_*.xml files in /usr/share/vnx/examples directory). | ||
− | The scenario presented here is made of 4 Ubuntu virtual machines (h1, h2, h3 and h4) and 2 dynamips virtual routers (r1 and r2) connected through three virtual networks. The host participates in the scenario having a network interface in Net3. All hosts | + | The scenario presented here is made of 4 Ubuntu virtual machines (h1, h2, h3 and h4) and 2 dynamips virtual routers (r1 and r2) connected through three virtual networks. The host participates in the scenario having a network interface in Net3. All hosts use an Ubuntu server root filesystem. |
− | [[File:Tutorial_ubuntu-map.png|center|thumb|600px|<div align=center> | + | [[File:Tutorial_ubuntu-dynamips-map.png|center|thumb|600px|<div align=center> |
'''Figure 1: tutorial_ubuntu-dynamips scenario topology'''</div>]] | '''Figure 1: tutorial_ubuntu-dynamips scenario topology'''</div>]] | ||
Line 17: | Line 17: | ||
Start the scenario with: | Start the scenario with: | ||
cd /usr/share/vnx/examples/ | cd /usr/share/vnx/examples/ | ||
− | sudo vnx -f tutorial_ubuntu.xml -v --create | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create |
− | You will see the six virtual machine consoles opening | + | You will see the six virtual machine textual consoles opening. |
− | If you close | + | If you close a host or router console, you can reopen it with: |
− | sudo vnx -f tutorial_ubuntu-dynamips | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --console con1 -M <vmname> |
− | |||
− | |||
− | |||
− | |||
being <vmname> the name of the virtual machine. | being <vmname> the name of the virtual machine. | ||
Line 34: | Line 30: | ||
<pre> | <pre> | ||
− | + | ---------------------------------------------------------------------------------- | |
− | Scenario " | + | Scenario "tutorial-r1_all" started |
VM_NAME | TYPE | CONSOLE ACCESS COMMAND | VM_NAME | TYPE | CONSOLE ACCESS COMMAND | ||
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
h1 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h1' or 'vncviewer :0' | h1 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h1' or 'vncviewer :0' | ||
− | | | con1: 'virsh -c qemu:///system console h1' or 'screen /dev/pts/ | + | | | con1: 'virsh -c qemu:///system console h1' or 'screen /dev/pts/4' |
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
− | h2 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h2' or 'vncviewer : | + | h2 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h2' or 'vncviewer :1' |
− | | | con1: 'virsh -c qemu:///system console h2' or 'screen /dev/pts/ | + | | | con1: 'virsh -c qemu:///system console h2' or 'screen /dev/pts/6' |
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
− | r1 | | + | r1 | dynamips-3600 | con1: 'telnet localhost 12000' |
− | |||
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
− | r2 | | + | r2 | dynamips-3600 | con1: 'telnet localhost 12002' |
− | |||
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
− | h3 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h3' or 'vncviewer : | + | h3 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h3' or 'vncviewer :2' |
− | | | con1: 'virsh -c qemu:///system console h3' or 'screen /dev/pts/ | + | | | con1: 'virsh -c qemu:///system console h3' or 'screen /dev/pts/10' |
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
− | h4 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h4' or 'vncviewer : | + | h4 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h4' or 'vncviewer :3' |
− | | | con1: 'virsh -c qemu:///system console h4' or 'screen /dev/pts/ | + | | | con1: 'virsh -c qemu:///system console h4' or 'screen /dev/pts/12' |
----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ||
</pre> | </pre> | ||
You can show the previous table at any time with: | You can show the previous table at any time with: | ||
− | sudo vnx -f tutorial_ubuntu.xml -v --console-info | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --console-info |
See [[Vnx-console-mgmt|VNX Console Management]] for more details. | See [[Vnx-console-mgmt|VNX Console Management]] for more details. | ||
== Executing commands == | == Executing commands == | ||
− | + | <!-- | |
You can start the web servers in h3 and h4 with: | You can start the web servers in h3 and h4 with: | ||
− | sudo vnx -f tutorial_ubuntu.xml -v -x start-www -M h3,h4 | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v -x start-www -M h3,h4 |
This command will execute on h3 and h4 the commands defined by means of <exec> and <filetree> tags and marked with seq="start-www". | This command will execute on h3 and h4 the commands defined by means of <exec> and <filetree> tags and marked with seq="start-www". | ||
For example, for h3 virtual machine: | For example, for h3 virtual machine: | ||
− | |||
<filetree seq="start-www" root="/var/www">conf/tutorial_ubuntu/h3</filetree> | <filetree seq="start-www" root="/var/www">conf/tutorial_ubuntu/h3</filetree> | ||
− | |||
<exec seq="start-www" type="verbatim" ostype="system">chmod 644 /var/www/*</exec> | <exec seq="start-www" type="verbatim" ostype="system">chmod 644 /var/www/*</exec> | ||
<exec seq="start-www" type="verbatim" ostype="system">service apache2 start</exec> | <exec seq="start-www" type="verbatim" ostype="system">service apache2 start</exec> | ||
Line 80: | Line 72: | ||
Additionally, you can start a firefox navigator in h1 automatically using vnx (login into h1 with vnx/xxxx or root/xxxx before executing the command): | Additionally, you can start a firefox navigator in h1 automatically using vnx (login into h1 with vnx/xxxx or root/xxxx before executing the command): | ||
− | sudo vnx -f tutorial_ubuntu.xml -v -x www-h3 | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v -x www-h3 |
And stop (kill) it with: | And stop (kill) it with: | ||
− | sudo vnx -f tutorial_ubuntu.xml -v -x www-h3-off | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v -x www-h3-off |
Both commands are defined in the XML with: | Both commands are defined in the XML with: | ||
− | |||
<exec seq="www-h3" type="verbatim" ostype="xexec">firefox http://10.0.2.2</exec> | <exec seq="www-h3" type="verbatim" ostype="xexec">firefox http://10.0.2.2</exec> | ||
<exec seq="www-h3-off" type="verbatim" ostype="system">pkill firefox</exec> | <exec seq="www-h3-off" type="verbatim" ostype="system">pkill firefox</exec> | ||
Line 93: | Line 84: | ||
'''Figure 2: tutorial_ubuntu screen capture'''</div>]] | '''Figure 2: tutorial_ubuntu screen capture'''</div>]] | ||
</center> | </center> | ||
+ | --> | ||
== Stopping the scenario == | == Stopping the scenario == | ||
− | To stop the scenario preserving the changes made inside virtual machines you have to use the "-d" or "--shutdown" option: | + | To stop the scenario preserving the changes made inside virtual machines (it only works for ubuntu VMs, not for dynamips) you have to use the "-d" or "--shutdown" option: |
− | sudo vnx -f | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --shutdown |
You can later restart the scenario with: | You can later restart the scenario with: | ||
− | sudo vnx -f | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create |
To stop the scenario discarding all the changes made in the virtual machine use the "-P" or "--destroy" option: | To stop the scenario discarding all the changes made in the virtual machine use the "-P" or "--destroy" option: | ||
− | sudo vnx -f | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --destroy |
== Other interesting options == | == Other interesting options == | ||
You can restart the virtual machines individually with: | You can restart the virtual machines individually with: | ||
− | sudo vnx -f tutorial_ubuntu.xml -v --shutdown -M h1 | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --shutdown -M h1 |
− | sudo vnx -f tutorial_ubuntu.xml -v --create -M h1 | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create -M h1 |
You can suspend and restore a virtual machine with: | You can suspend and restore a virtual machine with: | ||
− | sudo vnx -f | + | sudo vnx -f tutorial_ubuntu-gui.xml -v --suspend -M h1 |
− | sudo vnx -f | + | sudo vnx -f tutorial_ubuntu-gui.xml -v --resume -M h1 |
You can see a graphical map of the virtual scenario using the --show-map option: | You can see a graphical map of the virtual scenario using the --show-map option: | ||
− | sudo vnx -f tutorial_ubuntu.xml -v --show-map | + | sudo vnx -f tutorial_ubuntu-dynamips.xml -v --show-map |
<center> | <center> | ||
Line 123: | Line 115: | ||
</center> | </center> | ||
− | == tutorial_ubuntu.xml scenario == | + | == tutorial_ubuntu-dynamips.xml scenario == |
<pre> | <pre> | ||
Line 129: | Line 121: | ||
<!-- | <!-- | ||
− | + | VNUML Root Scenario (1) | |
− | + | See the tutorial/index.html document for details | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--> | --> | ||
Line 150: | Line 129: | ||
<global> | <global> | ||
<version>2.0</version> | <version>2.0</version> | ||
− | <scenario_name> | + | <scenario_name>tutorial-r1_all</scenario_name> |
<automac/> | <automac/> | ||
− | <vm_mgmt type="none" /> | + | <vm_mgmt type="none"/> |
+ | <!--vm_mgmt type="private" network="10.250.0.0" mask="24"> | ||
+ | <host_mapping /> | ||
+ | </vm_mgmt--> | ||
<vm_defaults> | <vm_defaults> | ||
− | + | <console id="0" display="no"/> | |
<console id="1" display="yes"/> | <console id="1" display="yes"/> | ||
</vm_defaults> | </vm_defaults> | ||
+ | <dynamips_ext>tutorial_ubuntu-dynamips-dn.xml</dynamips_ext> | ||
</global> | </global> | ||
<net name="Net0" mode="virtual_bridge" /> | <net name="Net0" mode="virtual_bridge" /> | ||
− | <net name="Net1" mode="virtual_bridge" /> | + | <net name="Net1" type='ppp' mode="virtual_bridge" /> |
<net name="Net2" mode="virtual_bridge" /> | <net name="Net2" mode="virtual_bridge" /> | ||
<net name="Net3" mode="virtual_bridge" /> | <net name="Net3" mode="virtual_bridge" /> | ||
<vm name="h1" type="libvirt" subtype="kvm" os="linux"> | <vm name="h1" type="libvirt" subtype="kvm" os="linux"> | ||
− | <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu | + | <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem> |
− | <mem> | + | <mem>128M</mem> |
− | |||
− | |||
<if id="1" net="Net0"> | <if id="1" net="Net0"> | ||
− | <ipv4>10.0.0. | + | <ipv4>10.0.0.1/24</ipv4> |
</if> | </if> | ||
− | <route type="ipv4" gw="10.0.0. | + | <route type="ipv4" gw="10.0.0.3">default</route> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</vm> | </vm> | ||
Line 202: | Line 160: | ||
<mem>128M</mem> | <mem>128M</mem> | ||
<if id="1" net="Net0"> | <if id="1" net="Net0"> | ||
− | <ipv4>10.0.0. | + | <ipv4>10.0.0.2/24</ipv4> |
</if> | </if> | ||
− | <route type="ipv4" gw="10.0.0. | + | <route type="ipv4" gw="10.0.0.3">default</route> |
</vm> | </vm> | ||
− | <vm name="r1" type=" | + | <vm name="r1" type="dynamips" subtype="3600" os=""> |
− | <filesystem type="cow">/usr/share/vnx/filesystems/ | + | <filesystem type="cow">/usr/share/vnx/filesystems/c3640</filesystem> |
− | <mem> | + | <mem>96M</mem> |
− | <if id="1" net="Net0"> | + | <if id="1" net="Net0" name="e0/0"> |
− | <ipv4>10.0.0. | + | <ipv4>10.0.0.3/24</ipv4> |
</if> | </if> | ||
− | <if id="2" net="Net1"> | + | <if id="2" net="Net1" name="s1/0"> |
<ipv4>10.0.1.1/24</ipv4> | <ipv4>10.0.1.1/24</ipv4> | ||
</if> | </if> | ||
− | <if id="3" net="Net3"> | + | <if id="3" net="Net3" name="e0/1"> |
<ipv4>10.0.3.1/24</ipv4> | <ipv4>10.0.3.1/24</ipv4> | ||
</if> | </if> | ||
<route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route> | <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route> | ||
− | < | + | <exec seq="brief" type="verbatim">show ip interface brief</exec> |
</vm> | </vm> | ||
− | <vm name="r2" type=" | + | <vm name="r2" type="dynamips" subtype="3600" os=""> |
− | <filesystem type="cow">/usr/share/vnx/filesystems/ | + | <filesystem type="cow">/usr/share/vnx/filesystems/c3640</filesystem> |
− | <mem> | + | <mem>96M</mem> |
<if id="1" net="Net1" name="s1/0"> | <if id="1" net="Net1" name="s1/0"> | ||
<ipv4>10.0.1.2/24</ipv4> | <ipv4>10.0.1.2/24</ipv4> | ||
Line 233: | Line 191: | ||
</if> | </if> | ||
<route type="ipv4" gw="10.0.1.1">default</route> | <route type="ipv4" gw="10.0.1.1">default</route> | ||
− | < | + | <exec seq="brief" type="verbatim">show ip interface brief</exec> |
</vm> | </vm> | ||
Line 243: | Line 201: | ||
</if> | </if> | ||
<route type="ipv4" gw="10.0.2.1">default</route> | <route type="ipv4" gw="10.0.2.1">default</route> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</vm> | </vm> | ||
Line 258: | Line 210: | ||
</if> | </if> | ||
<route type="ipv4" gw="10.0.2.1">default</route> | <route type="ipv4" gw="10.0.2.1">default</route> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</vm> | </vm> | ||
Latest revision as of 01:13, 1 June 2012
VNX Tutorial Ubuntu
(Work in progress....)
Contents
Description
VNX includes several example scenarios based on the VNUML tutorial scenario but including all types of virtual machines supported by VNX (see tutorial_*.xml files in /usr/share/vnx/examples directory).
The scenario presented here is made of 4 Ubuntu virtual machines (h1, h2, h3 and h4) and 2 dynamips virtual routers (r1 and r2) connected through three virtual networks. The host participates in the scenario having a network interface in Net3. All hosts use an Ubuntu server root filesystem.
Starting the scenario
Start the scenario with:
cd /usr/share/vnx/examples/ sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create
You will see the six virtual machine textual consoles opening.
If you close a host or router console, you can reopen it with:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --console con1 -M <vmname>
being <vmname> the name of the virtual machine.
You can also open the consoles manually with the commands shown at the end of vnx execution:
---------------------------------------------------------------------------------- Scenario "tutorial-r1_all" started VM_NAME | TYPE | CONSOLE ACCESS COMMAND ----------------------------------------------------------------------------------------- h1 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h1' or 'vncviewer :0' | | con1: 'virsh -c qemu:///system console h1' or 'screen /dev/pts/4' ----------------------------------------------------------------------------------------- h2 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h2' or 'vncviewer :1' | | con1: 'virsh -c qemu:///system console h2' or 'screen /dev/pts/6' ----------------------------------------------------------------------------------------- r1 | dynamips-3600 | con1: 'telnet localhost 12000' ----------------------------------------------------------------------------------------- r2 | dynamips-3600 | con1: 'telnet localhost 12002' ----------------------------------------------------------------------------------------- h3 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h3' or 'vncviewer :2' | | con1: 'virsh -c qemu:///system console h3' or 'screen /dev/pts/10' ----------------------------------------------------------------------------------------- h4 | libvirt-kvm-linux | con0: 'virt-viewer -c qemu:///system h4' or 'vncviewer :3' | | con1: 'virsh -c qemu:///system console h4' or 'screen /dev/pts/12' -----------------------------------------------------------------------------------------
You can show the previous table at any time with:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --console-info
See VNX Console Management for more details.
Executing commands
Stopping the scenario
To stop the scenario preserving the changes made inside virtual machines (it only works for ubuntu VMs, not for dynamips) you have to use the "-d" or "--shutdown" option:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --shutdown
You can later restart the scenario with:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create
To stop the scenario discarding all the changes made in the virtual machine use the "-P" or "--destroy" option:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --destroy
Other interesting options
You can restart the virtual machines individually with:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --shutdown -M h1 sudo vnx -f tutorial_ubuntu-dynamips.xml -v --create -M h1
You can suspend and restore a virtual machine with:
sudo vnx -f tutorial_ubuntu-gui.xml -v --suspend -M h1 sudo vnx -f tutorial_ubuntu-gui.xml -v --resume -M h1
You can see a graphical map of the virtual scenario using the --show-map option:
sudo vnx -f tutorial_ubuntu-dynamips.xml -v --show-map
tutorial_ubuntu-dynamips.xml scenario
<?xml version="1.0" encoding="UTF-8"?> <!-- VNUML Root Scenario (1) See the tutorial/index.html document for details --> <vnx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/usr/share/xml/vnx/vnx-2.00.xsd"> <global> <version>2.0</version> <scenario_name>tutorial-r1_all</scenario_name> <automac/> <vm_mgmt type="none"/> <!--vm_mgmt type="private" network="10.250.0.0" mask="24"> <host_mapping /> </vm_mgmt--> <vm_defaults> <console id="0" display="no"/> <console id="1" display="yes"/> </vm_defaults> <dynamips_ext>tutorial_ubuntu-dynamips-dn.xml</dynamips_ext> </global> <net name="Net0" mode="virtual_bridge" /> <net name="Net1" type='ppp' mode="virtual_bridge" /> <net name="Net2" mode="virtual_bridge" /> <net name="Net3" mode="virtual_bridge" /> <vm name="h1" type="libvirt" subtype="kvm" os="linux"> <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem> <mem>128M</mem> <if id="1" net="Net0"> <ipv4>10.0.0.1/24</ipv4> </if> <route type="ipv4" gw="10.0.0.3">default</route> </vm> <vm name="h2" type="libvirt" subtype="kvm" os="linux"> <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem> <mem>128M</mem> <if id="1" net="Net0"> <ipv4>10.0.0.2/24</ipv4> </if> <route type="ipv4" gw="10.0.0.3">default</route> </vm> <vm name="r1" type="dynamips" subtype="3600" os=""> <filesystem type="cow">/usr/share/vnx/filesystems/c3640</filesystem> <mem>96M</mem> <if id="1" net="Net0" name="e0/0"> <ipv4>10.0.0.3/24</ipv4> </if> <if id="2" net="Net1" name="s1/0"> <ipv4>10.0.1.1/24</ipv4> </if> <if id="3" net="Net3" name="e0/1"> <ipv4>10.0.3.1/24</ipv4> </if> <route type="ipv4" gw="10.0.1.2">10.0.2.0/24</route> <exec seq="brief" type="verbatim">show ip interface brief</exec> </vm> <vm name="r2" type="dynamips" subtype="3600" os=""> <filesystem type="cow">/usr/share/vnx/filesystems/c3640</filesystem> <mem>96M</mem> <if id="1" net="Net1" name="s1/0"> <ipv4>10.0.1.2/24</ipv4> </if> <if id="2" net="Net2" name="e0/0"> <ipv4>10.0.2.1/24</ipv4> </if> <route type="ipv4" gw="10.0.1.1">default</route> <exec seq="brief" type="verbatim">show ip interface brief</exec> </vm> <vm name="h3" type="libvirt" subtype="kvm" os="linux"> <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem> <mem>128M</mem> <if id="1" net="Net2"> <ipv4>10.0.2.2/24</ipv4> </if> <route type="ipv4" gw="10.0.2.1">default</route> </vm> <vm name="h4" type="libvirt" subtype="kvm" os="linux"> <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem> <mem>128M</mem> <if id="1" net="Net2"> <ipv4>10.0.2.3/24</ipv4> </if> <route type="ipv4" gw="10.0.2.1">default</route> </vm> <host> <hostif net="Net3"> <ipv4>10.0.3.2/24</ipv4> </hostif> <route type="ipv4" gw="10.0.3.1">10.0.0.0/16</route> </host> </vnx>