Example-update-rootfs
Update Root-Filesystem Example
Authors: Fermín Galán (galan at dit.upm.es) David Fernández (david at dit.upm.es) version 1.7, February 15th, 2007
Contents
Scenario
This is a simple example useful to install or update applications inside a UML root filesystem. It just creates a virtual machine with external network access by means of a new subinterface configured in the host machine network interface. Once started you can use typical applications like dselect or apt-get in Debian to update the filesystem.
Two versións of the scenario are presented:
- Direct connection
- Connection through NAT
Important notes:
- As this example interacts with the host machine network interface, an incorrect use of it can let the host unaccesible. Even if correctly used, the host will be unaccesible during short periods of time while the simulation starts/stops. So, it is recomended to execute it from the host console (at least not being far from it :).
- If you are experiencing problems with the conventional xterm, we recommend you to uncomment the <xterm> tag in each virtual machine, in order to use gnome-terminal, that seems to be more stable. Of course, you will need the gnome-terminal installed in your system.
- Note the use of <filesystem type="direct"> in order to make the changes in the filesystem (e.g., installed software) permantent. If you were using for example type="cow" changes won't be stored in the /usr/share/vnuml/filesystems/root_fs_tutorial file. More information about installing software in the User Manual.
Direct Connection

- Host address: 192.168.11.16
- Virtual Machine address: 192.168.11.30
- Router address: 192.168.11.254
- Subnet Mask: 255.255.255.0 (/24) You can download the simulation file from [update-fs.xml here].
Direct Connection VNUML Description
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"> <vnuml> <global> <version>1.7</version> <simulation_name>update-fs</simulation_name> <ssh_key>/root/.ssh/identity.pub</ssh_key> <automac offset="0"/> <vm_mgmt type="none" network="192.168.0.0" mask="24" offset="0"/> </global> <net name="Net0" mode="virtual_bridge" external="eth0" /> <vm name="vm1"> <filesystem type="direct">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem> <mem>64M</mem> <kernel>/usr/share/vnuml/kernels/linux</kernel> <console id="0">xterm</console> <!--xterm>gnome-terminal,-t,-x</xterm--> <if id="1" net="Net0"> <ipv4 mask="255.255.255.0">192.168.11.30</ipv4> </if> <route type="ipv4" gw="192.168.11.254">default</route> </vm> <host> <hostif net="Net0"> <ipv4 mask="255.255.255.0">192.168.11.16</ipv4> </hostif> <physicalif name="eth0" type="ipv4" ip="192.168.11.16" mask="255.255.255.0" gw="172.16.0.1"/> <route type="ipv4" gw="192.168.11.254">default</route> </host> </vnuml>
Connection through NAT
NAT VNUML Description
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE vnuml SYSTEM "/usr/share/xml/vnuml/vnuml.dtd"> <vnuml> <global> <version>1.7</version> <simulation_name>update-fs</simulation_name> <ssh_key>/root/.ssh/identity.pub</ssh_key> <automac/> <vm_mgmt type="none"/> <vm_defaults> <console id="0">xterm</console> </vm_defaults> </global> <net name="Net0" mode="uml_switch"/> <vm name="vm1"> <filesystem type="direct">/usr/share/vnuml/filesystems/root_fs_tutorial</filesystem> <mem>128M</mem> <kernel>/usr/share/vnuml/kernels/linux</kernel> <if id="1" net="Net0"> <ipv4 mask="255.255.255.0">192.168.1.2</ipv4> </if> <route type="ipv4" gw="192.168.1.1">default</route> </vm> <host> <hostif net="Net0"> <ipv4 mask="255.255.255.0">192.168.1.1</ipv4> </hostif> </host> </vnuml>
On the host execute the following commands:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE echo 1 > /proc/sys/net/ipv4/ip_forward