VirtualBox

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

Last change on this file since 37872 was 37619, checked in by vboxsync, 14 years ago

doc: fix CHM breakage for nested glosslist

File size: 35.9 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. The disadvantage of NAT mode is that,
233 much like a private network behind a router, the virtual machine is
234 invisible and unreachable from the outside internet; you cannot run a
235 server this way unless you set up port forwarding (described
236 below).</para>
237
238 <para>The network frames sent out by the guest operating system are
239 received by VirtualBox's NAT engine, which extracts the TCP/IP data and
240 resends it using the host operating system. To an application on the host,
241 or to another computer on the same network as the host, it looks like the
242 data was sent by the VirtualBox application on the host, using an IP
243 address belonging to the host. VirtualBox listens for replies to the
244 packages sent, and repacks and resends them to the guest machine on its
245 private network.</para>
246
247 <para>The virtual machine receives its network address and configuration
248 on the private network from a DHCP server integrated into VirtualBox. The
249 IP address thus assigned to the virtual machine is usually on a completely
250 different network than the host. As more than one card of a virtual
251 machine can be set up to use NAT, the first card is connected to the
252 private network 10.0.2.0, the second card to the network 10.0.3.0 and so
253 on. If you need to change the guest-assigned IP range for some reason,
254 please refer to <xref linkend="changenat" />.</para>
255
256 <sect2 id="natforward">
257 <title>Configuring port forwarding with NAT</title>
258
259 <para>As the virtual machine is connected to a private network internal
260 to VirtualBox and invisible to the host, network services on the guest
261 are not accessible to the host machine or to other computers on the same
262 network. However, like a physical router, VirtualBox can make selected
263 services available to the world outside the guest through <emphasis
264 role="bold">port forwarding.</emphasis> This means that VirtualBox
265 listens to certain ports on the host and resends all packets which
266 arrive there to the guest, on the same or a different port.</para>
267
268 <para>To an application on the host or other physical (or virtual)
269 machines on the network, it looks as though the service being proxied is
270 actually running on the host. This also means that you cannot run the
271 same service on the same ports on the host. However, you still gain the
272 advantages of running the service in a virtual machine -- for example,
273 services on the host machine or on other virtual machines cannot be
274 compromised or crashed by a vulnerability or a bug in the service, and
275 the service can run in a different operating system than the host
276 system.</para>
277
278 <para>You can set up a guest service which you wish to proxy using the
279 command line tool <computeroutput>VBoxManage</computeroutput>; for
280 details, please refer to <xref linkend="vboxmanage-modifyvm" />.</para>
281
282 <para>You will need to know which ports on the guest the service uses
283 and to decide which ports to use on the host (often but not always you
284 will want to use the same ports on the guest and on the host). You can
285 use any ports on the host which are not already in use by a service. For
286 example, to set up incoming NAT connections to an
287 <computeroutput>ssh</computeroutput> server in the guest, use the
288 following command: <screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"</screen>With
289 the above example, all TCP traffic arriving on port 2222 on any host
290 interface will be forwarded to port 22 in the guest. The protocol name
291 <computeroutput>tcp</computeroutput> is a mandatory attribute defining
292 which protocol should be used for forwarding
293 (<computeroutput>udp</computeroutput> could also be used). The name
294 <computeroutput>guestssh</computeroutput> is purely descriptive and will
295 be auto-generated if omitted. The number after
296 <computeroutput>--natpf</computeroutput> denotes the network card, like
297 in other parts of VBoxManage.</para>
298
299 <para>To remove this forwarding rule again, use the following command:
300 <screen>VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"</screen></para>
301
302 <para>If for some reason the guest uses a static assigned IP address not
303 leased from the built-in DHCP server, it is required to specify the
304 guest IP when registering the forwarding rule: <screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.19,22"</screen>This
305 example is identical to the previous one, except that the NAT engine is
306 being told that the guest can be found at the 10.0.2.19 address.</para>
307
308 <para>To forward <emphasis>all</emphasis> incoming traffic from a
309 specific host interface to the guest, specify the IP of that host
310 interface like this:<screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"</screen>This
311 forwards all TCP traffic arriving on the localhost interface (127.0.0.1)
312 via port 2222 to port 22 in the guest.</para>
313
314 <para>It is not possible to configure incoming NAT connections while the
315 VM is running. However, you can change the settings for a VM which is
316 currently saved (or powered off at a snapshot).</para>
317 </sect2>
318
319 <sect2 id="nat-tftp">
320 <title>PXE booting with NAT</title>
321
322 <para>PXE booting is now supported in NAT mode. The NAT DHCP server
323 provides a boot file name of the form
324 <computeroutput>vmname.pxe</computeroutput> if the directory
325 <computeroutput>TFTP</computeroutput> exists in the directory where the
326 user's <computeroutput>VirtualBox.xml</computeroutput> file is kept. It
327 is the responsibility of the user to provide
328 <computeroutput>vmname.pxe</computeroutput>.</para>
329 </sect2>
330
331 <sect2 id="nat-limitations">
332 <title>NAT limitations</title>
333
334 <para>There are four <emphasis role="bold">limitations</emphasis> of NAT
335 mode which users should be aware of:</para>
336
337 <glosslist>
338 <glossentry>
339 <glossterm>ICMP protocol limitations:</glossterm>
340
341 <glossdef>
342 <para>Some frequently used network debugging tools (e.g.
343 <computeroutput>ping</computeroutput> or tracerouting) rely on the
344 ICMP protocol for sending/receiving messages. While ICMP support
345 has been improved with VirtualBox 2.1
346 (<computeroutput>ping</computeroutput> should now work), some
347 other tools may not work reliably.</para>
348 </glossdef>
349 </glossentry>
350
351 <glossentry>
352 <glossterm>Receiving of UDP broadcasts is not reliable:</glossterm>
353
354 <glossdef>
355 <para>The guest does not reliably receive broadcasts, since, in
356 order to save resources, it only listens for a certain amount of
357 time after the guest has sent UDP data on a particular port. As a
358 consequence, NetBios name resolution based on broadcasts does not
359 always work (but WINS always works). As a workaround, you can use
360 the numeric IP of the desired server in the
361 <computeroutput>\\server\share</computeroutput> notation.</para>
362 </glossdef>
363 </glossentry>
364
365 <glossentry>
366 <glossterm>Protocols such as GRE are unsupported:</glossterm>
367
368 <glossdef>
369 <para>Protocols other than TCP and UDP are not supported. This
370 means some VPN products (e.g. PPTP from Microsoft) cannot be used.
371 There are other VPN products which use simply TCP and UDP.</para>
372 </glossdef>
373 </glossentry>
374
375 <glossentry>
376 <glossterm>Forwarding host ports &lt; 1024 impossible:</glossterm>
377
378 <glossdef>
379 <para>On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is
380 not possible to bind to ports below 1024 from applications that
381 are not run by <computeroutput>root</computeroutput>. As a result,
382 if you try to configure such a port forwarding, the VM will refuse
383 to start.</para>
384 </glossdef>
385 </glossentry>
386 </glosslist>
387
388 <para>These limitations normally don't affect standard network use. But
389 the presence of NAT has also subtle effects that may interfere with
390 protocols that are normally working. One example is NFS, where the
391 server is often configured to refuse connections from non-privileged
392 ports (i.e. ports not below 1024).</para>
393 </sect2>
394 </sect1>
395
396 <sect1>
397 <title id="network_bridged">Bridged networking</title>
398
399 <para>With bridged networking, VirtualBox uses a device driver on your
400 <emphasis>host</emphasis> system that filters data from your physical
401 network adapter. This driver is therefore called a "net filter" driver.
402 This allows VirtualBox to intercept data from the physical network and
403 inject data into it, effectively creating a new network interface in
404 software. When a guest is using such a new software interface, it looks to
405 the host system as though the guest were physically connected to the
406 interface using a network cable: the host can send data to the guest
407 through that interface and receive data from it. This means that you can
408 set up routing or bridging between the guest and the rest of your
409 network.</para>
410
411 <para>For this to work, VirtualBox needs a device driver on your host
412 system. The way bridged networking works has been completely rewritten
413 with VirtualBox 2.0 and 2.1, depending on the host operating system. From
414 the user perspective, the main difference is that complex configuration is
415 no longer necessary on any of the supported host operating
416 systems.<footnote>
417 <para>For Mac OS X and Solaris hosts, net filter drivers were already
418 added in VirtualBox 2.0 (as initial support for Host Interface
419 Networking on these platforms). With VirtualBox 2.1, net filter
420 drivers were also added for the Windows and Linux hosts, replacing the
421 mechanisms previously present in VirtualBox for those platforms;
422 especially on Linux, the earlier method required creating TAP
423 interfaces and bridges, which was complex and varied from one
424 distribution to the next. None of this is necessary anymore. Bridged
425 network was formerly called "Host Interface Networking" and has been
426 renamed with version 2.2 without any change in functionality.</para>
427 </footnote></para>
428
429 <para><note>
430 <para>Even though TAP is no longer necessary on Linux with bridged
431 networking, you <emphasis>can</emphasis> still use TAP interfaces for
432 certain advanced setups, since you can connect a VM to any host
433 interface -- which could also be a TAP interface.</para>
434 </note>To enable bridged networking, all you need to do is to open the
435 Settings dialog of a virtual machine, go to the "Network" page and select
436 "Bridged network" in the drop down list for the "Attached to" field.
437 Finally, select desired host interface from the list at the bottom of the
438 page, which contains the physical network interfaces of your systems. On a
439 typical MacBook, for example, this will allow you to select between "en1:
440 AirPort" (which is the wireless interface) and "en0: Ethernet", which
441 represents the interface with a network cable.</para>
442
443 <para>Depending on your host operating system, the following limitations
444 should be kept in mind:<itemizedlist>
445 <listitem>
446 <para>On <emphasis role="bold">Macintosh</emphasis> hosts,
447 functionality is limited when using AirPort (the Mac's wireless
448 networking) for bridged networking. Currently, VirtualBox supports
449 only IPv4 over AirPort. For other protocols such as IPv6 and IPX,
450 you must choose a wired interface.</para>
451 </listitem>
452
453 <listitem>
454 <para>On <emphasis role="bold">Linux</emphasis> hosts, functionality
455 is limited when using wireless interfaces for bridged networking.
456 Currently, VirtualBox supports only IPv4 over wireless. For other
457 protocols such as IPv6 and IPX, you must choose a wired
458 interface.</para>
459
460 <para>Also, setting the MTU to less than 1500 bytes on wired
461 interfaces provided by the sky2 driver on the Marvell Yukon II EC
462 Ultra Ethernet NIC is known to cause packet losses under certain
463 conditions.</para>
464 </listitem>
465
466 <listitem>
467 <para>On <emphasis role="bold">Solaris</emphasis> hosts, there is no
468 support for using wireless interfaces. Filtering guest traffic using
469 IPFilter is also not completely supported due to technical
470 restrictions of the Solaris networking subsystem. These issues would
471 be addressed in a future release of Solaris 11.</para>
472
473 <para>With VirtualBox 2.0.4 and above, it is possible to use
474 Crossbow Virtual Network Interfaces (VNICs) with bridged networking,
475 but with the following caveats:</para>
476
477 <itemizedlist>
478 <listitem>
479 <para>A VNIC cannot be shared between multiple guest network
480 interfaces, i.e. each guest network interface must have its own,
481 exclusive VNIC.</para>
482 </listitem>
483
484 <listitem>
485 <para>The VNIC and the guest network interface that uses the
486 VNIC must be assigned identical MAC addresses.</para>
487 </listitem>
488 </itemizedlist>
489
490 <para>When using VLAN interfaces with VirtualBox, they must be named
491 according to the PPA-hack naming scheme (e.g. "e1000g513001"), as
492 otherwise the guest may receive packets in an unexpected
493 format.</para>
494 </listitem>
495 </itemizedlist></para>
496 </sect1>
497
498 <sect1 id="network_internal">
499 <title>Internal networking</title>
500
501 <para>Internal Networking is similar to bridged networking in that the VM
502 can directly communicate with the outside world. However, the "outside
503 world" is limited to other VMs on the same host which connect to the same internal
504 network.</para>
505
506 <para>Even though technically, everything that can be done using internal
507 networking can also be done using bridged networking, there are security
508 advantages with internal networking. In bridged networking mode, all traffic
509 goes through a physical interface of the host system. It is therefore possible
510 to attach a packet sniffer (such as Wireshark) to the host interface and log
511 all traffic that goes over it. If, for any reason, you prefer two or more VMs
512 on the same machine to communicate privately, hiding their data from both
513 the host system and the user, bridged networking therefore is not an option.</para>
514
515 <para>Internal networks are created automatically as needed, i.e. there is
516 no central configuration. Every internal network is identified simply by
517 its name. Once there is more than one active virtual network card with the
518 same internal network ID, the VirtualBox support driver will automatically
519 "wire" the cards and act as a network switch. The VirtualBox support
520 driver implements a complete Ethernet switch and supports both
521 broadcast/multicast frames and promiscuous mode.</para>
522
523 <para>In order to attach a VM's network card to an internal network, set
524 its networking mode to "internal networking". There are two ways to
525 accomplish this:</para>
526
527 <para><itemizedlist>
528 <listitem>
529 <para>You can use a VM's "Settings" dialog in the VirtualBox
530 graphical user interface. In the "Networking" category of the
531 settings dialog, select "Internal Networking" from the drop-down
532 list of networking modes. Now select the name of an existing
533 internal network from the drop-down below or enter a new name into
534 the entry field.</para>
535 </listitem>
536
537 <listitem>
538 <para>You can use <screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; intnet</screen>
539 Optionally, you can specify a network name with the command <screen>VBoxManage modifyvm "VM name" --intnet&lt;x&gt; "network name"</screen>
540 If you do not specify a network name, the network card will be
541 attached to the network <computeroutput>intnet</computeroutput> by
542 default.</para>
543 </listitem>
544 </itemizedlist></para>
545
546 <para>Unless you configure the (virtual) network cards in the guest
547 operating systems that are participating in the internal network to use
548 static IP addresses, you may want to use the DHCP server that is built
549 into VirtualBox to manage IP addresses for the internal network. Please
550 see <xref linkend="vboxmanage-dhcpserver" /> for details.</para>
551
552 <para>As a security measure, the Linux implementation of internal
553 networking only allows VMs running under the same user ID to establish an
554 internal network.</para>
555 </sect1>
556
557 <sect1 id="network_hostonly">
558 <title>Host-only networking</title>
559
560 <para>Host-only networking is another networking mode that was added with
561 version 2.2 of VirtualBox. It can be thought of as a hybrid between the
562 bridged and internal networking modes: as with bridged networking, the
563 virtual machines can talk to each other and the host as if they were
564 connected through a physical ethernet switch. Similarly, as with internal
565 networking however, a physical networking interface need not be present,
566 and the virtual machines cannot talk to the world outside the host since
567 they are not connected to a physical networking interface.</para>
568
569 <para>Instead, when host-only networking is used, VirtualBox creates a new
570 software interface on the host which then appears next to your existing
571 network interfaces. In other words, whereas with bridged networking an
572 existing physical interface is used to attach virtual machines to, with
573 host-only networking a new "loopback" interface is created on the host.
574 And whereas with internal networking, the traffic between the virtual
575 machines cannot be seen, the traffic on the "loopback" interface on the
576 host can be intercepted.</para>
577
578 <para>Host-only networking is particularly useful for preconfigured
579 virtual appliances, where multiple virtual machines are shipped together
580 and designed to cooperate. For example, one virtual machine may contain a
581 web server and a second one a database, and since they are intended to
582 talk to each other, the appliance can instruct VirtualBox to set up a
583 host-only network for the two. A second (bridged) network would then
584 connect the web server to the outside world to serve data to, but the
585 outside world cannot connect to the database.</para>
586
587 <para>To change a virtual machine's virtual network interface to "host
588 only" mode:<itemizedlist>
589 <listitem>
590 <para>either go to the "Network" page in the virtual machine's
591 settings notebook in the graphical user interface and select
592 "Host-only networking", or</para>
593 </listitem>
594
595 <listitem>
596 <para>on the command line, type <computeroutput>VBoxManage modifyvm
597 "VM name" --nic&lt;x&gt; hostonly</computeroutput>; see <xref
598 linkend="vboxmanage-modifyvm" /> for details.</para>
599 </listitem>
600 </itemizedlist></para>
601
602 <para>For host-only networking, like with internal networking, you may
603 find the DHCP server useful that is built into VirtualBox. This can be
604 enabled to then manage the IP addresses in the host-only network since
605 otherwise you would need to configure all IP addresses
606 statically.<itemizedlist>
607 <listitem>
608 <para>In the VirtualBox graphical user interface, you can configure
609 all these items in the global settings via "File" -&gt; "Settings"
610 -&gt; "Network", which lists all host-only networks which are
611 presently in use. Click on the network name and then on the "Edit"
612 button to the right, and you can modify the adapter and DHCP
613 settings.</para>
614 </listitem>
615
616 <listitem>
617 <para>Alternatively, you can use <computeroutput>VBoxManage
618 dhcpserver</computeroutput> on the command line; please see <xref
619 linkend="vboxmanage-dhcpserver" /> for details.</para>
620 </listitem>
621 </itemizedlist></para>
622 </sect1>
623
624 <sect1 id="network_udp_tunnel">
625 <title>UDP Tunnel networking</title>
626
627 <para>This networking mode allows to interconnect virtual machines running
628 on different hosts.
629 </para>
630
631 <para>Technically this is done by encapsulating Ethernet frames sent or
632 received by the guest network card into UDP/IP datagrams, and sending them
633 over any network available to the host.
634 </para>
635
636 <para>UDP Tunnel mode has three parameters:<glosslist>
637 <glossentry>
638 <glossterm>Source UDP port</glossterm>
639
640 <glossdef>
641 <para>The port on which the host listens. Datagrams arriving on
642 this port from any source address will be forwarded to the
643 receiving part of the guest network card.</para>
644 </glossdef>
645 </glossentry>
646
647 <glossentry>
648 <glossterm>Destination address</glossterm>
649
650 <glossdef>
651 <para>IP address of the target host of the transmitted data.</para>
652 </glossdef>
653 </glossentry>
654
655 <glossentry>
656 <glossterm>Destination UDP port</glossterm>
657
658 <glossdef>
659 <para>Port number to which the transmitted data is sent.</para>
660 </glossdef>
661 </glossentry>
662 </glosslist></para>
663
664 <para>When interconnecting two virtual machines on two different hosts,
665 their IP addresses must be swapped. On single host, source and destination
666 UDP ports must be swapped.</para>
667 <para>In the following example host 1 uses the IP address 10.0.0.1 and
668 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
669 VBoxManage modifyvm "VM 01 on host 1" --nicgenericdrv&lt;x&gt; UDPTunnel
670 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; dest=10.0.0.2
671 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; sport=10001
672 VBoxManage modifyvm "VM 01 on host 1" --nicproperty&lt;x&gt; dport=10002</screen>
673 and <screen> VBoxManage modifyvm "VM 02 on host 2" --nic&lt;y&gt; generic
674 VBoxManage modifyvm "VM 02 on host 2" --nicgenericdrv&lt;y&gt; UDPTunnel
675 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; dest=10.0.0.1
676 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; sport=10002
677 VBoxManage modifyvm "VM 02 on host 2" --nicproperty&lt;y&gt; dport=10001</screen>
678 </para>
679
680 <para>Of course, you can always interconnect two virtual machines on the
681 same host, by setting the destination address parameter to 127.0.0.1
682 on both. It will act similarly to "Internal network" in this case, however
683 the host can see the network traffic which it could not in the normal
684 Internal network case.</para>
685
686 <para><note>On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is
687 not possible to bind to ports below 1024 from applications that are not
688 run by <computeroutput>root</computeroutput>. As a result, if you try to
689 configure such a source UDP port, the VM will refuse to start.</note></para>
690 </sect1>
691
692 <sect1 id="network_vde">
693 <title>VDE networking</title>
694
695
696 <para>Virtual Distributed Ethernet (VDE<footnote><para>VDE is a project
697 developed by Renzo Davoli, Associate Professor at the University of
698 Bologna, Italy.</para></footnote>) is a flexible, virtual network
699 infrastructure system, spanning across multiple hosts in a secure way.
700 It allows for L2/L3 switching, including spanning-tree protocol, VLANs,
701 and WAN emulation. It is an optional part of VirtualBox which is only
702 included in the source code.</para>
703
704 <para>The basic building blocks of the infrastructure are VDE switches,
705 VDE plugs and VDE wires which inter-connect the switches.</para>
706
707 <para>The VirtualBox VDE driver has one parameter:<glosslist>
708 <glossentry>
709 <glossterm>VDE network</glossterm>
710
711 <glossdef>
712 <para>The name of the VDE network switch socket to which the VM
713 will be connected.</para>
714 </glossdef>
715 </glossentry>
716 </glosslist></para>
717
718 <para>The following basic example shows how to connect a virtual machine
719 to a VDE switch:</para>
720
721 <para><orderedlist>
722 <listitem>
723 <para>Create a VDE switch:
724 <screen>vde_switch -s /tmp/switch1</screen>
725 </para>
726 </listitem>
727 <listitem>
728 <para>Configuration via command-line:
729 <screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; generic</screen>
730 <screen>VBoxManage modifyvm "VM name" --nicgenericdrv&lt;x&gt; VDE</screen>
731 To connect to automatically allocated switch port, use:
732 <screen>VBoxManage modifyvm "VM name" --nicproperty&lt;x&gt; network=/tmp/switch1</screen>
733 To connect to specific switch port &lt;n&gt;, use:
734 <screen>VBoxManage modifyvm "VM name" --nicproperty&lt;x&gt; network=/tmp/switch1[&lt;n&gt;]</screen>
735 The latter option can be useful for VLANs.
736 </para>
737 </listitem>
738 <listitem>
739 <para>Optionally map between VDE switch port and VLAN: (from switch CLI)
740 <screen>vde$ vlan/create &lt;VLAN&gt;</screen>
741 <screen>vde$ port/setvlan &lt;port&gt; &lt;VLAN&gt;</screen>
742 </para>
743 </listitem>
744 </orderedlist></para>
745
746 <para>VDE is available on Linux and FreeBSD hosts only. It is only
747 available if the VDE software and the VDE plugin library from the
748 VirtualSquare project are installed on the host system. For more
749 information on setting up VDE networks, please see the documentation
750 accompanying the software.<footnote>
751 <para><ulink
752 url="http://wiki.virtualsquare.org/wiki/index.php/VDE_Basic_Networking">http://wiki.virtualsquare.org/wiki/index.php/VDE_Basic_Networking</ulink>.</para>
753 </footnote></para>
754 </sect1>
755</chapter>
Note: See TracBrowser for help on using the repository browser.

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