VirtualBox

source: vbox/trunk/doc/manual/en_US/user_Networking.xml@ 39484

Last change on this file since 39484 was 39484, checked in by vboxsync, 13 years ago

Manual/NetFlt: document VLAN trunking limitation (#4806)

File size: 36.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4<chapter id="networkingdetails">
5 <title>Virtual networking</title>
6
7 <para>As briefly mentioned in <xref linkend="settings-network" />,
8 VirtualBox provides up to eight virtual PCI Ethernet cards for each virtual
9 machine. For each such card, you can individually select<orderedlist>
10 <listitem>
11 <para>the hardware that will be virtualized as well as</para>
12 </listitem>
13
14 <listitem>
15 <para>the virtualization mode that the virtual card will be operating
16 in with respect to your physical networking hardware on the
17 host.</para>
18 </listitem>
19 </orderedlist></para>
20
21 <para>Four of the network cards can be configured in the "Network" section
22 of the settings dialog in the graphical user interface of VirtualBox. You
23 can configure all eight network cards on the command line via VBoxManage
24 modifyvm; see <xref linkend="vboxmanage-modifyvm" />.</para>
25
26 <para>This chapter explains the various networking settings in more
27 detail.</para>
28
29 <sect1 id="nichardware">
30 <title>Virtual networking hardware</title>
31
32 <para>For each card, you can individually select what kind of
33 <emphasis>hardware</emphasis> will be presented to the virtual machine.
34 VirtualBox can virtualize the following six types of networking
35 hardware:<itemizedlist>
36 <listitem>
37 <para>AMD PCNet PCI II (Am79C970A);</para>
38 </listitem>
39
40 <listitem>
41 <para>AMD PCNet FAST III (Am79C973, the default);</para>
42 </listitem>
43
44 <listitem>
45 <para>Intel PRO/1000 MT Desktop (82540EM);</para>
46 </listitem>
47
48 <listitem>
49 <para>Intel PRO/1000 T Server (82543GC);</para>
50 </listitem>
51
52 <listitem>
53 <para>Intel PRO/1000 MT Server (82545EM);</para>
54 </listitem>
55
56 <listitem>
57 <para>Paravirtualized network adapter (virtio-net).</para>
58 </listitem>
59 </itemizedlist></para>
60
61 <para>The PCNet FAST III is the default because it is supported by nearly
62 all operating systems out of the box, as well as the GNU GRUB boot
63 manager. As an exception, the Intel PRO/1000 family adapters are chosen
64 for some guest operating system types that no longer ship with drivers for
65 the PCNet card, such as Windows Vista.</para>
66
67 <para>The Intel PRO/1000 MT Desktop type works with Windows Vista and later
68 versions. The T Server variant of the Intel PRO/1000 card is recognized by
69 Windows XP guests without additional driver installation. The MT Server
70 variant facilitates OVF imports from other platforms.</para>
71
72 <para>The <emphasis role="bold">"Paravirtualized network adapter
73 (virtio-net)"</emphasis> is special. If you select this, then VirtualBox
74 does <emphasis>not</emphasis> virtualize common networking hardware (that
75 is supported by common guest operating systems out of the box). Instead,
76 VirtualBox then expects a special software interface for virtualized
77 environments to be provided by the guest, thus avoiding the complexity of
78 emulating networking hardware and improving network performance. Starting
79 with version 3.1, VirtualBox provides support for the industry-standard
80 "virtio" networking drivers, which are part of the open-source KVM
81 project.</para>
82
83 <para>The "virtio" networking drivers are available for the following
84 guest operating systems:</para>
85
86 <para><itemizedlist>
87 <listitem>
88 <para>Linux kernels version 2.6.25 or later can be configured to
89 provide virtio support; some distributions also back-ported virtio
90 to older kernels.</para>
91 </listitem>
92
93 <listitem>
94 <para>For Windows 2000, XP and Vista, virtio drivers can be
95 downloaded and installed from the KVM project web page.<footnote>
96 <para><ulink
97 url="http://www.linux-kvm.org/page/WindowsGuestDrivers">http://www.linux-kvm.org/page/WindowsGuestDrivers</ulink>.</para>
98 </footnote></para>
99 </listitem>
100 </itemizedlist></para>
101
102 <para>VirtualBox also has limited support for so-called <emphasis
103 role="bold">jumbo frames</emphasis>, i.e. networking packets with more
104 than 1500 bytes of data, provided that you use the Intel card
105 virtualization and bridged networking. In other words, jumbo frames are
106 not supported with the AMD networking devices; in those cases, jumbo
107 packets will silently be dropped for both the transmit and the receive
108 direction. Guest operating systems trying to use this feature will observe
109 this as a packet loss, which may lead to unexpected application behavior
110 in the guest. This does not cause problems with guest operating systems in
111 their default configuration, as jumbo frames need to be explicitly
112 enabled.</para>
113 </sect1>
114
115 <sect1 id="networkingmodes">
116 <title>Introduction to networking modes</title>
117
118 <para>Each of the eight networking adapters can be separately configured
119 to operate in one of the following modes:<glosslist>
120 <glossentry>
121 <glossterm>Not attached</glossterm>
122
123 <glossdef>
124 <para>In this mode, VirtualBox reports to the guest that a network
125 card is present, but that there is no connection -- as if no
126 Ethernet cable was plugged into the card. This way it is possible
127 to "pull" the virtual Ethernet cable and disrupt the connection,
128 which can be useful to inform a guest operating system that no
129 network connection is available and enforce a
130 reconfiguration.</para>
131 </glossdef>
132 </glossentry>
133
134 <glossentry>
135 <glossterm>Network Address Translation (NAT)</glossterm>
136
137 <glossdef>
138 <para>If all you want is to browse the Web, download files and
139 view e-mail inside the guest, then this default mode should be
140 sufficient for you, and you can safely skip the rest of this
141 section. Please note that there are certain limitations when using
142 Windows file sharing (see <xref linkend="nat-limitations" /> for
143 details).</para>
144 </glossdef>
145 </glossentry>
146
147 <glossentry>
148 <glossterm>Bridged networking</glossterm>
149
150 <glossdef>
151 <para>This is for more advanced networking needs such as network
152 simulations and running servers in a guest. When enabled,
153 VirtualBox connects to one of your installed network cards and
154 exchanges network packets directly, circumventing your host
155 operating system's network stack.</para>
156 </glossdef>
157 </glossentry>
158
159 <glossentry>
160 <glossterm>Internal networking</glossterm>
161
162 <glossdef>
163 <para>This can be used to create a different kind of
164 software-based network which is visible to selected virtual
165 machines, but not to applications running on the host or to the
166 outside world.</para>
167 </glossdef>
168 </glossentry>
169
170 <glossentry>
171 <glossterm>Host-only networking</glossterm>
172
173 <glossdef>
174 <para>This can be used to create a network containing the host and
175 a set of virtual machines, without the need for the host's
176 physical network interface. Instead, a virtual network interface
177 (similar to a loopback interface) is created on the host,
178 providing connectivity among virtual machines and the host.</para>
179 </glossdef>
180 </glossentry>
181
182 <glossentry>
183 <glossterm>Generic networking</glossterm>
184
185 <glossdef>
186 <para>Rarely used modes share the same generic network
187 interface, by allowing the user to select a driver which can
188 be included with VirtualBox or be distributed in an extension
189 pack.</para>
190 <para>At the moment there are potentially two available
191 sub-modes:</para>
192 <para>
193 <glosslist>
194 <glossentry>
195 <glossterm>UDP Tunnel</glossterm>
196 <glossdef>
197 <para>This can be used to interconnect virtual machines running on
198 different hosts directly, easily and transparently, over existing
199 network infrastructure.</para>
200 </glossdef>
201 </glossentry>
202 <glossentry>
203 <glossterm>VDE (Virtual Distributed Ethernet) networking</glossterm>
204 <glossdef>
205 <para>This option can be used to connect to a Virtual Distributed
206 Ethernet switch on a Linux or a FreeBSD host. At the moment this
207 needs compiling VirtualBox from sources, as the Oracle packages
208 do not include it.</para>
209 </glossdef>
210 </glossentry>
211 </glosslist>
212 </para>
213 </glossdef>
214 </glossentry>
215 </glosslist></para>
216
217 <para>The following sections describe the available network modes in more
218 detail.</para>
219 </sect1>
220
221 <sect1 id="network_nat">
222 <title>Network Address Translation (NAT)</title>
223
224 <para>Network Address Translation (NAT) is the simplest way of accessing
225 an external network from a virtual machine. Usually, it does not require
226 any configuration on the host network and guest system. For this reason,
227 it is the default networking mode in VirtualBox.</para>
228
229 <para>A virtual machine with NAT enabled acts much like a real computer
230 that connects to the Internet through a router. The "router", in this
231 case, is the VirtualBox networking engine, which maps traffic from and to
232 the virtual machine transparently. In VirtualBox this router is placed
233 between each virtual machine and the host. This separation maximizes
234 security since by default virtual machines cannot talk to each other.</para>
235
236 <para>The disadvantage of NAT mode is that, much like a private network
237 behind a router, the virtual machine is invisible and unreachable from the
238 outside internet; you cannot run a server this way unless you set up port
239 forwarding (described below).</para>
240
241 <para>The network frames sent out by the guest operating system are
242 received by VirtualBox's NAT engine, which extracts the TCP/IP data and
243 resends it using the host operating system. To an application on the host,
244 or to another computer on the same network as the host, it looks like the
245 data was sent by the VirtualBox application on the host, using an IP
246 address belonging to the host. VirtualBox listens for replies to the
247 packages sent, and repacks and resends them to the guest machine on its
248 private network.</para>
249
250 <para>The virtual machine receives its network address and configuration
251 on the private network from a DHCP server integrated into VirtualBox. The
252 IP address thus assigned to the virtual machine is usually on a completely
253 different network than the host. As more than one card of a virtual
254 machine can be set up to use NAT, the first card is connected to the
255 private network 10.0.2.0, the second card to the network 10.0.3.0 and so
256 on. If you need to change the guest-assigned IP range for some reason,
257 please refer to <xref linkend="changenat" />.</para>
258
259 <sect2 id="natforward">
260 <title>Configuring port forwarding with NAT</title>
261
262 <para>As the virtual machine is connected to a private network internal
263 to VirtualBox and invisible to the host, network services on the guest
264 are not accessible to the host machine or to other computers on the same
265 network. However, like a physical router, VirtualBox can make selected
266 services available to the world outside the guest through <emphasis
267 role="bold">port forwarding.</emphasis> This means that VirtualBox
268 listens to certain ports on the host and resends all packets which
269 arrive there to the guest, on the same or a different port.</para>
270
271 <para>To an application on the host or other physical (or virtual)
272 machines on the network, it looks as though the service being proxied is
273 actually running on the host. This also means that you cannot run the
274 same service on the same ports on the host. However, you still gain the
275 advantages of running the service in a virtual machine -- for example,
276 services on the host machine or on other virtual machines cannot be
277 compromised or crashed by a vulnerability or a bug in the service, and
278 the service can run in a different operating system than the host
279 system.</para>
280
281 <para>You can set up a guest service which you wish to proxy using the
282 command line tool <computeroutput>VBoxManage</computeroutput>; for
283 details, please refer to <xref linkend="vboxmanage-modifyvm" />.</para>
284
285 <para>You will need to know which ports on the guest the service uses
286 and to decide which ports to use on the host (often but not always you
287 will want to use the same ports on the guest and on the host). You can
288 use any ports on the host which are not already in use by a service. For
289 example, to set up incoming NAT connections to an
290 <computeroutput>ssh</computeroutput> server in the guest, use the
291 following command: <screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"</screen>With
292 the above example, all TCP traffic arriving on port 2222 on any host
293 interface will be forwarded to port 22 in the guest. The protocol name
294 <computeroutput>tcp</computeroutput> is a mandatory attribute defining
295 which protocol should be used for forwarding
296 (<computeroutput>udp</computeroutput> could also be used). The name
297 <computeroutput>guestssh</computeroutput> is purely descriptive and will
298 be auto-generated if omitted. The number after
299 <computeroutput>--natpf</computeroutput> denotes the network card, like
300 in other parts of VBoxManage.</para>
301
302 <para>To remove this forwarding rule again, use the following command:
303 <screen>VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"</screen></para>
304
305 <para>If for some reason the guest uses a static assigned IP address not
306 leased from the built-in DHCP server, it is required to specify the
307 guest IP when registering the forwarding rule: <screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.19,22"</screen>This
308 example is identical to the previous one, except that the NAT engine is
309 being told that the guest can be found at the 10.0.2.19 address.</para>
310
311 <para>To forward <emphasis>all</emphasis> incoming traffic from a
312 specific host interface to the guest, specify the IP of that host
313 interface like this:<screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"</screen>This
314 forwards all TCP traffic arriving on the localhost interface (127.0.0.1)
315 via port 2222 to port 22 in the guest.</para>
316
317 <para>It is not possible to configure incoming NAT connections while the
318 VM is running. However, you can change the settings for a VM which is
319 currently saved (or powered off at a snapshot).</para>
320 </sect2>
321
322 <sect2 id="nat-tftp">
323 <title>PXE booting with NAT</title>
324
325 <para>PXE booting is now supported in NAT mode. The NAT DHCP server
326 provides a boot file name of the form
327 <computeroutput>vmname.pxe</computeroutput> if the directory
328 <computeroutput>TFTP</computeroutput> exists in the directory where the
329 user's <computeroutput>VirtualBox.xml</computeroutput> file is kept. It
330 is the responsibility of the user to provide
331 <computeroutput>vmname.pxe</computeroutput>.</para>
332 </sect2>
333
334 <sect2 id="nat-limitations">
335 <title>NAT limitations</title>
336
337 <para>There are four <emphasis role="bold">limitations</emphasis> of NAT
338 mode which users should be aware of:</para>
339
340 <glosslist>
341 <glossentry>
342 <glossterm>ICMP protocol limitations:</glossterm>
343
344 <glossdef>
345 <para>Some frequently used network debugging tools (e.g.
346 <computeroutput>ping</computeroutput> or tracerouting) rely on the
347 ICMP protocol for sending/receiving messages. While ICMP support
348 has been improved with VirtualBox 2.1
349 (<computeroutput>ping</computeroutput> should now work), some
350 other tools may not work reliably.</para>
351 </glossdef>
352 </glossentry>
353
354 <glossentry>
355 <glossterm>Receiving of UDP broadcasts is not reliable:</glossterm>
356
357 <glossdef>
358 <para>The guest does not reliably receive broadcasts, since, in
359 order to save resources, it only listens for a certain amount of
360 time after the guest has sent UDP data on a particular port. As a
361 consequence, NetBios name resolution based on broadcasts does not
362 always work (but WINS always works). As a workaround, you can use
363 the numeric IP of the desired server in the
364 <computeroutput>\\server\share</computeroutput> notation.</para>
365 </glossdef>
366 </glossentry>
367
368 <glossentry>
369 <glossterm>Protocols such as GRE are unsupported:</glossterm>
370
371 <glossdef>
372 <para>Protocols other than TCP and UDP are not supported. This
373 means some VPN products (e.g. PPTP from Microsoft) cannot be used.
374 There are other VPN products which use simply TCP and UDP.</para>
375 </glossdef>
376 </glossentry>
377
378 <glossentry>
379 <glossterm>Forwarding host ports &lt; 1024 impossible:</glossterm>
380
381 <glossdef>
382 <para>On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is
383 not possible to bind to ports below 1024 from applications that
384 are not run by <computeroutput>root</computeroutput>. As a result,
385 if you try to configure such a port forwarding, the VM will refuse
386 to start.</para>
387 </glossdef>
388 </glossentry>
389 </glosslist>
390
391 <para>These limitations normally don't affect standard network use. But
392 the presence of NAT has also subtle effects that may interfere with
393 protocols that are normally working. One example is NFS, where the
394 server is often configured to refuse connections from non-privileged
395 ports (i.e. ports not below 1024).</para>
396 </sect2>
397 </sect1>
398
399 <sect1>
400 <title id="network_bridged">Bridged networking</title>
401
402 <para>With bridged networking, VirtualBox uses a device driver on your
403 <emphasis>host</emphasis> system that filters data from your physical
404 network adapter. This driver is therefore called a "net filter" driver.
405 This allows VirtualBox to intercept data from the physical network and
406 inject data into it, effectively creating a new network interface in
407 software. When a guest is using such a new software interface, it looks to
408 the host system as though the guest were physically connected to the
409 interface using a network cable: the host can send data to the guest
410 through that interface and receive data from it. This means that you can
411 set up routing or bridging between the guest and the rest of your
412 network.</para>
413
414 <para>For this to work, VirtualBox needs a device driver on your host
415 system. The way bridged networking works has been completely rewritten
416 with VirtualBox 2.0 and 2.1, depending on the host operating system. From
417 the user perspective, the main difference is that complex configuration is
418 no longer necessary on any of the supported host operating
419 systems.<footnote>
420 <para>For Mac OS X and Solaris hosts, net filter drivers were already
421 added in VirtualBox 2.0 (as initial support for Host Interface
422 Networking on these platforms). With VirtualBox 2.1, net filter
423 drivers were also added for the Windows and Linux hosts, replacing the
424 mechanisms previously present in VirtualBox for those platforms;
425 especially on Linux, the earlier method required creating TAP
426 interfaces and bridges, which was complex and varied from one
427 distribution to the next. None of this is necessary anymore. Bridged
428 network was formerly called "Host Interface Networking" and has been
429 renamed with version 2.2 without any change in functionality.</para>
430 </footnote></para>
431
432 <para><note>
433 <para>Even though TAP is no longer necessary on Linux with bridged
434 networking, you <emphasis>can</emphasis> still use TAP interfaces for
435 certain advanced setups, since you can connect a VM to any host
436 interface -- which could also be a TAP interface.</para>
437 </note>To enable bridged networking, all you need to do is to open the
438 Settings dialog of a virtual machine, go to the "Network" page and select
439 "Bridged network" in the drop down list for the "Attached to" field.
440 Finally, select desired host interface from the list at the bottom of the
441 page, which contains the physical network interfaces of your systems. On a
442 typical MacBook, for example, this will allow you to select between "en1:
443 AirPort" (which is the wireless interface) and "en0: Ethernet", which
444 represents the interface with a network cable.</para>
445
446 <para>Depending on your host operating system, the following limitations
447 should be kept in mind:<itemizedlist>
448 <listitem>
449 <para>On <emphasis role="bold">Macintosh</emphasis> hosts,
450 functionality is limited when using AirPort (the Mac's wireless
451 networking) for bridged networking. Currently, VirtualBox supports
452 only IPv4 over AirPort. For other protocols such as IPv6 and IPX,
453 you must choose a wired interface.</para>
454 </listitem>
455
456 <listitem>
457 <para>On <emphasis role="bold">Linux</emphasis> hosts, functionality
458 is limited when using wireless interfaces for bridged networking.
459 Currently, VirtualBox supports only IPv4 over wireless. For other
460 protocols such as IPv6 and IPX, you must choose a wired
461 interface.</para>
462
463 <para>Also, setting the MTU to less than 1500 bytes on wired
464 interfaces provided by the sky2 driver on the Marvell Yukon II EC
465 Ultra Ethernet NIC is known to cause packet losses under certain
466 conditions.</para>
467
468 <para>Some adapters strip VLAN tags in hardware. This does not allow
469 to use VLAN trunking between VM and the external network with
470 pre-2.6.27 Linux kernels nor with host operating systems other than
471 Linux.</para>
472 </listitem>
473
474 <listitem>
475 <para>On <emphasis role="bold">Solaris</emphasis> hosts, there is no
476 support for using wireless interfaces. Filtering guest traffic using
477 IPFilter is also not completely supported due to technical
478 restrictions of the Solaris networking subsystem. These issues would
479 be addressed in a future release of Solaris 11.</para>
480
481 <para>With VirtualBox 2.0.4 and above, it is possible to use
482 Crossbow Virtual Network Interfaces (VNICs) with bridged networking,
483 but with the following caveats:</para>
484
485 <itemizedlist>
486 <listitem>
487 <para>A VNIC cannot be shared between multiple guest network
488 interfaces, i.e. each guest network interface must have its own,
489 exclusive VNIC.</para>
490 </listitem>
491
492 <listitem>
493 <para>The VNIC and the guest network interface that uses the
494 VNIC must be assigned identical MAC addresses.</para>
495 </listitem>
496 </itemizedlist>
497
498 <para>When using VLAN interfaces with VirtualBox, they must be named
499 according to the PPA-hack naming scheme (e.g. "e1000g513001"), as
500 otherwise the guest may receive packets in an unexpected
501 format.</para>
502 </listitem>
503 </itemizedlist></para>
504 </sect1>
505
506 <sect1 id="network_internal">
507 <title>Internal networking</title>
508
509 <para>Internal Networking is similar to bridged networking in that the VM
510 can directly communicate with the outside world. However, the "outside
511 world" is limited to other VMs on the same host which connect to the same internal
512 network.</para>
513
514 <para>Even though technically, everything that can be done using internal
515 networking can also be done using bridged networking, there are security
516 advantages with internal networking. In bridged networking mode, all traffic
517 goes through a physical interface of the host system. It is therefore possible
518 to attach a packet sniffer (such as Wireshark) to the host interface and log
519 all traffic that goes over it. If, for any reason, you prefer two or more VMs
520 on the same machine to communicate privately, hiding their data from both
521 the host system and the user, bridged networking therefore is not an option.</para>
522
523 <para>Internal networks are created automatically as needed, i.e. there is
524 no central configuration. Every internal network is identified simply by
525 its name. Once there is more than one active virtual network card with the
526 same internal network ID, the VirtualBox support driver will automatically
527 "wire" the cards and act as a network switch. The VirtualBox support
528 driver implements a complete Ethernet switch and supports both
529 broadcast/multicast frames and promiscuous mode.</para>
530
531 <para>In order to attach a VM's network card to an internal network, set
532 its networking mode to "internal networking". There are two ways to
533 accomplish this:</para>
534
535 <para><itemizedlist>
536 <listitem>
537 <para>You can use a VM's "Settings" dialog in the VirtualBox
538 graphical user interface. In the "Networking" category of the
539 settings dialog, select "Internal Networking" from the drop-down
540 list of networking modes. Now select the name of an existing
541 internal network from the drop-down below or enter a new name into
542 the entry field.</para>
543 </listitem>
544
545 <listitem>
546 <para>You can use <screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; intnet</screen>
547 Optionally, you can specify a network name with the command <screen>VBoxManage modifyvm "VM name" --intnet&lt;x&gt; "network name"</screen>
548 If you do not specify a network name, the network card will be
549 attached to the network <computeroutput>intnet</computeroutput> by
550 default.</para>
551 </listitem>
552 </itemizedlist></para>
553
554 <para>Unless you configure the (virtual) network cards in the guest
555 operating systems that are participating in the internal network to use
556 static IP addresses, you may want to use the DHCP server that is built
557 into VirtualBox to manage IP addresses for the internal network. Please
558 see <xref linkend="vboxmanage-dhcpserver" /> for details.</para>
559
560 <para>As a security measure, the Linux implementation of internal
561 networking only allows VMs running under the same user ID to establish an
562 internal network.</para>
563 </sect1>
564
565 <sect1 id="network_hostonly">
566 <title>Host-only networking</title>
567
568 <para>Host-only networking is another networking mode that was added with
569 version 2.2 of VirtualBox. It can be thought of as a hybrid between the
570 bridged and internal networking modes: as with bridged networking, the
571 virtual machines can talk to each other and the host as if they were
572 connected through a physical ethernet switch. Similarly, as with internal
573 networking however, a physical networking interface need not be present,
574 and the virtual machines cannot talk to the world outside the host since
575 they are not connected to a physical networking interface.</para>
576
577 <para>Instead, when host-only networking is used, VirtualBox creates a new
578 software interface on the host which then appears next to your existing
579 network interfaces. In other words, whereas with bridged networking an
580 existing physical interface is used to attach virtual machines to, with
581 host-only networking a new "loopback" interface is created on the host.
582 And whereas with internal networking, the traffic between the virtual
583 machines cannot be seen, the traffic on the "loopback" interface on the
584 host can be intercepted.</para>
585
586 <para>Host-only networking is particularly useful for preconfigured
587 virtual appliances, where multiple virtual machines are shipped together
588 and designed to cooperate. For example, one virtual machine may contain a
589 web server and a second one a database, and since they are intended to
590 talk to each other, the appliance can instruct VirtualBox to set up a
591 host-only network for the two. A second (bridged) network would then
592 connect the web server to the outside world to serve data to, but the
593 outside world cannot connect to the database.</para>
594
595 <para>To change a virtual machine's virtual network interface to "host
596 only" mode:<itemizedlist>
597 <listitem>
598 <para>either go to the "Network" page in the virtual machine's
599 settings notebook in the graphical user interface and select
600 "Host-only networking", or</para>
601 </listitem>
602
603 <listitem>
604 <para>on the command line, type <computeroutput>VBoxManage modifyvm
605 "VM name" --nic&lt;x&gt; hostonly</computeroutput>; see <xref
606 linkend="vboxmanage-modifyvm" /> for details.</para>
607 </listitem>
608 </itemizedlist></para>
609
610 <para>For host-only networking, like with internal networking, you may
611 find the DHCP server useful that is built into VirtualBox. This can be
612 enabled to then manage the IP addresses in the host-only network since
613 otherwise you would need to configure all IP addresses
614 statically.<itemizedlist>
615 <listitem>
616 <para>In the VirtualBox graphical user interface, you can configure
617 all these items in the global settings via "File" -&gt; "Settings"
618 -&gt; "Network", which lists all host-only networks which are
619 presently in use. Click on the network name and then on the "Edit"
620 button to the right, and you can modify the adapter and DHCP
621 settings.</para>
622 </listitem>
623
624 <listitem>
625 <para>Alternatively, you can use <computeroutput>VBoxManage
626 dhcpserver</computeroutput> on the command line; please see <xref
627 linkend="vboxmanage-dhcpserver" /> for details.</para>
628 </listitem>
629 </itemizedlist></para>
630 </sect1>
631
632 <sect1 id="network_udp_tunnel">
633 <title>UDP Tunnel networking</title>
634
635 <para>This networking mode allows to interconnect virtual machines running
636 on different hosts.
637 </para>
638
639 <para>Technically this is done by encapsulating Ethernet frames sent or
640 received by the guest network card into UDP/IP datagrams, and sending them
641 over any network available to the host.
642 </para>
643
644 <para>UDP Tunnel mode has three parameters:<glosslist>
645 <glossentry>
646 <glossterm>Source UDP port</glossterm>
647
648 <glossdef>
649 <para>The port on which the host listens. Datagrams arriving on
650 this port from any source address will be forwarded to the
651 receiving part of the guest network card.</para>
652 </glossdef>
653 </glossentry>
654
655 <glossentry>
656 <glossterm>Destination address</glossterm>
657
658 <glossdef>
659 <para>IP address of the target host of the transmitted data.</para>
660 </glossdef>
661 </glossentry>
662
663 <glossentry>
664 <glossterm>Destination UDP port</glossterm>
665
666 <glossdef>
667 <para>Port number to which the transmitted data is sent.</para>
668 </glossdef>
669 </glossentry>
670 </glosslist></para>
671
672 <para>When interconnecting two virtual machines on two different hosts,
673 their IP addresses must be swapped. On single host, source and destination
674 UDP ports must be swapped.</para>
675 <para>In the following example host 1 uses the IP address 10.0.0.1 and
676 host 2 uses IP address 10.0.0.2. Configuration via command-line:<screen> VBoxManage modifyvm "VM 01 on host 1" --nic&lt;x&gt; generic
677 VBoxManage modifyvm "VM 01 on host 1" --nicgenericdrv&lt;x&gt; UDPTunnel
678 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; dest=10.0.0.2
679 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; sport=10001
680 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; dport=10002</screen>
681 and <screen> VBoxManage modifyvm "VM 02 on host 2" --nic&lt;y&gt; generic
682 VBoxManage modifyvm "VM 02 on host 2" --nicgenericdrv&lt;y&gt; UDPTunnel
683 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; dest=10.0.0.1
684 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; sport=10002
685 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; dport=10001</screen>
686 </para>
687
688 <para>Of course, you can always interconnect two virtual machines on the
689 same host, by setting the destination address parameter to 127.0.0.1
690 on both. It will act similarly to "Internal network" in this case, however
691 the host can see the network traffic which it could not in the normal
692 Internal network case.</para>
693
694 <para><note>On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is
695 not possible to bind to ports below 1024 from applications that are not
696 run by <computeroutput>root</computeroutput>. As a result, if you try to
697 configure such a source UDP port, the VM will refuse to start.</note></para>
698 </sect1>
699
700 <sect1 id="network_vde">
701 <title>VDE networking</title>
702
703
704 <para>Virtual Distributed Ethernet (VDE<footnote><para>VDE is a project
705 developed by Renzo Davoli, Associate Professor at the University of
706 Bologna, Italy.</para></footnote>) is a flexible, virtual network
707 infrastructure system, spanning across multiple hosts in a secure way.
708 It allows for L2/L3 switching, including spanning-tree protocol, VLANs,
709 and WAN emulation. It is an optional part of VirtualBox which is only
710 included in the source code.</para>
711
712 <para>The basic building blocks of the infrastructure are VDE switches,
713 VDE plugs and VDE wires which inter-connect the switches.</para>
714
715 <para>The VirtualBox VDE driver has one parameter:<glosslist>
716 <glossentry>
717 <glossterm>VDE network</glossterm>
718
719 <glossdef>
720 <para>The name of the VDE network switch socket to which the VM
721 will be connected.</para>
722 </glossdef>
723 </glossentry>
724 </glosslist></para>
725
726 <para>The following basic example shows how to connect a virtual machine
727 to a VDE switch:</para>
728
729 <para><orderedlist>
730 <listitem>
731 <para>Create a VDE switch:
732 <screen>vde_switch -s /tmp/switch1</screen>
733 </para>
734 </listitem>
735 <listitem>
736 <para>Configuration via command-line:
737 <screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; generic</screen>
738 <screen>VBoxManage modifyvm "VM name" --nicgenericdrv&lt;x&gt; VDE</screen>
739 To connect to automatically allocated switch port, use:
740 <screen>VBoxManage modifyvm "VM name" --nicproperty&lt;x&gt; network=/tmp/switch1</screen>
741 To connect to specific switch port &lt;n&gt;, use:
742 <screen>VBoxManage modifyvm "VM name" --nicproperty&lt;x&gt; network=/tmp/switch1[&lt;n&gt;]</screen>
743 The latter option can be useful for VLANs.
744 </para>
745 </listitem>
746 <listitem>
747 <para>Optionally map between VDE switch port and VLAN: (from switch CLI)
748 <screen>vde$ vlan/create &lt;VLAN&gt;</screen>
749 <screen>vde$ port/setvlan &lt;port&gt; &lt;VLAN&gt;</screen>
750 </para>
751 </listitem>
752 </orderedlist></para>
753
754 <para>VDE is available on Linux and FreeBSD hosts only. It is only
755 available if the VDE software and the VDE plugin library from the
756 VirtualSquare project are installed on the host system<footnote>
757 <para>For Linux hosts, the shared library libvdeplug.so must be available
758 in the search path for shared libraries</para></footnote>. For more
759 information on setting up VDE networks, please see the documentation
760 accompanying the software.<footnote>
761 <para><ulink
762 url="http://wiki.virtualsquare.org/wiki/index.php/VDE_Basic_Networking">http://wiki.virtualsquare.org/wiki/index.php/VDE_Basic_Networking</ulink>.</para>
763 </footnote></para>
764 </sect1>
765</chapter>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette