summaryrefslogtreecommitdiffstats
path: root/debian/virtualbox.files/wiki.html
blob: 4813a23dbf8dd0ff80901aa68b2ee691be122383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="robots" content="index,nofollow">

<title>VirtualBox - Debian Wiki</title>
<script type="text/javascript" src="/htdocs/common/js/common.js"></script>

<script type="text/javascript">
<!--// common functions

// We keep here the state of the search box
searchIsDisabled = false;

function searchChange(e) {
    // Update search buttons status according to search box content.
    // Ignore empty or whitespace search term.
    var value = e.value.replace(/\s+/, '');
    if (value == '' || searchIsDisabled) { 
        searchSetDisabled(true);
    } else {
        searchSetDisabled(false);
    }
}

function searchSetDisabled(flag) {
    // Enable or disable search
    document.getElementById('fullsearch').disabled = flag;
    document.getElementById('titlesearch').disabled = flag;
}

function searchFocus(e) {
    // Update search input content on focus
    if (e.value == 'Search') {
        e.value = '';
        e.className = '';
        searchIsDisabled = false;
    }
}

function searchBlur(e) {
    // Update search input content on blur
    if (e.value == '') {
        e.value = 'Search';
        e.className = 'disabled';
        searchIsDisabled = true;
    }
}

function actionsMenuInit(title) {
    // Initialize action menu
    for (i = 0; i < document.forms.length; i++) {
        var form = document.forms[i];
        if (form.className == 'actionsmenu') {
            // Check if this form needs update
            var div = form.getElementsByTagName('div')[0];
            var label = div.getElementsByTagName('label')[0];
            if (label) {
                // This is the first time: remove label and do buton.
                div.removeChild(label);
                var dobutton = div.getElementsByTagName('input')[0];
                div.removeChild(dobutton);
                // and add menu title
                var select = div.getElementsByTagName('select')[0];
                var item = document.createElement('option');
                item.appendChild(document.createTextNode(title));
                item.value = 'show';
                select.insertBefore(item, select.options[0]);
                select.selectedIndex = 0;
            }
        }
    }
}
//-->
</script>


<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/rightsidebar/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="/htdocs/rightsidebar/css/screen.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="/htdocs/rightsidebar/css/print.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="/htdocs/rightsidebar/css/projection.css">
<link rel="alternate" title="Debian Wiki Recent Changes" href="/RecentChanges?action=rss_rc&amp;ddiffs=1&amp;unique=1" type="application/rss+xml">

<link rel="Start" href="/FrontPage">
<link rel="Alternate" title="Wiki Markup" href="/VirtualBox?action=raw">
<link rel="Alternate" media="print" title="Print View" href="/VirtualBox?action=print">
<link rel="Appendix" title="error-1909-VERR_VM_DRIVER_NOT_ACCESSIBLE.png" href="/VirtualBox?action=AttachFile&amp;do=view&amp;target=error-1909-VERR_VM_DRIVER_NOT_ACCESSIBLE.png">
<link rel="Appendix" title="logo.png" href="/VirtualBox?action=AttachFile&amp;do=view&amp;target=logo.png">
<link rel="Search" href="/FindPage">
<link rel="Index" href="/TitleIndex">
<link rel="Glossary" href="/WordIndex">
<link rel="Help" href="/HelpOnFormatting">
</head>

<body  lang="en" dir="ltr">

<div id="header">

<form id="searchform" method="get" action="">
<div>
<input type="hidden" name="action" value="fullsearch">
<input type="hidden" name="context" value="180">
<label for="searchinput">Search:</label>
<input id="searchinput" type="text" name="value" value="" size="20"
    onfocus="searchFocus(this)" onblur="searchBlur(this)"
    onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
<input id="titlesearch" name="titlesearch" type="submit"
    value="Titles" alt="Search Titles">
<input id="fullsearch" name="fullsearch" type="submit"
    value="Text" alt="Search Full Text">
</div>
</form>
<script type="text/javascript">
<!--// Initialize search form
var f = document.getElementById('searchform');
f.getElementsByTagName('label')[0].style.display = 'none';
var e = document.getElementById('searchinput');
searchChange(e);
searchBlur(e);
//-->
</script>

<div id="logo"><a href="/FrontPage">Debian Wiki</a></div>
<div id="locationline">


<ul id="pagelocation">
<li><a class="backlink" title="Click to do a full-text search for this title" href="/VirtualBox?action=fullsearch&amp;value=linkto%3A%22VirtualBox%22&amp;context=180">VirtualBox</a></li>
</ul>

</div>

</div>

<div id="sidebar">
<div class="sidepanel">
<h1>Wiki</h1>

<ul id="navibar">
<li class="wikilink"><a href="/FrontPage">FrontPage</a></li><li class="wikilink"><a href="/RecentChanges">RecentChanges</a></li><li class="wikilink"><a href="/FindPage">FindPage</a></li><li class="wikilink"><a href="/HelpContents">HelpContents</a></li><li class="current"><a href="/VirtualBox">VirtualBox</a></li>
</ul>

</div>
<div class="sidepanel">
<h1>Page</h1>
<ul class="editbar"><li><span class="disabled">Immutable Page</span></li><li><a href="/VirtualBox?action=info">Info</a></li><li><a href="/VirtualBox?action=AttachFile">Attachments</a></li><li>
<form class="actionsmenu" method="get" action="">
<div>
    <label>More Actions:</label>
    <select name="action"
        onchange="if ((this.selectedIndex != 0) &&
                      (this.options[this.selectedIndex].disabled == false)) {
                this.form.submit();
            }
            this.selectedIndex = 0;">
        <option value="raw">Raw Text</option>
<option value="print">Print View</option>
<option value="RenderAsDocbook">Render as Docbook</option>
<option value="refresh">Delete Cache</option>
<option value="show" disabled class="disabled">------------</option>
<option value="SpellCheck">Check Spelling</option>
<option value="LikePages">Like Pages</option>
<option value="LocalSiteMap">Local Site Map</option>
<option value="show" disabled class="disabled">------------</option>
<option value="RenamePage" disabled class="disabled">Rename Page</option>
<option value="DeletePage" disabled class="disabled">Delete Page</option>
<option value="show" disabled class="disabled">------------</option>
<option value="MyPages">My Pages</option>
<option value="SubscribeUser">Subscribe User</option>
<option value="show" disabled class="disabled">------------</option>
<option value="Despam">Remove Spam</option>
<option value="PackagePages">Package Pages</option>
    </select>
    <input type="submit" value="Do">
</div>
<script type="text/javascript">
<!--// Init menu
actionsMenuInit('More Actions:');
//-->
</script>
</form>
</li></ul>

</div>
<div class="sidepanel">
<h1>User</h1>
<ul id="username"><li><a href="/VirtualBox?action=login" id="login">Login</a></li></ul>
</div>
</div>

<div id="page" lang="en" dir="ltr">
<div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span>
<span class="anchor" id="line-2"></span><div><table style="width: 100%"><tbody><tr>  <td style="border: 0px hidden ;"><p class="line891"><small>Translation(s): <a href="/Spanish/VirtualBox">Español</a></small> </td>
  <td style="border: 0px hidden ;  text-align: right;"><p class="line862"> <img alt="(!)" height="15" src="/htdocs/rightsidebar/img/idea.png" title="(!)" width="15" /> <a class="nonexistent" href="/VirtualBox/Discussion">/Discussion</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-3"></span><p class="line867"><hr /><p class="line874"> <span class="anchor" id="line-4"></span><span class="anchor" id="line-5"></span><div><table style="width: 100%"><tbody><tr>  <td style="border: 0px hidden ;"><p class="line862"> <img src="/VirtualBox?action=AttachFile&amp;do=get&amp;target=logo.png" title="attachment:logo.png" /> </td>
  <td style="border: 0px hidden ;"><p class="line891">VirtualBox is an x86 emulator developed by <a class="http" href="http://www.virtualbox.org/wiki/innotek">innotek</a> <em>(bought by Sun)</em> comparable to <a class="nonexistent" href="/VMWare">VMWare</a>. It has a version called VirtualBox Open Source Edition (OSE) which is freely available as Open Source Software under the terms of the GNU General Public License (GPL).<br />
<br />
Its a relatively new program and still has some minor issues, but in general it is reliable, stable and, above all, very fast. It has been used successfully to do installation tests with Debian Installer.<br />
<br />
This page contains some how-to, tips and tricks that can be useful when setting up and using VirtualBox </td>
</tr>
</tbody></table></div><span class="anchor" id="line-6"></span><span class="anchor" id="line-7"></span><span class="anchor" id="line-8"></span><p class="line867"><span class="anchor" id="line-9"></span><ul><li style="list-style-type:none"><div class="table-of-contents"><p class="table-of-contents-heading">Contents<ol><li><a href="#head-2e316e5674d20c3b1cb2938e6a78983c8188e9b0">Installation</a></li><li><a href="#head-75ef23fc62a634cb6fc26329de9723cac3bda93e">Experience</a></li><li><a href="#head-7d4e76488d01c13abf8c2a7b9679320db8dc07e8">Errors</a></li><li><a href="#head-478541556b984173f1c6a6291711d2a8cc4532f3">Tips &amp; tricks</a></li><li><a href="#head-9dafea02d17272b5de1d9a1d15281d44c508605e">External Links</a></li></ol></div> <span class="anchor" id="line-10"></span></li></ul><p class="line867"><span class="anchor" id="install"></span> <span class="anchor" id="line-11"></span><span class="anchor" id="line-12"></span><p class="line867">
<h2 id="head-2e316e5674d20c3b1cb2938e6a78983c8188e9b0">Installation</h2>
<span class="anchor" id="line-13"></span><p class="line862">Currently <em>(2008/01/01)</em>, VirtualBox is not supported natively by <a href="/DebianEtch">DebianEtch</a>, the 4.0 version of Debian. To install it, you can use different methods: <span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span><ul><li><p class="line862">Using Debian/Etch's <a href="/Backports">Backports</a> repository <span class="anchor" id="line-16"></span></li><li><p class="line862">Using <a href="/DebianTesting">DebianTesting</a> repository <span class="anchor" id="line-17"></span></li></ul><p class="line867"><span class="anchor" id="install-backport"></span> <span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><p class="line867">
<h3 id="head-f280c164d73bd09301342a49b8e3e0b5e183a2f7">Debian/Etch-backports</h3>
<span class="anchor" id="line-20"></span><ul><li><p class="line862">Configure Debian/Etch <a href="/Backports">backports</a> <span class="anchor" id="line-21"></span></li><li><p class="line862">Install these packages: <a class="interwiki" href="http://packages.debian.org/virtualbox-ose" title="DebPkg">virtualbox-ose</a> <a class="interwiki" href="http://packages.debian.org/virtualbox-ose-source" title="DebPkg">virtualbox-ose-source</a> <a class="interwiki" href="http://packages.debian.org/linux-source" title="DebPkg">linux-source</a> <a class="interwiki" href="http://packages.debian.org/linux-headers" title="DebPkg">linux-headers</a> <span class="anchor" id="line-22"></span></li><li><p class="line862">Compile virtualbox kernel module <em>(as <a href="/root">root</a>)</em> <span class="anchor" id="line-23"></span></li></ul><p class="line867"><span class="anchor" id="line-24"></span><pre># cd /usr/src
<span class="anchor" id="line-25"></span># tar xvjf virtualbox-ose.tar.bz2
<span class="anchor" id="line-26"></span># cd modules/virtualbox-ose
<span class="anchor" id="line-27"></span># make
<span class="anchor" id="line-28"></span># make install
<span class="anchor" id="line-29"></span># modprobe vboxdrv
<span class="anchor" id="line-30"></span># lsmod | grep vbox
<span class="anchor" id="line-31"></span>vboxdrv                55344  0</pre><span class="anchor" id="line-32"></span><ul><li><p class="line862">Or simply use module-assistant <em>(as <a href="/root">root</a>)</em> <span class="anchor" id="line-33"></span></li></ul><p class="line867"><span class="anchor" id="line-34"></span><pre># module-assistant auto-install virtualbox-ose
<span class="anchor" id="line-35"></span># modprobe vboxdrv
<span class="anchor" id="line-36"></span># lsmod | grep vbox
<span class="anchor" id="line-37"></span>vboxdrv                55344  0
<span class="anchor" id="line-38"></span></pre><span class="anchor" id="line-39"></span><ul><li><p class="line862">Start VirtualBox: <span class="anchor" id="line-40"></span></li></ul><p class="line862">In KDE, go to menu KDE &gt; System &gt; VirtualBox OSE <span class="anchor" id="line-41"></span><span class="anchor" id="line-42"></span><ul><li style="list-style-type:none"><p class="line891"><em>or</em> <span class="anchor" id="line-43"></span></li></ul><p class="line862">In Gnome, goto menu Gnome &gt; Applications &gt; System tools &gt; VirtualBox OSE <span class="anchor" id="line-44"></span><span class="anchor" id="line-45"></span><p class="line867"><span class="anchor" id="install-testing"></span> <span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><p class="line867">
<h3 id="head-381d74a63252140dca3a479ab2be9ea9e51768e5">Debian/Testing (lenny)</h3>
<span class="anchor" id="line-48"></span><p class="line862">Testing repository contains some precompiled kernel module. So you don't need to compile it like previous method. Except that, it's the same mechanism. Be carreful, using testing repository could break your system. Note that virtualbox need to update <a class="interwiki" href="http://packages.debian.org/libc6" title="DebPkg">libc6</a> and <a class="interwiki" href="http://packages.debian.org/linux-image-2.6" title="DebPkg">linux-image-2.6</a> <span class="anchor" id="line-49"></span><span class="anchor" id="line-50"></span><p class="line867">
<h2 id="head-75ef23fc62a634cb6fc26329de9723cac3bda93e">Experience</h2>
<span class="anchor" id="line-51"></span><p class="line867"><small><strong><span class="u">Legend :</span></strong> </small> <span class="anchor" id="line-52"></span><span class="anchor" id="line-53"></span><ul><li><p class="line891"><small><img alt="{OK}" height="12" src="/htdocs/rightsidebar/img/thumbs-up.png" title="{OK}" width="14" /> = OK </small> <span class="anchor" id="line-54"></span></li><li><p class="line891"><img alt="/!\" height="15" src="/htdocs/rightsidebar/img/alert.png" title="/!\" width="15" /> = Failed <span class="anchor" id="line-55"></span></li></ul><div><table><tbody><tr>  <td><p class="line891"><strong>Who</strong> </td>
  <td><p class="line891"><strong>Kernel</strong> </td>
  <td><p class="line891"><strong>Disribution</strong> </td>
  <td><p class="line891"><strong>Package Version</strong> </td>
  <td><p class="line891"><strong>Status</strong> </td>
</tr>
<tr>  <td><span class="anchor" id="line-56"></span><p class="line862"> -- <a href="/SalokineTerata">SalokineTerata</a> 2008-01-01 19:52:09 </td>
  <td><p class="line862"> 2.6.22-6~bpo40+1 </td>
  <td><p class="line862"> Debian/Etch-backports </td>
  <td><p class="line862"> 1.5.2-dfsg2-4~bpo40+1 </td>
  <td><p class="line862"> <img alt="{OK}" height="12" src="/htdocs/rightsidebar/img/thumbs-up.png" title="{OK}" width="14" /> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-57"></span><p class="line867">
<h2 id="head-7d4e76488d01c13abf8c2a7b9679320db8dc07e8">Errors</h2>
<span class="anchor" id="line-58"></span><p class="line867">
<h3 id="head-839c5976dc6419b8d47b83547f4d0c379d9a7d71">32-bit userland with x64_64 kernel</h3>
<span class="anchor" id="line-59"></span><p class="line862">It is know bug that VirtualBox does not work in such scenarios: <a class="http" href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=456391">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=456391</a> <span class="anchor" id="line-60"></span><span class="anchor" id="line-61"></span><p class="line862">However VirtualBox version 2.0 promises support for this, but it is not yet packaged in Debian. <span class="anchor" id="line-62"></span><span class="anchor" id="line-63"></span><p class="line867">
<h3 id="head-cca23c12225b5e5380c0b1b0a7eb970a33366309">-1909 VERR VM DRIVER NOT ACCESSIBLE</h3>
<span class="anchor" id="line-64"></span><p class="line867"><img src="/VirtualBox?action=AttachFile&amp;do=get&amp;target=error-1909-VERR_VM_DRIVER_NOT_ACCESSIBLE.png" title="attachment:error-1909-VERR_VM_DRIVER_NOT_ACCESSIBLE.png" /> <span class="anchor" id="line-65"></span><span class="anchor" id="line-66"></span><p class="line867"><span class="u">Solution: </span> Add your current user in the group <strong>vboxusers</strong>. <span class="anchor" id="line-67"></span><span class="anchor" id="line-68"></span><ul><li>Under KDE: <span class="anchor" id="line-69"></span><ul><li><p class="line891"><tt>K&nbsp;&gt;&nbsp;Configuration&nbsp;Center&nbsp;&gt;&nbsp;System&nbsp;Administration&nbsp;&gt;&nbsp;User&nbsp;Management</tt> <span class="anchor" id="line-70"></span></li><li>Select your user and edit it <span class="anchor" id="line-71"></span></li><li><p class="line862">Go to <strong>Groups</strong> page <span class="anchor" id="line-72"></span></li><li><p class="line862">Select <strong>vboxusers</strong> group and validate <span class="anchor" id="line-73"></span></li></ul></li><li>Reconnect your session <span class="anchor" id="line-74"></span></li><li>Under GNOME: <span class="anchor" id="line-75"></span><ul><li><p class="line862">System &gt; Administration &gt; Users and Groups <span class="anchor" id="line-76"></span></li><li><p class="line862">Click on "<strong>Manage groups</strong>" <span class="anchor" id="line-77"></span></li><li><p class="line862">Select the <strong>vboxusers</strong> group and click "<strong>Properties</strong>" <span class="anchor" id="line-78"></span></li><li>Check your username in the list and click "Ok" <span class="anchor" id="line-79"></span></li><li>Logout and login again <span class="anchor" id="line-80"></span></li></ul></li><li>On the commandline <span class="anchor" id="line-81"></span><ul><li><p class="line862">l<strong>og as user root </strong>either by su or sudo (su [return] - &lt;give root password&gt; [return] OR sudo su [return]) <span class="anchor" id="line-82"></span></li><li><p class="line862">Use the following command: <strong>adduser &lt;youruser&gt; vboxusers</strong> <span class="anchor" id="line-83"></span></li><li>Logout and login again <span class="anchor" id="line-84"></span></li></ul></li></ul><p class="line874">You can verify if your are really member of this group with this command line: <span class="anchor" id="line-85"></span><span class="anchor" id="line-86"></span><p class="line867"><span class="anchor" id="line-87"></span><pre># id MY_USER
<span class="anchor" id="line-88"></span>uid=1000(MY_USER) gid=1000(MY_USER) groupes=1000(MY_USER),8(mail),...127(vboxusers)
<span class="anchor" id="line-89"></span></pre><span class="anchor" id="line-90"></span><p class="line867"><span class="anchor" id="tips"></span> <span class="anchor" id="line-91"></span><span class="anchor" id="line-92"></span><p class="line867">
<h2 id="head-478541556b984173f1c6a6291711d2a8cc4532f3">Tips &amp; tricks</h2>
<span class="anchor" id="line-93"></span><p class="line867">
<h3 id="head-2f3b70cb6bcaf82ecb9c8c1f3d5f42134006dc40">Switching consoles</h3>
<span class="anchor" id="line-94"></span><p class="line862">The normal way to switch consoles in Linux is to use the <tt>ctrl-alt-Fx</tt> key combination. This does not work for a VirtualBox virtual machine (VM); it will switch consoles for the host system instead. <span class="anchor" id="line-95"></span><span class="anchor" id="line-96"></span><p class="line862">You should use <tt>&lt;Host&nbsp;Key&gt;-Fx</tt> instead, where <tt>&lt;Host&nbsp;Key&gt;</tt> is the key defined in <tt>File-&gt;Preferences-&gt;Input</tt>. <span class="anchor" id="line-97"></span><span class="anchor" id="line-98"></span><p class="line862">This also works for <tt>ctrl-alt-del</tt> and <tt>ctrl-alt-backspace</tt> <span class="anchor" id="line-99"></span><span class="anchor" id="line-100"></span><p class="line862">This is documented in the <a class="http" href="http://www.virtualbox.org/download/UserManual.pdf">VirtualBox user manual</a> in the section "Keyboard and mouse support in virtual machines", subsection "Typing special characters". <span class="anchor" id="line-101"></span><span class="anchor" id="line-102"></span><p class="line862">(An alternative method to switch between text consoles is to use <tt>alt-left</tt> and <tt>alt-right</tt>, but that does not work for graphical consoles like XOrg or DirectFB.) <span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><p class="line867">
<h3 id="head-e56da2b7537c9c6463e86cf2e7ff50d0af51cc62">Setting up bridged networking for VirtualBox (VirtualBox &lt; 2.1.0)</h3>
<span class="anchor" id="line-105"></span><p class="line862">By default VirtualBox uses NAT for the network interfaces of virtual machines and use an internal DHCP server to obtain an IP address. This works well but the disadvantage is that the machine will not have an IP address visible outside the VM and so you cannot connect to it from the host system or from other systems. <span class="anchor" id="line-106"></span><span class="anchor" id="line-107"></span><p class="line874">By attaching the VM's interface to "Host Interface" and creating a bridge on the host system, the VM can be made visible on the local network. This also allows to do fun stuff like netbooting the VM (boot from LAN using PXE). It is comparable to the "bridged networking" option in VMWare. <span class="anchor" id="line-108"></span><span class="anchor" id="line-109"></span><p class="line867"><strong>NB</strong> To use a wireless host device you need one that has support for Master mode (eg. it can be used as an access point, afaik only the Atheros and Prism drivers has this support) <span class="anchor" id="line-110"></span><span class="anchor" id="line-111"></span><p class="line867">
<h4 id="head-ac96d1959e6023cb07c51bdedd7e8f0b376dc944">Preparation</h4>
<span class="anchor" id="line-112"></span><p class="line862">First install the package <tt>bridge-utils</tt>. <span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span><p class="line874">Next, change the network configuration of the host system so that the network interface becomes part of a bridge. Note that this requires restarting the network, so be careful when doing this on a remote system! <span class="anchor" id="line-115"></span><span class="anchor" id="line-116"></span><p class="line862">Change the file <tt>/etc/network/interfaces</tt> to look something like this: <span class="anchor" id="line-117"></span><span class="anchor" id="line-118"></span><p class="line867"><span class="anchor" id="line-119"></span><pre># The loopback network interface
<span class="anchor" id="line-120"></span>auto lo
<span class="anchor" id="line-121"></span>iface lo inet loopback
<span class="anchor" id="line-122"></span># An entry for eth0 is no longer needed
<span class="anchor" id="line-123"></span>#auto eth0
<span class="anchor" id="line-124"></span>#iface eth0 inet dhcp
<span class="anchor" id="line-125"></span># Create the bridge (with the regular IP address of the host)
<span class="anchor" id="line-126"></span>auto br0
<span class="anchor" id="line-127"></span>iface br0 inet dhcp
<span class="anchor" id="line-128"></span>        bridge_ports eth0
<span class="anchor" id="line-129"></span>        bridge_fd 2.5
<span class="anchor" id="line-130"></span></pre><span class="anchor" id="line-131"></span><p class="line862">In this example the bridge gets its IP address and configuration from DHCP. For static configuration see<br />
<tt>/usr/share/doc/bridge-utils/README.Debian.gz</tt> <span class="anchor" id="line-132"></span><span class="anchor" id="line-133"></span><p class="line862">If you don't find the information for static configuration there, try:<br />
 <span class="anchor" id="line-134"></span><span class="anchor" id="line-135"></span><p class="line867"><span class="anchor" id="line-136"></span><pre># man bridge-utils-interfaces</pre><span class="anchor" id="line-137"></span><p class="line874">Restart the networking of the host system using: <span class="anchor" id="line-138"></span><span class="anchor" id="line-139"></span><p class="line867"><span class="anchor" id="line-140"></span><pre># /etc/init.d/networking restart</pre><span class="anchor" id="line-141"></span><p class="line862">After this <tt>brctl&nbsp;show</tt> should show the bridge and <tt>ifconfig</tt> should show the bridge has the host's IP address. <span class="anchor" id="line-142"></span><span class="anchor" id="line-143"></span><p class="line862">It is also necessary for your user to own the device <tt>/dev/net/tun&nbsp;</tt> <span class="anchor" id="line-144"></span><span class="anchor" id="line-145"></span><p class="line874">Run the following command to change the owner of that device: <span class="anchor" id="line-146"></span><span class="anchor" id="line-147"></span><p class="line867"><span class="anchor" id="line-148"></span><pre># chown &lt;username&gt; /dev/net/tun</pre><span class="anchor" id="line-149"></span><p class="line867">
<h4 id="head-2533838514373893e1ca2cac71c13586bf086700">Configuring the VirtualBox VM</h4>
<span class="anchor" id="line-150"></span><p class="line874">There are different ways the TAP interface for the VM can be created: <span class="anchor" id="line-151"></span><span class="anchor" id="line-152"></span><ul><li><p class="line862">statically (before VirtualBox is even started) <span class="anchor" id="line-153"></span></li><li>on demand (when a VM is being started) <span class="anchor" id="line-154"></span></li></ul><p class="line862">See also the chapter on "Virtual networking" in the <a class="http" href="http://www.virtualbox.org/download/UserManual.pdf">VirtualBox user manual</a>. <span class="anchor" id="line-155"></span><span class="anchor" id="line-156"></span><p class="line867">
<h5 id="head-45ffe54e63a513dbeb24a9be06d2a4eb2ec16928">Static interfaces</h5>
<span class="anchor" id="line-157"></span><p class="line862">In this case you only need to "define" an interface for use by a particular user once. All defined interfaces are "remembered" in the file <tt>/etc/vbox/interfaces</tt> and recreated by the VirtualBox init script every time the host system is booted. <span class="anchor" id="line-158"></span><span class="anchor" id="line-159"></span><p class="line874">Example to create an interface for a user: <span class="anchor" id="line-160"></span><span class="anchor" id="line-161"></span><p class="line867"><span class="anchor" id="line-162"></span><pre># VBoxAddIF vbox0 &lt;username&gt; br0
<span class="anchor" id="line-163"></span></pre><span class="anchor" id="line-164"></span><p class="line874">You can of course create multiple interfaces per users, but all interfaces should have unique names. <span class="anchor" id="line-165"></span><span class="anchor" id="line-166"></span><p class="line874">To configure the VM to use static bridged networking, go to the "network" page of the VM's settings and change the following fields: <span class="anchor" id="line-167"></span><span class="anchor" id="line-168"></span><ul><li><p class="line862">Attached to: <tt>Host&nbsp;Interface</tt> <span class="anchor" id="line-169"></span></li><li><p class="line862">Interface Name: <tt>vbox0</tt> <span class="anchor" id="line-170"></span></li><li><p class="line862">Setup Application: &lt;empty&gt; <span class="anchor" id="line-171"></span></li><li><p class="line862">Terminate Application: &lt;empty&gt; <span class="anchor" id="line-172"></span></li></ul><p class="line867">
<h5 id="head-1330d340c9d435c41fbd1c04c3d29d61e0a8f195">Dynamic interfaces (on demand)</h5>
<span class="anchor" id="line-173"></span><p class="line874">The example below shows the second method. This example will allow you to use multiple VM's, but the script assumes that each interface will be named in the form "vbox*". You may need to adapt the script to match your needs.  Note that the script assumes you can execute the needed commands using sudo.  A snippet of a sudoers file is included below as an example. <span class="anchor" id="line-174"></span><span class="anchor" id="line-175"></span><p class="line867"><span class="anchor" id="line-176"></span><pre>#!/bin/sh
<span class="anchor" id="line-177"></span>set -e
<span class="anchor" id="line-178"></span>BRIDGE="br0"
<span class="anchor" id="line-179"></span>case "${1}" in
<span class="anchor" id="line-180"></span>        "up" )
<span class="anchor" id="line-181"></span>                # Get the last vbox interface that was created or "" if none
<span class="anchor" id="line-182"></span>                TAP=$(cat /proc/net/dev | grep vbox | tail -n 1 | cut -d":" -f1 | sed 's/\s*vbox\(\.*\)/\1/')
<span class="anchor" id="line-183"></span>                # If there was no previous interface then set to -1 (this is so the += works)
<span class="anchor" id="line-184"></span>                [ "${TAP}" = "" ] &amp;&amp; TAP=-1
<span class="anchor" id="line-185"></span>                # Increment TAP
<span class="anchor" id="line-186"></span>                let "TAP+=1"
<span class="anchor" id="line-187"></span>                # prepend vbox onto the TAP no
<span class="anchor" id="line-188"></span>                TAP="vbox${TAP}"
<span class="anchor" id="line-189"></span>                # Create the new TAP device
<span class="anchor" id="line-190"></span>                sudo VBoxTunctl -b -u $(whoami) -t ${TAP}
<span class="anchor" id="line-191"></span>                # Bring up the TAP (without an ip)
<span class="anchor" id="line-192"></span>                sudo ifconfig ${TAP} up
<span class="anchor" id="line-193"></span>                # Add the TAP to the Bridge
<span class="anchor" id="line-194"></span>                sudo brctl addif ${BRIDGE} ${TAP}
<span class="anchor" id="line-195"></span>                # Echo the name of the TAP so VirtualBox knows which one to use
<span class="anchor" id="line-196"></span>                # on lenny the echo must be commented for virtuabox to work correctly
<span class="anchor" id="line-197"></span>                echo ${TAP}
<span class="anchor" id="line-198"></span>                ;;
<span class="anchor" id="line-199"></span>        "down" )
<span class="anchor" id="line-200"></span>                # VirtualBox tells us which TAP it used
<span class="anchor" id="line-201"></span>                TAP=${3}
<span class="anchor" id="line-202"></span>                # Bring the TAP down
<span class="anchor" id="line-203"></span>                sudo ifconfig ${TAP} down
<span class="anchor" id="line-204"></span>                # Remove the TAP
<span class="anchor" id="line-205"></span>                sudo VBoxTunctl -d ${TAP} &gt; /dev/null 2&gt;&amp;1
<span class="anchor" id="line-206"></span>                ;;
<span class="anchor" id="line-207"></span>esac
<span class="anchor" id="line-208"></span></pre><span class="anchor" id="line-209"></span><p class="line862">Save the script, for example as <tt>~/.VirtualBox/bridge_setup</tt>. The script can be tested by running it from the command line. If successful, <tt>brctl&nbsp;show</tt> should show interface <tt>vbox*</tt> (where * will be a number) added to the bridge. <span class="anchor" id="line-210"></span><span class="anchor" id="line-211"></span><p class="line874">Here is a snippet of a sudoers file to help (replace username and hostname with the appropriate values): <span class="anchor" id="line-212"></span><span class="anchor" id="line-213"></span><p class="line867"><span class="anchor" id="line-214"></span><pre>Cmnd_Alias      VIRTUALBOX = /usr/bin/VBoxTunctl, /sbin/ifconfig vbox* up, /sbin/ifconfig vbox* down, /usr/sbin/brctl addif br0 vbox*
<span class="anchor" id="line-215"></span>username     ALL=(ALL) PASSWD: ALL
<span class="anchor" id="line-216"></span>username     hostname = NOPASSWD: VIRTUALBOX
<span class="anchor" id="line-217"></span></pre><span class="anchor" id="line-218"></span><p class="line874">To configure the VM to use dynamic bridged networking, go to the "network" page of the VM's settings and change the following fields: <span class="anchor" id="line-219"></span><span class="anchor" id="line-220"></span><ul><li><p class="line862">Attached to: <tt>Host&nbsp;Interface</tt> <span class="anchor" id="line-221"></span></li><li><p class="line862">Interface Name: &lt;empty&gt; <span class="anchor" id="line-222"></span></li><li><p class="line862">Setup Application: <tt>~/.VirtualBox/bridge_setup&nbsp;up</tt> <span class="anchor" id="line-223"></span></li><li><p class="line862">Terminate Application: <tt>~/.VirtualBox/bridge_setup&nbsp;down</tt> <span class="anchor" id="line-224"></span></li></ul><p class="line874">When the VM is started after that, the interface should be created automatically and the VM can be used just like it was a system connected directly to your local network. <span class="anchor" id="line-225"></span><span class="anchor" id="line-226"></span><p class="line867">
<h3 id="head-7878d5314e89905ec3053a9add70589cc016297c">How to remotely start virtual machines using vnc</h3>
<span class="anchor" id="line-227"></span><p class="line874">Remote: <span class="anchor" id="line-228"></span><span class="anchor" id="line-229"></span><ul><li>log onto your remote box <span class="anchor" id="line-230"></span></li><li>install tightvncserver <span class="anchor" id="line-231"></span></li><li>launch it (you don't need a display), pick a password <span class="anchor" id="line-232"></span></li><li>determine which port it is using, a way to do so: <span class="anchor" id="line-233"></span><ul><li>netstat -tap | grep vnc <span class="anchor" id="line-234"></span></li><li>Let's say it's 5901 <span class="anchor" id="line-235"></span></li></ul></li><li>unlog from there since the server forked in the background <span class="anchor" id="line-236"></span></li></ul><p class="line874">Local: <span class="anchor" id="line-237"></span><span class="anchor" id="line-238"></span><ul><li>install xtightvncviewer <span class="anchor" id="line-239"></span></li><li>create a ssh tunnel to your box: <span class="anchor" id="line-240"></span><ul><li>ssh -L 5901:localhost:5901 you@remote <span class="anchor" id="line-241"></span></li></ul></li><li>use it: (note there are two colons) <span class="anchor" id="line-242"></span><ul><li>xtightvncviewer localhost::5901 <span class="anchor" id="line-243"></span></li></ul></li><li><p class="line862">then VBoxManage startvm $yourvm &amp; <span class="anchor" id="line-244"></span></li><li>and start as many virtual machines as wanted. <span class="anchor" id="line-245"></span></li></ul><p class="line867">
<h2 id="head-9dafea02d17272b5de1d9a1d15281d44c508605e">External Links</h2>
<span class="anchor" id="line-246"></span><ul><li><p class="line891"><a class="http" href="http://www.virtualbox.org/download/UserManual.pdf">http://www.virtualbox.org/download/UserManual.pdf</a> Official User Manual <span class="anchor" id="line-247"></span></li><li><p class="line862">Alternative <a href="/SystemVirtualization">SystemVirtualization</a> tools. <span class="anchor" id="line-248"></span></li></ul><span class="anchor" id="bottom"></span></div><p id="pageinfo" class="info" lang="en" dir="ltr">VirtualBox  (last edited 2008-12-29 13:24:45 by <span title="MichaelMeskes @ exit.credativ.com[87.139.82.80]"><a class="nonexistent" href="/MichaelMeskes" title="MichaelMeskes @ exit.credativ.com[87.139.82.80]">MichaelMeskes</a></span>)</p>

<div id="pagebottom"></div>
</div>


<div id="footer">
<ul id="credits">
<li><a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><a href="http://www.python.org/">Python Powered</a></li><li><a href="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>
</ul>


</div>
</body>
</html>