<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Abraxas &#187; Virtualbox</title>
	<atom:link href="http://www.effinger.org/blog/tag/virtualbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.effinger.org/blog</link>
	<description>a personal knowledge base</description>
	<lastBuildDate>Mon, 23 Jan 2012 22:05:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>VirtualBox Guest Additions und die Zeit</title>
		<link>http://www.effinger.org/blog/2009/03/22/virtualbox-guest-additions-und-die-zeit/</link>
		<comments>http://www.effinger.org/blog/2009/03/22/virtualbox-guest-additions-und-die-zeit/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 17:53:46 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtualbox]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=755</guid>
		<description><![CDATA[<p>Leider musste ich mittlerweile einen Nachteil bei der Installation der Gasterweiterungen feststellen, der mich sogar dazu brachte, sie komplett zu deinstallieren: Die Gasterweiterungen synchronisieren in unregelmäßigem Abstand die Zeit des Gastsystems mit dem Hostsystem. Wenn man als Host Windows hat und als Gast ein Linux-System mit ntpd, dann ist das nicht gerade toll. Wie also [...]]]></description>
			<content:encoded><![CDATA[<p>Leider musste ich mittlerweile einen Nachteil bei der <a href="http://www.effinger.org/blog/2009/03/14/tips-fur-ubuntu-server-unter-virtualbox/">Installation der Gasterweiterungen</a> feststellen, der mich sogar dazu brachte, sie komplett zu deinstallieren: Die Gasterweiterungen synchronisieren in unregelmäßigem Abstand die Zeit des Gastsystems mit dem Hostsystem. Wenn man als Host Windows hat und als Gast ein Linux-System mit ntpd, dann ist das nicht gerade toll. Wie also wird man die Gasterweiterungen wieder los? Nach einer <a href="http://forums.virtualbox.org/viewtopic.php?t=7839">Anleitung im Virtualbox-Forum</a> muss man das aufgrund des Fehlens einer uninstall Option von Hand folgendermaßen bewerkstelligen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>etc <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*vboxadd*&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #000000; font-weight: bold;">/</span>etc <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*vboxvfs*&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>vboxadd-<span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>vboxvfs-<span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>vboxadd-timesync
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`/</span>misc<span style="color: #000000; font-weight: bold;">/</span>vboxadd.ko
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`/</span>misc<span style="color: #000000; font-weight: bold;">/</span>vboxvfs.ko</pre></div></div>

<p>Nach einem Neustart mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> reboot</pre></div></div>

<p>sollte sich das Zeitproblem erledigt haben. Vielleicht hätte es auch einfach gereicht, die Datei /usr/sbin/vboxadd-timesync umzubenennen und stattdessen einen Link auf /dev/null zu erzeugen. Aber sicher ist sicher <img src='http://www.effinger.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Wer trotz der Entfernung der Gasterweiterungen Probleme hat, sollte <a href="http://forums.virtualbox.org/viewtopic.php?f=7&amp;t=13673">bei älteren Kernel-Versionen eventuell die Bootparameter entsprechend ändern</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/22/virtualbox-guest-additions-und-die-zeit/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Tips für Ubuntu Server unter Virtualbox</title>
		<link>http://www.effinger.org/blog/2009/03/14/tips-fur-ubuntu-server-unter-virtualbox/</link>
		<comments>http://www.effinger.org/blog/2009/03/14/tips-fur-ubuntu-server-unter-virtualbox/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 19:30:13 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtualbox]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=569</guid>
		<description><![CDATA[<p>In diesem Beitrag beschreibe ich, wie die Maus im Terminalmodus aktiviert werden kann, wie man mit VirtualBox &#62;= 2.1.0 trotz nichtverbundenem Netzwerkkabel auf sein Gastsystem unter Windows XP zugreifen kann und wie man die Gasterweiterungen installiert.</p> Maus im Terminalmodus aktivieren <p>Betreibt man als Gastsystem Ubuntu in der Server Version, so möchte man normalerweise keine grafische [...]]]></description>
			<content:encoded><![CDATA[<p>In diesem Beitrag beschreibe ich, wie die Maus im Terminalmodus aktiviert werden kann, wie man mit VirtualBox &gt;= 2.1.0 trotz nichtverbundenem Netzwerkkabel auf sein Gastsystem unter Windows XP zugreifen kann und wie man die Gasterweiterungen installiert.</p>
<h3>Maus im Terminalmodus aktivieren</h3>
<p>Betreibt man als Gastsystem Ubuntu in der Server Version, so möchte man normalerweise keine grafische Oberfläche installieren. Dennoch wäre es manchmal sehr hilfreich, man könnte zumindest die Maus nutzen. Das geht und zwar mit gdm, dem General Purpose Mouse Interface. Dieses lässt sich ganz einfach installieren mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> gpm</pre></div></div>

<h3>Permanent auf Gastsystem über Netzwerk zugreifen</h3>
<p>In VirtualBox Versionen ab 2.1.0 wurde das Netzwerksetup komplett überarbeitet. Als Folge werden Hostinterfaces nicht mehr als eigener Netzwerkadapter auf dem Hostsystem erzeugt, sondern unmittelbar einem dort existierenden Netzwerkadapter zugeordnet. Das macht aus meiner Sicht durchaus Sinn, hat aber bei mir einen unerwünschten Nebeneffekt gehabt. Sobald das Netzwerkkabel meines Netzwerkadapters auf dem Hostsystem entfernt wurde, konnte ich auch nicht mehr auf das Gastsystem zugreifen, dessen Hostinterface diesem Netzwerkadapter zugeordnet war. Allerdings möchte ich ja auch unterwegs, wenn ich keine Netzwerverbindung habe, mit meinem Gastsystem arbeiten. Eine Lösung habe ich in der <a href="http://forums.virtualbox.org/viewtopic.php?p=33943#p33943">VirtualBox FAQ</a> gefunden. Man installiert ein Loopback Netzwerkadapter entsprechend der <a href="http://support.microsoft.com/kb/839013">Anleitung von Microsoft für Windows XP</a> (sollte unter Vista analog funktionieren). Nun hat man zwei Möglichkeiten, um das Gastsystem daran anzubinden. Man kann eine Netzwerkbrücke zwischen dem bisherigen Netzwerkadapter, dem das VirtualBox Hostinterface zugeordnet ist, und dem neuen Loopback Netzwerkadapter bilden. Dazu unter <strong>Start &gt; Systemsteuerung &gt; Netzwerkverbindungen</strong> beide Netzwerkvebindungen markieren, nach einem Rechtsklick den Menüpunkt <strong>Verbindungen überbrücken</strong> auswählen. Alternativ kann man unter VirtualBox dem Gastsystem eine weitere Netzwerkverbindung vom Typ Hostinterface hinzufügen und wählt dort als Netzwerkkarte des Hosts die entsprechende Loopback Netzwerkverbindung aus. Ich habe mich für letzteres entschieden. Man muss in diesem Fall noch entsprechende IP-Addressen vergeben, damit Host- und Gastsystem miteinander kommunizieren können. Dem Host- bzw. Gastsystem habe ich die folgenden Werte zugewiesen:</p>
<table border="0">
<tbody>
<tr>
<td></td>
<td>Hostsystem (hier: Windows XP)</td>
<td>Gastsystem (hier: Ubuntu)</td>
</tr>
<tr>
<td>IP-Addresse</td>
<td>192.168.254.1</td>
<td>192.168.254.2</td>
</tr>
<tr>
<td>Netzwerkmaske</td>
<td>255.255.255.252</td>
<td>255.255.255.252</td>
</tr>
</tbody>
</table>
<p>Die Windows-Konfiguration erfolgt grafisch (analog zu der <a href="http://www.uni-koeln.de/rrzk/pc/windoku/statip/">Anleitung der Uni Köln</a>, Gateway und DNS-Server frei lassen). Bei Ubuntu editiert man dazu die Datei <a href="http://wiki.ubuntuusers.de/interfaces">/etc/network/interfaces</a> und fügt folgenden Eintrag hinzu (ggfs. Interface anpassen &#8211; hier eth1):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">auto eth1
iface eth1 inet static
address 192.168.254.2
netmask 255.255.255.252</pre></div></div>

<p>Nach einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>networking restart</pre></div></div>

<p>sollte die Verbindung zwischen Host- und Gastsystem möglich sein (testen mit ping).</p>
<h3>Gasterweiterungen unter Ubuntu Server installieren</h3>
<p>Um die Gasterweiterung, die beispielsweise das gemeinsame Nutzen von Ordnern des Host- und Gastsystems zulässt, zu installieren, müssen zunächst die entsprechenden Pakete installiert sein. Unter anderem werden die Kernel-Header Dateien benötigt. Dies habe ich zum Anlass genommen  gleich auf die neueste Kernelversion von Ubuntu 8.04 Server umzusteigen (wohl gemerkt: das dist-upgrade führt hier <strong>nicht</strong> zu einem Upgrade der Distributionsversion also z.B. 8.04 auf 8.10, da man hierfür die entsprechenden Einträge in /etc/apt/sources.list ändern müsste).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>Im nächsten Schritt müssen wir die benötigten Pakete für die Gasterweiterungen installieren.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> linux-headers-server <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span></pre></div></div>

<p>Anschließend müssen die Gasterweiterungen als CD-ROM über den Menübefehl <strong>Geräte &gt; Gasterweiterungen installieren</strong> zur Verfügung gestellt werden. Durch das Mounten der CD-ROM mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>cdrom</pre></div></div>

<p>und den anschließenden Aufruf des Installationsprogramms mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>cdrom<span style="color: #000000; font-weight: bold;">/</span>VBoxLinuxAdditions-x86.run</pre></div></div>

<p>(ggfs. für 64-bit System anpassen) und anschließendem Neustart des Gastsystems werden alle erforderlichen Schritte erledigt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/14/tips-fur-ubuntu-server-unter-virtualbox/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Virtualbox und Intrepid &#8211; das perfekte Setup &#8211; Desktop integrieren</title>
		<link>http://www.effinger.org/blog/2008/12/08/virtualbox-und-intrepid-das-perfekte-setup-desktop-integrieren/</link>
		<comments>http://www.effinger.org/blog/2008/12/08/virtualbox-und-intrepid-das-perfekte-setup-desktop-integrieren/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 23:20:23 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtualbox]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=294</guid>
		<description><![CDATA[<p>Nach der Vorstellung des perfekten Netzwerk-Setups zur Integration von Virtualbox in Intrepid, wird nun im zweiten Schritt die virtuelle Maschine in den Ubuntu-Desktop integriert. Der Desktop der virtuellen Maschine soll dabei auf einer Arbeitsfläche unter Ubuntu erscheinen. Damit das folgende Skript funktioniert, müssen zwei Bedingungen erfüllt sein.</p> Die virtuelle Maschine antwortet auf Pings. Bei Windows [...]]]></description>
			<content:encoded><![CDATA[<p>Nach der Vorstellung des <a href="http://www.effinger.org/blog/2008/11/21/virtualbox-und-intrepid-das-perfekte-setup-netzwerk/">perfekten Netzwerk-Setups zur Integration von Virtualbox in Intrepid</a>, wird nun im zweiten Schritt die virtuelle Maschine in den Ubuntu-Desktop integriert. Der Desktop der virtuellen Maschine soll dabei auf einer Arbeitsfläche unter Ubuntu erscheinen. Damit das folgende Skript funktioniert, müssen zwei Bedingungen erfüllt sein.</p>
<ol>
<li> Die virtuelle Maschine antwortet auf Pings. Bei Windows XP als Gastsystem muss man das unter <em>Start&gt;Systemsteuerung&gt;Windows Firewall</em> unter dem Reiter <em>Erweitert</em> aktivieren. Dort bei ICMP auf <em>Einstellungen</em> klicken und bei <em>Eingehende Echo-Anforderung zulassen</em> das Häkchen setzen.</li>
<li>In Virtualbox ist der VRDP-Zugriff aktiviert. Diesen aktiviert man, indem man über <em>Anwendungen&gt;Systemwerkzeuge&gt;Sun xVM Virtualbox</em> die grafische VirtualBox-Oberfläche startet, die entsprechende virtuelle Maschine auswählt und auf <em>Ändern</em> klickt. Im erscheinenden Konfigurationsdialog unter <em>Fernsteuerung</em> das Häkchen bei VRDP-Server aktivieren setzt. Der <em>Serverport</em> sollte auf <em>3389</em> und die <em>Authentisierungsmethode</em> auf <em>Null</em> gesetzt sein. Damit muss man kein Benutzername und Passwort zum Einloggen angeben, allerdings kann so natürlich jeder auf die virtuelle Maschine zugreifen. Um das zu verhindern, empfehle ich <strong>dringend</strong> einen entsprechenden Firewall-Eintrag zu setzen, der den Zugriff auf den Port 3389 auf localhost beschränkt.</li>
</ol>
<p>So nun aber zu dem Skript launchvm.sh, das die virtuelle Maschine startet und danach mit rdesktop auf die virtuelle Maschine verbindet:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># launchvm.sh by Markus Effinger, December 2008</span>
<span style="color: #666666; font-style: italic;"># latest version available at</span>
<span style="color: #666666; font-style: italic;"># http://www.effinger.org/blog/2008/12/07/virtualbox-und-intrepid-das-perfekte-setup-desktop-integrieren/</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># create your own custom app launchers by calling this script with different app arguments</span>
<span style="color: #666666; font-style: italic;"># ORIGINAL SCRIPT FROM: waspbloke, http://ohioloco.ubuntuforums.org/showthread.php?t=939183 </span>
&nbsp;
<span style="color: #666666; font-style: italic;"># change these vars to reflect your own setup</span>
<span style="color: #007800;">VirtualMachine</span>=<span style="color: #ff0000;">&quot;Windows XP Frodo&quot;</span>
<span style="color: #007800;">GuestIP</span>=<span style="color: #ff0000;">&quot;192.168.0.70&quot;</span> <span style="color: #666666; font-style: italic;">#The external ip of the Virtual Machine</span>
<span style="color: #007800;">VideoMode</span>=<span style="color: #ff0000;">&quot;setvideomodehint 1024 720 16&quot;</span> <span style="color: #666666; font-style: italic;">#for example setvideomodehint 1280 720 16</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Determine UUID of the specified Virtual Machine</span>
<span style="color: #007800;">VMUUID</span>=<span style="color: #000000; font-weight: bold;">`</span>VBoxManage showvminfo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VirtualMachine</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^UUID&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #666666; font-style: italic;"># check if VM is already running</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># if VM not running start the VM and wait while it boots</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>VBoxManage <span style="color: #660033;">-nologo</span> list runningvms <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VMUUID</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l<span style="color: #7a0874; font-weight: bold;">&#41;</span> = <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	VBoxHeadless <span style="color: #660033;">-startvm</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VirtualMachine</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Please wait, starting VM <span style="color: #007800;">$VirtualMachine</span>&quot;</span>
	<span style="color: #666666; font-style: italic;"># Wait until the graphics mode of the VM is ready - otherwise VRDP will not work</span>
	<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">30</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VideoMode</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting video mode..&quot;</span>
	VBoxManage controlvm <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VirtualMachine</span>&quot;</span> <span style="color: #007800;">$VideoMode</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># check if VM is ready to connect</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;VM started, pinging <span style="color: #007800;">$GuestIP</span> ..&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Waiting until the ping works is not really necessary, but ensures, that the guest is ready to work with..</span>
<span style="color: #000000; font-weight: bold;">until</span> <span style="color: #c20cb9; font-weight: bold;">ping</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">1</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$GuestIP</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ping not succesful&quot;</span>
	<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># now we can fire up rdesktop</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Launching rdesktop session...&quot;</span>
<span style="color: #666666; font-style: italic;">#You can launch in seamlessrdp mode if you want to...</span>
rdesktop localhost:<span style="color: #000000;">3389</span> -rclipboard:PRIMARYCLIPBOARD <span style="color: #660033;">-rsound</span> <span style="color: #660033;">-DP</span> <span style="color: #660033;">-z</span> <span style="color: #660033;">-5</span> <span style="color: #660033;">-xl</span></pre></div></div>

<p>Die Variablen des Skripts müssen selbstverständlich angepasst werden:</p>
<ul>
<li>VirtualMachine: Name der virtuellen Maschine, die gestartet werden soll</li>
<li>GuestIP: IP-Addresse des Gastsystems &#8211; muss auf pings antworten</li>
<li>VideoMode: Über diese Variable passt man die Fenstergröße von rdesktop an. Üblicherweise möchte man, dass rdesktop die gesamte Arbeitsfläche ausfüllt. In meinem Fall habe ich eine Auflösung von 1024&#215;768 und zwei Panels jeweils 24 Pixel hoch, so dass die optimale Größe bei mir 1024&#215;720 beträgt. Folglich ist diese Variable auf <em>setvideomodehint 1024 720 16</em> gesetzt. Die 16 stehen dabei für eine Farbtiefe von 16 Bit &#8211; mehr geht bei RDP nicht.</li>
</ul>
<p>Beim Ausführen von launchvm.sh startet nun jedes Mal die virtuelle Maschine und anschließend wird auf diese über rdesktop zugegriffen. Ich empfehle eine Startverknüpfung zu launchvm.sh anzulegen. Ein nettes <a href="http://www.ellogon.org/2004_site/images/windows-48x48.png">Windows XP-Logo für die Startverknüpfung zu launchvm.sh</a> findet sich bei Ellogon.</p>
<p>Im Normalfall möchte man rdesktop auf einer festen Arbeitsfläche haben. Um das zu erreichen, wird über <em>Alt-F2</em> das Programm <em>ccsm</em> gestartet. Unter der Rubrik Fensterverwaltung klicken wir auf <em>Place Windows</em>, wählen den Reiter <em>Fixed Window Placement</em> aus. Dann auf <em>Neu</em> klicken (unter <em>Windows with fixed viewport</em>) und im erscheinenden Dialogfeld als Text</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">(class=rdesktop) &amp; title=rdesktop - localhost</pre></div></div>

<p>eingeben. Mit den XViewport und YViewport Schiebern lässt sich nun die gewünschte Arbeitsfläche auswählen.</p>
<p>Damit sind wir am Ende angelangt. Es gibt zwar noch alternative Methoden, um Windows XP im Speziellen in den Ubuntu Desktop zu integrieren (z.B.  über <a href="http://ubuntuforums.org/showthread.php?t=433359">Seamlessrdp</a>, siehe dazu auch einen <a href="https://help.ubuntu.com/community/SeamlessVirtualization">Wiki-Eintrag</a>, <a href="http://ohioloco.ubuntuforums.org/showthread.php?t=939183">weitere Möglichkeiten</a> sind im Ubuntu-Forum aufgelistet), aber diese hier ist mit die stabilste und auch für andere Gastsysteme gültig.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2008/12/08/virtualbox-und-intrepid-das-perfekte-setup-desktop-integrieren/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hardware Clock Probleme mit Interpid Server und Virtualbox</title>
		<link>http://www.effinger.org/blog/2008/11/25/hardware-clock-probleme-mit-interpid-server-und-virtualbox/</link>
		<comments>http://www.effinger.org/blog/2008/11/25/hardware-clock-probleme-mit-interpid-server-und-virtualbox/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 22:37:59 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Virtualbox]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=256</guid>
		<description><![CDATA[<p>Nach meinem Upgrade meiner Server-Installation von Hardy Heron auf Intrepid Ibex unter Virtualbox auf einem Windows-Host, bekam ich beim Hochfahren auf einmal die Fehlermeldung &#8220;Cannot access the Hardware Clock via any known method. Use the &#8211;debug option to see the details of our search for an access method.&#8221; Der Aufruf von</p> hwclock --debug <p>brachte dann [...]]]></description>
			<content:encoded><![CDATA[<p>Nach meinem Upgrade meiner Server-Installation von Hardy Heron auf Intrepid Ibex unter Virtualbox auf einem Windows-Host, bekam ich beim Hochfahren auf einmal die Fehlermeldung &#8220;Cannot access the Hardware Clock via any known method. Use the &#8211;debug option to see the details of our search for an access method.&#8221; Der Aufruf von</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">hwclock <span style="color: #660033;">--debug</span></pre></div></div>

<p>brachte dann folgende Ausgabe:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">hwclock from util-linux-ng 2.14
hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.</pre></div></div>

<p>Beim Nachforschen zeigte sich, dass kein einziges /dev/rtc* Device vorhanden war, aber leider konnte ich auch kein passendes Kernelmodul finden, durch das das entsprechende Device verfügbar gewesen wäre. Wahrscheinlich ist das ein Bug von Intrepid. Als temporäre Maßnahme schafft es Abhilfe, in /etc/init.d/hwclockfirst.sh und /etc/init.d/hwlock.sh den Parameter HWCLOCKPARS auf &#8211;directisa zu setzen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Set this to any options you might need to give to hwclock, such</span>
<span style="color: #666666; font-style: italic;"># as machine hardware clock type for Alphas.</span>
<span style="color: #007800;">HWCLOCKPARS</span>=<span style="color: #ff0000;">&quot;--directisa&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2008/11/25/hardware-clock-probleme-mit-interpid-server-und-virtualbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Virtualbox und Intrepid &#8211; das perfekte Setup &#8211; Netzwerk</title>
		<link>http://www.effinger.org/blog/2008/11/21/virtualbox-und-intrepid-das-perfekte-setup-netzwerk/</link>
		<comments>http://www.effinger.org/blog/2008/11/21/virtualbox-und-intrepid-das-perfekte-setup-netzwerk/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 23:08:57 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Virtualbox]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=216</guid>
		<description><![CDATA[<p>Nach der Installation von Virtualbox erhält man zunächst folgende Fehlermeldung: &#8220;Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer. Fehlercode: NS_ERROR_FAILURE (0&#215;00004005)&#8221;. Damit USB wie gewünscht funktioniert und die Fehlermeldung verschwindet muss man unter Intrepid folgende Zeile in /etc/fstab einfügen:</p> none /proc/bus/usb usbfs devgid=46,devmode=775 0 [...]]]></description>
			<content:encoded><![CDATA[<p>Nach der Installation von <a href="http://www.virtualbox.org/wiki/Downloads">Virtualbox</a> erhält man zunächst folgende Fehlermeldung: &#8220;Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might be not installed on the host computer. Fehlercode:  NS_ERROR_FAILURE (0&#215;00004005)&#8221;. Damit USB wie gewünscht funktioniert und die Fehlermeldung verschwindet muss man unter Intrepid folgende Zeile in /etc/fstab einfügen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">none	<span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>bus<span style="color: #000000; font-weight: bold;">/</span>usb	usbfs	<span style="color: #007800;">devgid</span>=<span style="color: #000000;">46</span>,<span style="color: #007800;">devmode</span>=<span style="color: #000000;">775</span>	<span style="color: #000000;">0</span>	<span style="color: #000000;">0</span></pre></div></div>

<p>Als nächstes machen wir uns an die Netzwerkeinstellungen. Für die virtuellen Maschinen möchte ich tap Interfaces nutzen, die über eine Proxy ARP Bridge in mein Netzwerk eingebunden werden und per dhcp eine IP zugewiesen bekommen sollen. Die Proxy ARP Bridge hat den Vorteil, dass sie auch in einem drahtlosen Netzwerk funktioniert, wo eine normale Bridge mit brctl Probleme verursacht. Benötigt werden dazu die Programme parprouted und bcrelay. Gilbert Mendoza beschreibt ausführlich, wie man dieses <a href="http://www.savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/">Setup manuell einrichten</a> kann. Zunächst müssen wir verschiedene Programme installieren:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> parprouted uml-utilities bcrelay</pre></div></div>

<p>Damit bei jedem Rechnerstart die Netzwerkinterfaces automatisch erstellt werden, habe ich ein Skript gebastelt, das die entsprechenden Netzwerkinterfaces, z.B. tap0 bereitstellt. Dieses Skript basiert auf der <a href="http://farfewertoes.com/code/vboxcontrol/">Vorarbeit von Jochem Kossen</a> und der <a href="http://ubuntuforums.org/showthread.php?t=543356#4">Anleitung von Dominic Edmonds</a>. Zur Einrichtung müssen wir zunächst die Konfigurationsdatei erstellen und einrichten:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>virtualbox
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>config</pre></div></div>

<p>Diese Datei hat bei mir folgenden Inhalt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">HOST_IF</span>=<span style="color: #ff0000;">&quot;eth1&quot;</span>
<span style="color: #007800;">HOST_IP</span>=<span style="color: #ff0000;">&quot;192.168.0.64&quot;</span>
<span style="color: #007800;">VM_USER</span>=<span style="color: #ff0000;">&quot;markus&quot;</span>
<span style="color: #007800;">USE_NAT</span>=<span style="color: #ff0000;">&quot;no&quot;</span>
<span style="color: #007800;">TAPS</span>=<span style="color: #ff0000;">&quot;tap0 tap1&quot;</span>
<span style="color: #007800;">USE_ARPBRIDGE</span>=<span style="color: #ff0000;">&quot;yes&quot;</span>
<span style="color: #007800;">ARP_IPS</span>=<span style="color: #ff0000;">&quot;169.254.0.1/32 169.254.0.2/32&quot;</span></pre></div></div>

<p>Die Datei config muss nun natürlich angepasst werden. HOST_IF bezeichnet das Netzwerkinterfaces, mit dem die virtuellen Systeme verbunden werden sollen, die HOST_IP ist die entsprechene IP-Adresse des Hosts. Als VM_USER muss der Benutzer eingetragen werden, der die virtuellen Maschinen nutzt. USE_NAT wird auf no gesetzt, da ein Anbindung über NAT bei Proxy ARP nicht notwendig ist. Unter TAPS werden die zu erzeugenden tap-Netzwerkinterfaces durch ein Leerzeichen getrennt aufgelistet. USE_ARPBRIDGE setzen wir auf yes, denn wir wollen eine Proxy ARP Bridge erzeugen. Unter ARP_IPS listen wir die zu den tap-Interfaces zugehörigen IP-Adressen auf. Dazu muss man allerdings wissen, dass diese IP-Adressen keinerlei Bedeutung haben und eigentlich völlig beliebig sind. Man sollte jedoch darauf achten, dass die vergebenen IP-Adressen nicht mit denen im Netzwerksetup im Konflikt stehen. Ich verwende deshalb die oben angegebenen Microsoft IP-Adressen, die eigentlich von Windows vergeben werden, wenn kein DHCP-Server eine IP-Adresse zuweist.<br />
Im nächsten Schritt erzeugen wir eine weitere Konfigurationsdatei, die die Namen derjenigen virtuellen Systeme enthält (jedes in einer Zeile), die automatisch gestartet werden sollen, wenn das System hochfährt. Ich persönlich habe hierauf verzichtet und erzeuge deshalb eine leere Datei.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>machines_enabled</pre></div></div>

<p>Nun erzeugen wir das eigentlich Skript vboxcontrol, das die gesamte Arbeit erledigt mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vboxcontrol</pre></div></div>

<p>Die Datei füllen wir mit folgendem Inhalt (alternativ kann man das <a href="http://www.effinger.org/blog/wp-content/uploads/2008/11/vboxcontrol-20081121tar.gz">Script herunterladen</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
<span style="color: #666666; font-style: italic;">### BEGIN INIT INFO</span>
<span style="color: #666666; font-style: italic;"># Provides: virtualbox_vms</span>
<span style="color: #666666; font-style: italic;"># Required-Start:    $local_fs $syslog $remote_fs</span>
<span style="color: #666666; font-style: italic;"># Required-Stop:     $local_fs $syslog $remote_fs</span>
<span style="color: #666666; font-style: italic;"># Default-Start:     2 3 4 5</span>
<span style="color: #666666; font-style: italic;"># Default-Stop:      0 1 6</span>
<span style="color: #666666; font-style: italic;"># Short-Description: Control VirtualBox Virtual Machine instances</span>
<span style="color: #666666; font-style: italic;">### END INIT INFO</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Modified by Markus Effinger, http://www.effinger.org</span>
<span style="color: #666666; font-style: italic;"># based on</span>
<span style="color: #666666; font-style: italic;"># Version 2008051100 by Jochem Kossen &lt;jochem.kossen@gmail.com&gt;</span>
<span style="color: #666666; font-style: italic;"># http://farfewertoes.com</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Released in the public domain</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This file came with a README file containing the instructions on how</span>
<span style="color: #666666; font-style: italic;"># to use this script.</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
. <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>lsb<span style="color: #000000; font-weight: bold;">/</span>init-functions
&nbsp;
<span style="color: #666666; font-style: italic;"># Are we running from init?</span>
run_by_init<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$previous</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$runlevel</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$runlevel</span>&quot;</span> = S <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">################################################################################</span>
<span style="color: #666666; font-style: italic;"># INITIAL CONFIGURATION</span>
<span style="color: #007800;">VBOXDIR</span>=<span style="color: #ff0000;">&quot;/etc/virtualbox&quot;</span>
<span style="color: #007800;">VM_USER</span>=<span style="color: #ff0000;">&quot;root&quot;</span>
<span style="color: #007800;">USE_NAT</span>=<span style="color: #ff0000;">&quot;yes&quot;</span>
<span style="color: #007800;">USE_ARPBRIDGE</span>=<span style="color: #ff0000;">&quot;no&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${PATH:+$PATH:}</span>/bin:/usr/bin:/usr/sbin:/sbin&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$VBOXDIR</span><span style="color: #000000; font-weight: bold;">/</span>config <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    . <span style="color: #007800;">$VBOXDIR</span><span style="color: #000000; font-weight: bold;">/</span>config
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ERROR: <span style="color: #007800;">$VBOXDIR</span>/config does not exist. Exiting.&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">SU</span>=<span style="color: #ff0000;">&quot;su <span style="color: #007800;">$VM_USER</span> -c&quot;</span>
<span style="color: #007800;">VBOXMANAGE</span>=<span style="color: #ff0000;">&quot;VBoxManage -nologo&quot;</span>
<span style="color: #007800;">PARPROUTEDBIN</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">which</span> parprouted<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">BCRELAYBIN</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">which</span> bcrelay<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;">################################################################################</span>
<span style="color: #666666; font-style: italic;"># FUNCTIONS</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Determine if USE_NAT is set to &quot;yes&quot;</span>
use_nat<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$USE_NAT</span>&quot;</span> = <span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Determine if USE_ARPBRIDGE is set to &quot;yes&quot;</span>
use_arpbridging<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$USE_ARPBRIDGE</span>&quot;</span> = <span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">true</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">false</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Bring up the bridge interface</span>
enable_bridge<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If NAT is enabled, don't do anything</span>
    use_nat <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># If ARP Bridge is enabled, don't do anything</span>
    use_arpbridging <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Load the tun module</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        modprobe tun
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    brctl addbr br0 <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">true</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Disable $HOST_IF; host will use br0 instead</span>
    <span style="color: #c20cb9; font-weight: bold;">ifdown</span> <span style="color: #007800;">$HOST_IF</span>
    <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$HOST_IF</span> 0.0.0.0 promisc
    brctl addif br0 <span style="color: #007800;">$HOST_IF</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Bring up br0</span>
    <span style="color: #c20cb9; font-weight: bold;">ifup</span> br0
&nbsp;
    <span style="color: #666666; font-style: italic;"># Answer ARP requests for $HOST_IP (which now come on br0) with the MAC</span>
    <span style="color: #666666; font-style: italic;"># address of $HOST_IF</span>
    arp <span style="color: #660033;">-Ds</span> <span style="color: #007800;">$HOST_IP</span> <span style="color: #007800;">$HOST_IF</span> pub
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Bring down the bridge interface</span>
disable_bridge<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If NAT is enabled, don't do anything</span>
    use_nat <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #c20cb9; font-weight: bold;">ifdown</span> br0
    brctl delbr br0
    <span style="color: #c20cb9; font-weight: bold;">ifup</span> <span style="color: #007800;">$HOST_IF</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Activate tap interfaces</span>
enable_taps<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If NAT is enabled, don't do anything</span>
    use_nat <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># If ARP Bridge is enabled, don't do anything</span>
    use_arpbridging <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">for</span> TAP <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TAPS</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #666666; font-style: italic;"># Check if $TAP is configured already</span>
        <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$TAP</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            tunctl <span style="color: #660033;">-t</span> <span style="color: #007800;">$TAP</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$VM_USER</span>
            brctl addif br0 <span style="color: #007800;">$TAP</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Disable tap interfaces for host; guest will activate them for themselves</span>
            <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$TAP</span> 0.0.0.0 promisc
&nbsp;
            <span style="color: #666666; font-style: italic;"># Enable proxy_arp so that ARP requests can be answered correctly</span>
            <span style="color: #666666; font-style: italic;"># by the host</span>
            sysctl net.ipv4.conf.<span style="color: #007800;">$TAP</span>.proxy_arp=<span style="color: #000000;">1</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Add a route for the tap device</span>
            route add <span style="color: #660033;">-host</span> <span style="color: #007800;">$HOST_IP</span> dev <span style="color: #007800;">$TAP</span>
        <span style="color: #000000; font-weight: bold;">else</span>
            log_failure_msg <span style="color: #ff0000;">&quot;Interface <span style="color: #007800;">$TAP</span> already configured&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Activate tap interfaces for ARP Bridging</span>
enable_taps_arp<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If ARP Bridge is disabled, don't do anything</span>
    <span style="color: #000000; font-weight: bold;">!</span> use_arpbridging <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># Enable routing that pakets can be transfered from $TAP to $HOST_IF</span>
    <span style="color: #666666; font-style: italic;"># by the host</span>
    sysctl net.ipv4.ip_forward=<span style="color: #000000;">1</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># i contains the index of the current TAP device in the array of all TAP devices</span>
    <span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>
    <span style="color: #000000; font-weight: bold;">for</span> TAP <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TAPS</span>; <span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #666666; font-style: italic;"># make sure that ARP_IP contains the corresponding IP of the interface TAP</span>
        <span style="color: #666666; font-style: italic;"># j contains the index of the ip address in the array of all ip addresses</span>
        <span style="color: #007800;">j</span>=<span style="color: #000000;">0</span>
        <span style="color: #000000; font-weight: bold;">for</span> ARP_IP <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$ARP_IPS</span>; <span style="color: #000000; font-weight: bold;">do</span>
           <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$i</span> = <span style="color: #007800;">$j</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
              <span style="color: #7a0874; font-weight: bold;">break</span>
           <span style="color: #000000; font-weight: bold;">fi</span>
           <span style="color: #007800;">j</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$j</span> + <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
        <span style="color: #007800;">i</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">$i</span> + <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;"># Check if $TAP is configured already</span>
        <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$TAP</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            tunctl <span style="color: #660033;">-t</span> <span style="color: #007800;">$TAP</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$VM_USER</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Disable tap interfaces for host; guest will activate them for themselves</span>
            <span style="color: #666666; font-style: italic;">#ifconfig $TAP 0.0.0.0 promisc</span>
            ip <span style="color: #c20cb9; font-weight: bold;">link</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">$TAP</span> up
            ip addr add <span style="color: #007800;">$ARP_IP</span> dev <span style="color: #007800;">$TAP</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Enable proxy_arp so that ARP requests can be answered correctly</span>
            <span style="color: #666666; font-style: italic;"># by the host</span>
            sysctl net.ipv4.conf.<span style="color: #007800;">$TAP</span>.proxy_arp=<span style="color: #000000;">1</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Start parprouted for Proxy ARP Bridging</span>
            start-stop-daemon <span style="color: #660033;">--background</span> <span style="color: #660033;">--start</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--pidfile</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>parprouted.<span style="color: #007800;">$TAP</span>.pid \
               <span style="color: #660033;">--exec</span> <span style="color: #007800;">$PARPROUTEDBIN</span> <span style="color: #660033;">--</span> <span style="color: #007800;">$HOST_IF</span> <span style="color: #007800;">$TAP</span>
&nbsp;
            <span style="color: #666666; font-style: italic;"># Start relaying broadcasts - required for dhcp to work,</span>
            <span style="color: #666666; font-style: italic;"># do not use the -d switch for bcrelay - start-stop-daemon would not work then</span>
            start-stop-daemon <span style="color: #660033;">--background</span> <span style="color: #660033;">--start</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--make-pidfile</span> <span style="color: #660033;">--pidfile</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>bcrelay.<span style="color: #007800;">$TAP</span>.pid \
               <span style="color: #660033;">--exec</span> <span style="color: #007800;">$BCRELAYBIN</span> <span style="color: #660033;">--</span> <span style="color: #660033;">-n</span> <span style="color: #660033;">-i</span> <span style="color: #007800;">$TAP</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">$HOST_IF</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">else</span>
            log_failure_msg <span style="color: #ff0000;">&quot;Interface <span style="color: #007800;">$TAP</span> already configured&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Disable/deconfigure tap interfaces for ARP Bridging</span>
disable_taps_arp<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If ARP Bridge is disabled, don't do anything</span>
    <span style="color: #000000; font-weight: bold;">!</span> use_arpbridging <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">#Delete all created tap interfaces and kill corresponding processes</span>
    <span style="color: #000000; font-weight: bold;">for</span> TAP <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TAPS</span>; <span style="color: #000000; font-weight: bold;">do</span>
        start-stop-daemon <span style="color: #660033;">--stop</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--pidfile</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>parprouted.<span style="color: #007800;">$TAP</span>.pid \
           <span style="color: #660033;">--exec</span> <span style="color: #007800;">$PARPROUTEDBIN</span>
        start-stop-daemon <span style="color: #660033;">--stop</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--pidfile</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>bcrelay.<span style="color: #007800;">$TAP</span>.pid \
           <span style="color: #660033;">--exec</span> <span style="color: #007800;">$BCRELAYBIN</span>
        tunctl <span style="color: #660033;">-d</span> <span style="color: #007800;">$TAP</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Disable/deconfigure tap interfaces</span>
disable_taps<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #666666; font-style: italic;"># If NAT is enabled, don't do anything</span>
    use_nat <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># If ARP Bridge is enabled, don't do anything</span>
    use_arpbridging <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">return</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">for</span> TAP <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TAPS</span>; <span style="color: #000000; font-weight: bold;">do</span>
        route del <span style="color: #660033;">-host</span> <span style="color: #007800;">$HOST_IP</span> dev <span style="color: #007800;">$TAP</span>
        brctl delif br0 <span style="color: #007800;">$TAP</span>
        tunctl <span style="color: #660033;">-d</span> <span style="color: #007800;">$TAP</span>
    <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Check for running machines every few seconds; return when all machines are</span>
<span style="color: #666666; font-style: italic;"># down</span>
wait_for_closing_machines<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #007800;">RUNNING_MACHINES</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> list runningvms&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -l<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RUNNING_MACHINES</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
        wait_for_closing_machines
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">################################################################################</span>
<span style="color: #666666; font-style: italic;"># RUN</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
    start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>machines_enabled <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> use_nat <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> use_arpbridging <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                enable_bridge
                enable_taps
&nbsp;
                <span style="color: #c20cb9; font-weight: bold;">chown</span> root.vboxusers <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
                <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0660 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
            <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> use_arpbridging <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                enable_taps_arp
                <span style="color: #c20cb9; font-weight: bold;">chown</span> root.vboxusers <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
                <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0660 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
            <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
            <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>machines_enabled <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> VM; <span style="color: #000000; font-weight: bold;">do</span>
                log_action_msg <span style="color: #ff0000;">&quot;Starting VM: <span style="color: #007800;">$VM</span> ...&quot;</span>
                <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> startvm <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$VM</span><span style="color: #000099; font-weight: bold;">\&quot;</span> -type vrdp&quot;</span>
            <span style="color: #000000; font-weight: bold;">done</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #666666; font-style: italic;"># NOTE: this stops all running VM's. Not just the ones listed in the</span>
        <span style="color: #666666; font-style: italic;"># config</span>
        <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> list runningvms&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> VM; <span style="color: #000000; font-weight: bold;">do</span>
            log_action_msg <span style="color: #ff0000;">&quot;Shutting down VM: <span style="color: #007800;">$VM</span> ...&quot;</span>
            <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> controlvm <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$VM</span><span style="color: #000099; font-weight: bold;">\&quot;</span> acpipowerbutton&quot;</span>
        <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
        wait_for_closing_machines
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> use_nat <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> use_arpbridging <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            disable_taps
            disable_bridge
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> use_arpbridging <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            disable_taps_arp
        <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    bridge-up<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        enable_bridge
        <span style="color: #000000; font-weight: bold;">;;</span>
    bridge-down<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        disable_bridge
        <span style="color: #000000; font-weight: bold;">;;</span>
    taps-up<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        enable_taps
        <span style="color: #000000; font-weight: bold;">;;</span>
    taps-down<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        disable_taps
        <span style="color: #000000; font-weight: bold;">;;</span>
    taps-arp-up<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        enable_taps_arp
        <span style="color: #000000; font-weight: bold;">;;</span>
    taps-arp-down<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        disable_taps_arp
        <span style="color: #000000; font-weight: bold;">;;</span>
    start-vm<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        log_action_msg <span style="color: #ff0000;">&quot;Starting VM: $2 ...&quot;</span>
        <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> startvm <span style="color: #000099; font-weight: bold;">\&quot;</span>$2<span style="color: #000099; font-weight: bold;">\&quot;</span> -type vrdp&quot;</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    stop-vm<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        log_action_msg <span style="color: #ff0000;">&quot;Stopping VM: $2 ...&quot;</span>
        <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> controlvm <span style="color: #000099; font-weight: bold;">\&quot;</span>$2<span style="color: #000099; font-weight: bold;">\&quot;</span> acpipowerbutton&quot;</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    poweroff-vm<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        log_action_msg <span style="color: #ff0000;">&quot;Powering off VM: $2 ...&quot;</span>
        <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> controlvm <span style="color: #000099; font-weight: bold;">\&quot;</span>$2<span style="color: #000099; font-weight: bold;">\&quot;</span> poweroff&quot;</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    status<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        log_action_msg <span style="color: #ff0000;">&quot;The following virtual machines are currently running:&quot;</span>
        <span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VBOXMANAGE</span> list runningvms&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> VM; <span style="color: #000000; font-weight: bold;">do</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VM</span> (&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$SU</span> <span style="color: #ff0000;">&quot;VBoxManage showvminfo <span style="color: #007800;">$VM</span>|grep Name:|sed -e 's/^Name:\s*//g'&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">')'</span>
        <span style="color: #000000; font-weight: bold;">done</span>
        <span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        log_failure_msg <span style="color: #ff0000;">&quot;Usage: $0 {start|stop|status|start-vm &lt;VM name&gt;|stop-vm &lt;VM name&gt;|poweroff-vm &lt;VM name&gt;|bridge-up|bridge-down|taps-up|taps-down}&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Nach dem Speichern der Datei setzen wir noch entsprechende Dateiberechtigungen und sorgen dafür, dass dieses Skript in den Startvorgang des Systems aufgenommen wird:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root.root <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vboxcontrol
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vboxcontrol
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-rc.d vboxcontrol defaults <span style="color: #000000;">99</span> <span style="color: #000000;">10</span></pre></div></div>

<p>Damit wir in Virtualbox gleich loslegen können, starten wir das Skript durch direkten Aufruf mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vboxcontrol start</pre></div></div>

<p>Bei der virtuellen Maschine passen wir unter dem Punkt Netzwerk folgende Punkte an:<br />
Angeschlossen an: Hostinterface<br />
Name des Interfaces: tap0 (also eines der Interfaces, welches oben unter TAPS angegeben wurde)</p>
<p>Sehr praktisch an dem vboxcontrol Skript ist, dass beim Herunterfahren des Systems oder dem Aufruf des Skripts mit dem Parameter stop <em>alle</em> laufenden virtuellen Maschinen ordnungsgemäß heruntergefahren werden. Das Wort alle habe ich deswegen kursiv hervorgehoben, da nicht nur die<br />
/etc/virtualbox/machines_enabled gelisteten Maschinen heruntergefahren werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2008/11/21/virtualbox-und-intrepid-das-perfekte-setup-netzwerk/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

