VirtualBox

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

Last change on this file since 96407 was 96407, checked in by vboxsync, 3 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 56.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright (C) 2006-2022 Oracle and/or its affiliates.
4
5 This file is part of VirtualBox base platform packages, as
6 available from https://www.215389.xyz.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation, in version 3 of the
11 License.
12
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <https://www.gnu.org/licenses>.
20
21 SPDX-License-Identifier: GPL-3.0-only
22-->
23<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
24"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
25<!ENTITY % all.entities SYSTEM "all-entities.ent">
26%all.entities;
27]>
28<chapter id="networkingdetails">
29
30 <title>Virtual Networking</title>
31
32 <para>
33 As mentioned in <xref linkend="settings-network" />, &product-name;
34 provides up to eight virtual PCI Ethernet cards for each virtual
35 machine. For each such card, you can individually select the
36 following:
37 </para>
38
39 <itemizedlist>
40
41 <listitem>
42 <para>
43 The hardware that will be virtualized.
44 </para>
45 </listitem>
46
47 <listitem>
48 <para>
49 The virtualization mode that the virtual card operates in, with
50 respect to your physical networking hardware on the host.
51 </para>
52 </listitem>
53
54 </itemizedlist>
55
56 <para>
57 Four of the network cards can be configured in the
58 <emphasis role="bold">Network</emphasis> section of the
59 <emphasis role="bold">Settings</emphasis> dialog in the graphical
60 user interface of &product-name;. You can configure all eight
61 network cards on the command line using <command>VBoxManage
62 modifyvm</command>. See <xref linkend="vboxmanage-modifyvm" />.
63 </para>
64
65 <para>
66 This chapter explains the various networking settings in more
67 detail.
68 </para>
69
70 <sect1 id="nichardware">
71
72 <title>Virtual Networking Hardware</title>
73
74 <para>
75 For each card, you can individually select what kind of
76 <emphasis>hardware</emphasis> will be presented to the virtual
77 machine. &product-name; can virtualize the following types of
78 networking hardware:
79 </para>
80
81 <itemizedlist>
82
83 <listitem>
84 <para>
85 AMD PCNet PCI II (Am79C970A)
86 </para>
87 </listitem>
88
89 <listitem>
90 <para>
91 AMD PCNet FAST III (Am79C973), the default setting
92 </para>
93 </listitem>
94
95 <listitem>
96 <para>
97 Intel PRO/1000 MT Desktop (82540EM)
98 </para>
99 </listitem>
100
101 <listitem>
102 <para>
103 Intel PRO/1000 T Server (82543GC)
104 </para>
105 </listitem>
106
107 <listitem>
108 <para>
109 Intel PRO/1000 MT Server (82545EM)
110 </para>
111 </listitem>
112
113 <listitem>
114 <para>
115 Paravirtualized network adapter (virtio-net)
116 </para>
117 </listitem>
118
119 </itemizedlist>
120
121 <para>
122 The PCNet FAST III is the default because it is supported by
123 nearly all operating systems, as well as by the GNU GRUB boot
124 manager. As an exception, the Intel PRO/1000 family adapters are
125 chosen for some guest operating system types that no longer ship
126 with drivers for the PCNet card, such as Windows Vista.
127 </para>
128
129 <para>
130 The Intel PRO/1000 MT Desktop type works with Windows Vista and
131 later versions. The T Server variant of the Intel PRO/1000 card is
132 recognized by Windows XP guests without additional driver
133 installation. The MT Server variant facilitates OVF imports from
134 other platforms.
135 </para>
136
137 <para>
138 The Paravirtualized network adapter (virtio-net) is special. If
139 you select this adapter, then &product-name; does
140 <emphasis>not</emphasis> virtualize common networking hardware
141 that is supported by common guest operating systems. Instead,
142 &product-name; expects a special software interface for
143 virtualized environments to be provided by the guest, thus
144 avoiding the complexity of emulating networking hardware and
145 improving network performance. &product-name; provides support for
146 the industry-standard <emphasis>virtio</emphasis> networking
147 drivers, which are part of the open source KVM project.
148 </para>
149
150 <para>
151 The virtio networking drivers are available for the following
152 guest operating systems:
153 </para>
154
155 <itemizedlist>
156
157 <listitem>
158 <para>
159 Linux kernels version 2.6.25 or later can be configured to
160 provide virtio support. Some distributions have also
161 back-ported virtio to older kernels.
162 </para>
163 </listitem>
164
165 <listitem>
166 <para>
167 For Windows 2000, XP, and Vista, virtio drivers can be
168 downloaded and installed from the KVM project web page:
169 </para>
170
171 <para>
172 <ulink
173 url="http://www.linux-kvm.org/page/WindowsGuestDrivers" />.
174 </para>
175 </listitem>
176
177 </itemizedlist>
178
179 <para>
180 &product-name; also has limited support for <emphasis>jumbo
181 frames</emphasis>. These are networking packets with more than
182 1500 bytes of data, provided that you use the Intel card
183 virtualization and bridged networking. Jumbo frames are not
184 supported with the AMD networking devices. In those cases, jumbo
185 packets will silently be dropped for both the transmit and the
186 receive direction. Guest operating systems trying to use this
187 feature will observe this as a packet loss, which may lead to
188 unexpected application behavior in the guest. This does not cause
189 problems with guest operating systems in their default
190 configuration, as jumbo frames need to be explicitly enabled.
191 </para>
192
193 </sect1>
194
195 <sect1 id="networkingmodes">
196
197 <title>Introduction to Networking Modes</title>
198
199 <para>
200 Each of the networking adapters can be separately configured to
201 operate in one of the following modes:
202 </para>
203
204 <itemizedlist>
205
206 <listitem>
207 <para>
208 <emphasis role="bold">Not attached.</emphasis> In this mode,
209 &product-name; reports to the guest that a network card is
210 present, but that there is no connection. This is as if no
211 Ethernet cable was plugged into the card. Using this mode, it
212 is possible to <emphasis>pull</emphasis> the virtual Ethernet
213 cable and disrupt the connection, which can be useful to
214 inform a guest operating system that no network connection is
215 available and enforce a reconfiguration.
216 </para>
217 </listitem>
218
219 <listitem>
220 <para>
221 <emphasis role="bold">Network Address Translation
222 (NAT)</emphasis>. If all you want is to browse the Web,
223 download files, and view email inside the guest, then this
224 default mode should be sufficient for you, and you can skip
225 the rest of this section. Please note that there are certain
226 limitations when using Windows file sharing. See
227 <xref linkend="nat-limitations" />.
228 </para>
229 </listitem>
230
231 <listitem>
232 <para>
233 <emphasis role="bold">NAT Network.</emphasis> A NAT network is
234 a type of internal network that allows outbound connections.
235 See <xref linkend="network_nat_service"/>.
236 </para>
237 </listitem>
238
239 <listitem>
240 <para>
241 <emphasis role="bold">Bridged networking.</emphasis> This is
242 for more advanced networking needs, such as network
243 simulations and running servers in a guest. When enabled,
244 &product-name; connects to one of your installed network cards
245 and exchanges network packets directly, circumventing your
246 host operating system's network stack.
247 </para>
248 </listitem>
249
250 <listitem>
251 <para>
252 <emphasis role="bold">Internal networking.</emphasis> This can
253 be used to create a different kind of software-based network
254 which is visible to selected virtual machines, but not to
255 applications running on the host or to the outside world.
256 </para>
257 </listitem>
258
259 <listitem>
260 <para>
261 <emphasis role="bold">Host-only networking.</emphasis> This
262 can be used to create a network containing the host and a set
263 of virtual machines, without the need for the host's physical
264 network interface. Instead, a virtual network interface,
265 similar to a loopback interface, is created on the host,
266 providing connectivity among virtual machines and the host.
267 </para>
268 </listitem>
269
270 <listitem>
271 <para>
272 <emphasis role="bold"> Generic networking.</emphasis> Rarely
273 used modes which share the same generic network interface, by
274 allowing the user to select a driver which can be included
275 with &product-name; or be distributed in an extension pack.
276 </para>
277
278 <para>
279 The following sub-modes are available:
280 </para>
281
282 <itemizedlist>
283
284 <listitem>
285 <para>
286 <emphasis role="bold">UDP Tunnel:</emphasis> Used to
287 interconnect virtual machines running on different hosts
288 directly, easily, and transparently, over an existing
289 network infrastructure.
290 </para>
291 </listitem>
292
293 <listitem>
294 <para>
295 <emphasis role="bold">VDE (Virtual Distributed Ethernet)
296 networking:</emphasis> Used to connect to a Virtual
297 Distributed Ethernet switch on a Linux or a FreeBSD host.
298 At the moment this option requires compilation of
299 &product-name; from sources, as the Oracle packages do not
300 include it.
301 </para>
302 </listitem>
303
304 </itemizedlist>
305 </listitem>
306
307 </itemizedlist>
308
309 <para>
310 The following table provides an overview of the most important
311 networking modes.
312 </para>
313
314 <table id="table-networking-modes" tabstyle="oracle-all">
315 <title>Overview of Networking Modes</title>
316 <tgroup cols="6">
317 <colspec align="left" />
318 <colspec align="center" />
319 <colspec align="center" />
320 <colspec align="center" />
321 <colspec align="center" />
322 <colspec align="center" />
323 <thead valign="middle">
324 <row>
325 <entry><emphasis role="bold">Mode</emphasis></entry>
326 <entry><para>
327 <emphasis role="bold">VM&rarr;Host</emphasis>
328 </para></entry>
329 <entry><para>
330 <emphasis role="bold">VM&larr;Host</emphasis>
331 </para></entry>
332 <entry><para>
333 <emphasis role="bold">VM1&harr;VM2</emphasis>
334 </para></entry>
335 <entry><para>
336 <emphasis role="bold">VM&rarr;Net/LAN</emphasis>
337 </para></entry>
338 <entry><para>
339 <emphasis role="bold">VM&larr;Net/LAN</emphasis>
340 </para></entry>
341 </row>
342 </thead>
343 <tbody valign="middle">
344 <row>
345 <entry><para>
346 Host-only
347 </para></entry>
348 <entry><para>
349 <emphasis role="bold">+</emphasis>
350 </para></entry>
351 <entry><para>
352 <emphasis role="bold">+</emphasis>
353 </para></entry>
354 <entry align="center"><para>
355 <emphasis role="bold">+</emphasis>
356 </para></entry>
357 <entry><para>
358 &ndash;
359 </para></entry>
360 <entry><para>
361 &ndash;
362 </para></entry>
363 </row>
364 <row>
365 <entry><para>
366 Internal
367 </para></entry>
368 <entry><para>
369 &ndash;
370 </para></entry>
371 <entry><para>
372 &ndash;
373 </para></entry>
374 <entry><para>
375 <emphasis role="bold">+</emphasis>
376 </para></entry>
377 <entry><para>
378 &ndash;
379 </para></entry>
380 <entry><para>
381 &ndash;
382 </para></entry>
383 </row>
384 <row>
385 <entry><para>
386 Bridged
387 </para></entry>
388 <entry><para>
389 <emphasis role="bold">+</emphasis>
390 </para></entry>
391 <entry><para>
392 <emphasis role="bold">+</emphasis>
393 </para></entry>
394 <entry><para>
395 <emphasis role="bold">+</emphasis>
396 </para></entry>
397 <entry><para>
398 <emphasis role="bold">+</emphasis>
399 </para></entry>
400 <entry><para>
401 <emphasis role="bold">+</emphasis>
402 </para></entry>
403 </row>
404 <row>
405 <entry><para>
406 NAT
407 </para></entry>
408 <entry><para>
409 <emphasis role="bold">+</emphasis>
410 </para></entry>
411 <entry><para>
412 <link linkend="natforward">Port forward</link>
413 </para></entry>
414 <entry><para>
415 &ndash;
416 </para></entry>
417 <entry><para>
418 <emphasis role="bold">+</emphasis>
419 </para></entry>
420 <entry><para>
421 <link linkend="natforward">Port forward</link>
422 </para></entry>
423 </row>
424 <row>
425 <entry><para>
426 NATservice
427 </para></entry>
428 <entry><para>
429 <emphasis role="bold">+</emphasis>
430 </para></entry>
431 <entry><para>
432 <link linkend="network_nat_service">Port forward</link>
433 </para></entry>
434 <entry><para>
435 <emphasis role="bold">+</emphasis>
436 </para></entry>
437 <entry><para>
438 <emphasis role="bold">+</emphasis>
439 </para></entry>
440 <entry><para>
441 <link linkend="network_nat_service">Port forward</link>
442 </para></entry>
443 </row>
444 </tbody>
445 </tgroup>
446 </table>
447
448 <para>
449 The following sections describe the available network modes in
450 more detail.
451 </para>
452
453 </sect1>
454
455 <sect1 id="network_nat">
456
457 <title>Network Address Translation (NAT)</title>
458
459 <para>
460 Network Address Translation (NAT) is the simplest way of accessing
461 an external network from a virtual machine. Usually, it does not
462 require any configuration on the host network and guest system.
463 For this reason, it is the default networking mode in
464 &product-name;.
465 </para>
466
467 <para>
468 A virtual machine with NAT enabled acts much like a real computer
469 that connects to the Internet through a router. The router, in
470 this case, is the &product-name; networking engine, which maps
471 traffic from and to the virtual machine transparently. In
472 &product-name; this router is placed between each virtual machine
473 and the host. This separation maximizes security since by default
474 virtual machines cannot talk to each other.
475 </para>
476
477 <para>
478 The disadvantage of NAT mode is that, much like a private network
479 behind a router, the virtual machine is invisible and unreachable
480 from the outside internet. You cannot run a server this way unless
481 you set up port forwarding. See <xref linkend="natforward"/>.
482 </para>
483
484 <para>
485 The network frames sent out by the guest operating system are
486 received by &product-name;'s NAT engine, which extracts the TCP/IP
487 data and resends it using the host operating system. To an
488 application on the host, or to another computer on the same
489 network as the host, it looks like the data was sent by the
490 &product-name; application on the host, using an IP address
491 belonging to the host. &product-name; listens for replies to the
492 packages sent, and repacks and resends them to the guest machine
493 on its private network.
494 </para>
495
496 <note>
497 <para>
498 Even though the NAT engine separates the VM from the host, the
499 VM has access to the host's loopback interface and the network
500 services running on it. The host's loopback interface is
501 accessible as IP address 10.0.2.2. This access to the host's
502 loopback interface can be extremely useful in some cases, for
503 example when running a web application under development in the
504 VM and the database server on the loopback interface on the
505 host.
506 </para>
507 </note>
508
509 <para>
510 The virtual machine receives its network address and configuration
511 on the private network from a DHCP server integrated into
512 &product-name;. The IP address thus assigned to the virtual
513 machine is usually on a completely different network than the
514 host. As more than one card of a virtual machine can be set up to
515 use NAT, the first card is connected to the private network
516 10.0.2.0, the second card to the network 10.0.3.0 and so on. If
517 you need to change the guest-assigned IP range, see
518 <xref linkend="changenat" />.
519 </para>
520
521 <sect2 id="natforward">
522
523 <title>Configuring Port Forwarding with NAT</title>
524
525 <para>
526 As the virtual machine is connected to a private network
527 internal to &product-name; and invisible to the host, network
528 services on the guest are not accessible to the host machine or
529 to other computers on the same network. However, like a physical
530 router, &product-name; can make selected services available to
531 the world outside the guest through <emphasis>port
532 forwarding</emphasis>. This means that &product-name; listens to
533 certain ports on the host and resends all packets which arrive
534 there to the guest, on the same or a different port.
535 </para>
536
537 <para>
538 To an application on the host or other physical or virtual
539 machines on the network, it looks as though the service being
540 proxied is actually running on the host. This also means that
541 you cannot run the same service on the same ports on the host.
542 However, you still gain the advantages of running the service in
543 a virtual machine. For example, services on the host machine or
544 on other virtual machines cannot be compromised or crashed by a
545 vulnerability or a bug in the service, and the service can run
546 in a different operating system than the host system.
547 </para>
548
549 <para>
550 To configure port forwarding you can use the graphical
551 <emphasis role="bold">Port Forwarding</emphasis> editor which
552 can be found in the <emphasis role="bold">Network
553 Settings</emphasis> dialog for network adaptors configured to
554 use NAT. Here, you can map host ports to guest ports to allow
555 network traffic to be routed to a specific port in the guest.
556 </para>
557
558 <para>
559 Alternatively, the command line tool
560 <command>VBoxManage</command> can be used. See
561 <xref linkend="vboxmanage-modifyvm" />.
562 </para>
563
564 <para>
565 You will need to know which ports on the guest the service uses
566 and to decide which ports to use on the host. You may want to
567 use the same ports on the guest and on the host. You can use any
568 ports on the host which are not already in use by a service. For
569 example, to set up incoming NAT connections to an
570 <command>ssh</command> server in the guest, use the following
571 command:
572 </para>
573
574<screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"</screen>
575
576 <para>
577 In the above example, all TCP traffic arriving on port 2222 on
578 any host interface will be forwarded to port 22 in the guest.
579 The protocol name <literal>tcp</literal> is a mandatory
580 attribute defining which protocol should be used for forwarding,
581 <literal>udp</literal> could also be used. The name
582 <literal>guestssh</literal> is purely descriptive and will be
583 auto-generated if omitted. The number after
584 <option>--nat-pf</option> denotes the network card, as with other
585 <command>VBoxManage</command> commands.
586 </para>
587
588 <para>
589 To remove this forwarding rule, use the following command:
590 </para>
591
592<screen>VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"</screen>
593
594 <para>
595 If for some reason the guest uses a static assigned IP address
596 not leased from the built-in DHCP server, it is required to
597 specify the guest IP when registering the forwarding rule, as
598 follows:
599 </para>
600
601<screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.19,22"</screen>
602
603 <para>
604 This example is identical to the previous one, except that the
605 NAT engine is being told that the guest can be found at the
606 10.0.2.19 address.
607 </para>
608
609 <para>
610 To forward <emphasis>all</emphasis> incoming traffic from a
611 specific host interface to the guest, specify the IP of that
612 host interface as follows:
613 </para>
614
615<screen>VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"</screen>
616
617 <para>
618 This example forwards all TCP traffic arriving on the localhost
619 interface at 127.0.0.1 through port 2222 to port 22 in the
620 guest.
621 </para>
622
623 <para>
624 It is possible to configure incoming NAT connections while the
625 VM is running, see <xref linkend="vboxmanage-controlvm"/>.
626 </para>
627
628 </sect2>
629
630 <sect2 id="nat-tftp">
631
632 <title>PXE Booting with NAT</title>
633
634 <para>
635 PXE booting is now supported in NAT mode. The NAT DHCP server
636 provides a boot file name of the form
637 <filename><replaceable>vmname</replaceable>.pxe</filename> if
638 the directory <literal>TFTP</literal> exists in the directory
639 where the user's <filename>VirtualBox.xml</filename> file is
640 kept. It is the responsibility of the user to provide
641 <filename><replaceable>vmname</replaceable>.pxe</filename>.
642 </para>
643
644 </sect2>
645
646 <sect2 id="nat-limitations">
647
648 <title>NAT Limitations</title>
649
650 <para>
651 There are some limitations of NAT mode which users should be
652 aware of, as follows:
653 </para>
654
655 <itemizedlist>
656
657 <listitem>
658 <para>
659 <emphasis role="bold">ICMP protocol limitations.</emphasis>
660 Some frequently used network debugging tools, such as
661 <command>ping</command> or <command>traceroute</command>,
662 rely on the ICMP protocol for sending and receiving
663 messages. &product-name; ICMP support has some limitations,
664 meaning <command>ping</command> should work but some other
665 tools may not work reliably.
666 </para>
667 </listitem>
668
669 <listitem>
670 <para>
671 <emphasis role="bold">Receiving of UDP
672 broadcasts.</emphasis> The guest does not reliably receive
673 UDP broadcasts. In order to save resources, it only listens
674 for a certain amount of time after the guest has sent UDP
675 data on a particular port. As a consequence, NetBios name
676 resolution based on broadcasts does not always work, but
677 WINS always works. As a workaround, you can use the numeric
678 IP of the desired server in the
679 <filename>\\<replaceable>server</replaceable>\<replaceable>share</replaceable></filename>
680 notation.
681 </para>
682 </listitem>
683
684 <listitem>
685 <para>
686 <emphasis role="bold">Some protocols are not
687 supported.</emphasis> Protocols other than TCP and UDP are
688 not supported. GRE is not supported. This means some VPN
689 products, such as PPTP from Microsoft, cannot be used. There
690 are other VPN products which use only TCP and UDP.
691 </para>
692 </listitem>
693
694 <listitem>
695 <para>
696 <emphasis role="bold">Forwarding host ports below
697 1024.</emphasis> On UNIX-based hosts, such as Linux, Oracle
698 Solaris, and Mac OS X, it is not possible to bind to ports
699 below 1024 from applications that are not run by
700 <literal>root</literal>. As a result, if you try to
701 configure such a port forwarding, the VM will refuse to
702 start.
703 </para>
704 </listitem>
705
706 </itemizedlist>
707
708 <para>
709 These limitations normally do not affect standard network use.
710 But the presence of NAT has also subtle effects that may
711 interfere with protocols that are normally working. One example
712 is NFS, where the server is often configured to refuse
713 connections from non-privileged ports, which are those ports not
714 below 1024.
715 </para>
716
717 </sect2>
718
719 </sect1>
720
721 <sect1 id="network_nat_service">
722
723 <title>Network Address Translation Service</title>
724
725 <para>
726 The Network Address Translation (NAT) service works in a similar
727 way to a home router, grouping the systems using it into a network
728 and preventing systems outside of this network from directly
729 accessing systems inside it, but letting systems inside
730 communicate with each other and with systems outside using TCP and
731 UDP over IPv4 and IPv6.
732 </para>
733
734 <para>
735 A NAT service is attached to an internal network. Virtual machines
736 which are to make use of it should be attached to that internal
737 network. The name of internal network is chosen when the NAT
738 service is created and the internal network will be created if it
739 does not already exist. The following is an example command to
740 create a NAT network:
741 </para>
742
743<screen>VBoxManage natnetwork add --netname natnet1 --network "192.168.15.0/24" --enable</screen>
744
745 <para>
746 Here, natnet1 is the name of the internal network to be used and
747 192.168.15.0/24 is the network address and mask of the NAT service
748 interface. By default in this static configuration the gateway
749 will be assigned the address 192.168.15.1, the address following
750 the interface address, though this is subject to change. To attach
751 a DHCP server to the internal network, modify the example command
752 as follows:
753 </para>
754
755<screen>VBoxManage natnetwork add --netname natnet1 --network "192.168.15.0/24" --enable --dhcp on</screen>
756
757 <para>
758 To add a DHCP server to an existing network, use the following
759 command:
760 </para>
761
762<screen>VBoxManage natnetwork modify --netname natnet1 --dhcp on</screen>
763
764 <para>
765 To disable the DHCP server, use the following command:
766 </para>
767
768<screen>VBoxManage natnetwork modify --netname natnet1 --dhcp off</screen>
769
770 <para>
771 A DHCP server provides a list of registered nameservers, but does
772 not map servers from the 127/8 network.
773 </para>
774
775 <para>
776 To start the NAT service, use the following command:
777 </para>
778
779<screen>VBoxManage natnetwork start --netname natnet1</screen>
780
781 <para>
782 If the network has a DHCP server attached then it will start
783 together with the NAT network service.
784 </para>
785
786 <para>
787 To stop the NAT network service, together with any DHCP server:
788 </para>
789
790<screen>VBoxManage natnetwork stop --netname natnet1</screen>
791
792 <para>
793 To delete the NAT network service:
794 </para>
795
796<screen>VBoxManage natnetwork remove --netname natnet1</screen>
797
798 <para>
799 This command does not remove the DHCP server if one is enabled on
800 the internal network.
801 </para>
802
803 <para>
804 Port-forwarding is supported, using the
805 <option>--port-forward-4</option> switch for IPv4 and
806 <option>--port-forward-6</option> for IPv6. For example:
807 </para>
808
809<screen>VBoxManage natnetwork modify \
810 --netname natnet1 --port-forward-4 "ssh:tcp:[]:1022:[192.168.15.5]:22"</screen>
811
812 <para>
813 This adds a port-forwarding rule from the host's TCP 1022 port to
814 the port 22 on the guest with IP address 192.168.15.5. Host port,
815 guest port and guest IP are mandatory. To delete the rule, use the
816 following command:
817 </para>
818
819<screen>VBoxManage natnetwork modify --netname natnet1 --port-forward-4 delete ssh</screen>
820
821 <para>
822 It is possible to bind a NAT service to specified interface. For
823 example:
824 </para>
825
826<screen>VBoxManage setextradata global "NAT/win-nat-test-0/SourceIp4" 192.168.1.185</screen>
827
828 <para>
829 To see the list of registered NAT networks, use the following
830 command:
831 </para>
832
833<screen>VBoxManage list natnetworks</screen>
834
835 <para>
836 NAT networks can also be created, deleted, and configured using
837 the VirtualBox Manager. Click
838 <emphasis role="bold">File</emphasis>,<emphasis role="bold">
839 Preferences</emphasis> and select the
840 <emphasis role="bold">Network</emphasis> page.
841 </para>
842
843 <note>
844 <para>
845 Even though the NAT service separates the VM from the host, the
846 VM has access to the host's loopback interface and the network
847 services running on it. The host's loopback interface is
848 accessible as IP address 10.0.2.2 (assuming the default
849 configuration, in other configurations it's the respective
850 address in the configured IPv4 or IPv6 network range). This
851 access to the host's loopback interface can be extremely useful
852 in some cases, for example when running a web application under
853 development in the VM and the database server on the loopback
854 interface on the host.
855 </para>
856 </note>
857
858 </sect1>
859
860 <sect1 id="network_bridged">
861
862 <title>Bridged Networking</title>
863
864 <para>
865 With bridged networking, &product-name; uses a device driver on
866 your <emphasis>host</emphasis> system that filters data from your
867 physical network adapter. This driver is therefore called a
868 <emphasis>net filter</emphasis> driver. This enables
869 &product-name; to intercept data from the physical network and
870 inject data into it, effectively creating a new network interface
871 in software. When a guest is using such a new software interface,
872 it looks to the host system as though the guest were physically
873 connected to the interface using a network cable. The host can
874 send data to the guest through that interface and receive data
875 from it. This means that you can set up routing or bridging
876 between the guest and the rest of your network.
877 </para>
878
879 <note>
880 <para>
881 Even though TAP interfaces are no longer necessary on Linux for
882 bridged networking, you <emphasis>can</emphasis> still use TAP
883 interfaces for certain advanced setups, since you can connect a
884 VM to any host interface.
885 </para>
886 </note>
887
888 <para>
889 To enable bridged networking, open the
890 <emphasis role="bold">Settings</emphasis> dialog of a virtual
891 machine, go to the <emphasis role="bold">Network</emphasis> page
892 and select <emphasis role="bold">Bridged Network</emphasis> in the
893 drop-down list for the <emphasis role="bold">Attached
894 To</emphasis> field. Select a host interface from the list at the
895 bottom of the page, which contains the physical network interfaces
896 of your systems. On a typical MacBook, for example, this will
897 allow you to select between en1: AirPort, which is the wireless
898 interface, and en0: Ethernet, which represents the interface with
899 a network cable.
900 </para>
901
902 <note>
903 <para>
904 Bridging to a wireless interface is done differently from
905 bridging to a wired interface, because most wireless adapters do
906 not support promiscuous mode. All traffic has to use the MAC
907 address of the host's wireless adapter, and therefore
908 &product-name; needs to replace the source MAC address in the
909 Ethernet header of an outgoing packet to make sure the reply
910 will be sent to the host interface. When &product-name; sees an
911 incoming packet with a destination IP address that belongs to
912 one of the virtual machine adapters it replaces the destination
913 MAC address in the Ethernet header with the VM adapter's MAC
914 address and passes it on. &product-name; examines ARP and DHCP
915 packets in order to learn the IP addresses of virtual machines.
916 </para>
917 </note>
918
919 <para>
920 Depending on your host operating system, the following limitations
921 apply:
922 </para>
923
924 <itemizedlist>
925
926 <listitem>
927 <para>
928 <emphasis role="bold">Mac OS X hosts.</emphasis> Functionality
929 is limited when using AirPort, the Mac's wireless networking
930 system, for bridged networking. Currently, &product-name;
931 supports only IPv4 and IPv6 over AirPort. For other protocols,
932 such as IPX, you must choose a wired interface.
933 </para>
934 </listitem>
935
936 <listitem>
937 <para>
938 <emphasis role="bold">Linux hosts.</emphasis> Functionality is
939 limited when using wireless interfaces for bridged networking.
940 Currently, &product-name; supports only IPv4 and IPv6 over
941 wireless. For other protocols, such as IPX, you must choose a
942 wired interface.
943 </para>
944
945 <para>
946 Also, setting the MTU to less than 1500 bytes on wired
947 interfaces provided by the sky2 driver on the Marvell Yukon II
948 EC Ultra Ethernet NIC is known to cause packet losses under
949 certain conditions.
950 </para>
951
952 <para>
953 Some adapters strip VLAN tags in hardware. This does not allow
954 you to use VLAN trunking between VM and the external network
955 with pre-2.6.27 Linux kernels, or with host operating systems
956 other than Linux.
957 </para>
958 </listitem>
959
960 <listitem>
961 <para>
962 <emphasis role="bold">Oracle Solaris hosts.</emphasis> There
963 is no support for using wireless interfaces. Filtering guest
964 traffic using IPFilter is also not completely supported due to
965 technical restrictions of the Oracle Solaris networking
966 subsystem. These issues may be addressed in later releases of
967 Oracle Solaris 11.
968 </para>
969
970 <para>
971 On Oracle Solaris 11 hosts build 159 and above, it is possible
972 to use Oracle Solaris Crossbow Virtual Network Interfaces
973 (VNICs) directly with &product-name; without any additional
974 configuration other than each VNIC must be exclusive for every
975 guest network interface.
976 </para>
977
978 <para>
979 When using VLAN interfaces with &product-name;, they must be
980 named according to the PPA-hack naming scheme, such as
981 e1000g513001. Otherwise, the guest may receive packets in an
982 unexpected format.
983 </para>
984 </listitem>
985
986 </itemizedlist>
987
988 </sect1>
989
990 <sect1 id="network_internal">
991
992 <title>Internal Networking</title>
993
994 <para>
995 Internal Networking is similar to bridged networking in that the
996 VM can directly communicate with the outside world. However, the
997 outside world is limited to other VMs on the same host which
998 connect to the same internal network.
999 </para>
1000
1001 <para>
1002 Even though technically, everything that can be done using
1003 internal networking can also be done using bridged networking,
1004 there are security advantages with internal networking. In bridged
1005 networking mode, all traffic goes through a physical interface of
1006 the host system. It is therefore possible to attach a packet
1007 sniffer such as Wireshark to the host interface and log all
1008 traffic that goes over it. If, for any reason, you prefer two or
1009 more VMs on the same machine to communicate privately, hiding
1010 their data from both the host system and the user, bridged
1011 networking therefore is not an option.
1012 </para>
1013
1014 <para>
1015 Internal networks are created automatically as needed. There is no
1016 central configuration. Every internal network is identified simply
1017 by its name. Once there is more than one active virtual network
1018 card with the same internal network ID, the &product-name; support
1019 driver will automatically <emphasis>wire</emphasis> the cards and
1020 act as a network switch. The &product-name; support driver
1021 implements a complete Ethernet switch and supports both
1022 broadcast/multicast frames and promiscuous mode.
1023 </para>
1024
1025 <para>
1026 In order to attach a VM's network card to an internal network, set
1027 its networking mode to Internal Networking. There are two ways to
1028 accomplish this:
1029 </para>
1030
1031 <itemizedlist>
1032
1033 <listitem>
1034 <para>
1035 Use the VM's <emphasis role="bold">Settings</emphasis> dialog
1036 in the VirtualBox Manager. In the
1037 <emphasis role="bold">Network</emphasis> category of the
1038 settings dialog, select <emphasis role="bold">Internal
1039 Network</emphasis> from the drop-down list of networking
1040 modes. Select the name of an existing internal network from
1041 the drop-down list below, or enter a new name into the
1042 <emphasis role="bold">Name</emphasis> field.
1043 </para>
1044 </listitem>
1045
1046 <listitem>
1047 <para>
1048 Use the command line, for example:
1049 </para>
1050
1051<screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; intnet</screen>
1052
1053 <para>
1054 Optionally, you can specify a network name with the command:
1055 </para>
1056
1057<screen>VBoxManage modifyvm "VM name" --intnet&lt;x&gt; "network name"</screen>
1058
1059 <para>
1060 If you do not specify a network name, the network card will be
1061 attached to the network <literal>intnet</literal> by default.
1062 </para>
1063 </listitem>
1064
1065 </itemizedlist>
1066
1067 <para>
1068 Unless you configure the virtual network cards in the guest
1069 operating systems that are participating in the internal network
1070 to use static IP addresses, you may want to use the DHCP server
1071 that is built into &product-name; to manage IP addresses for the
1072 internal network. See <xref linkend="vboxmanage-dhcpserver" />.
1073 </para>
1074
1075 <para>
1076 As a security measure, by default, the Linux implementation of
1077 internal networking only allows VMs running under the same user ID
1078 to establish an internal network. However, it is possible to
1079 create a shared internal networking interface, accessible by users
1080 with different user IDs.
1081 </para>
1082
1083 </sect1>
1084
1085 <sect1 id="network_hostonly">
1086
1087 <title>Host-Only Networking</title>
1088
1089 <para>
1090 Host-only networking can be thought of as a hybrid between the
1091 bridged and internal networking modes. As with bridged networking,
1092 the virtual machines can talk to each other and the host as if
1093 they were connected through a physical Ethernet switch. As with
1094 internal networking, a physical networking interface need not be
1095 present, and the virtual machines cannot talk to the world outside
1096 the host since they are not connected to a physical networking
1097 interface.
1098 </para>
1099
1100 <para>
1101 When host-only networking is used, &product-name; creates a new
1102 software interface on the host which then appears next to your
1103 existing network interfaces. In other words, whereas with bridged
1104 networking an existing physical interface is used to attach
1105 virtual machines to, with host-only networking a new
1106 <emphasis>loopback</emphasis> interface is created on the host.
1107 And whereas with internal networking, the traffic between the
1108 virtual machines cannot be seen, the traffic on the loopback
1109 interface on the host can be intercepted.
1110 </para>
1111
1112 <note>
1113 <para>
1114 Hosts running recent Mac OS X versions do not support host-only
1115 adapters. These adapters are replaced by host-only networks,
1116 which definine a network mask and an IP address range, where the
1117 host network interface receives the lowest address in the range.
1118 </para>
1119 <para>
1120 The host network interface gets added and removed dynamically
1121 by the operating system, whenever a host-only network is used
1122 by virtual machines.
1123 </para>
1124 </note>
1125
1126 <para>
1127 Host-only networking is particularly useful for preconfigured
1128 virtual appliances, where multiple virtual machines are shipped
1129 together and designed to cooperate. For example, one virtual
1130 machine may contain a web server and a second one a database, and
1131 since they are intended to talk to each other, the appliance can
1132 instruct &product-name; to set up a host-only network for the two.
1133 A second, bridged, network would then connect the web server to
1134 the outside world to serve data to, but the outside world cannot
1135 connect to the database.
1136 </para>
1137
1138 <para>
1139 To enable a host-only network interface for a virtual machine, do
1140 either of the following:
1141 </para>
1142
1143 <itemizedlist>
1144
1145 <listitem>
1146 <para>
1147 Go to the <emphasis role="bold">Network</emphasis> page in the
1148 virtual machine's <emphasis role="bold">Settings</emphasis>
1149 dialog and select an <emphasis role="bold">Adapter</emphasis>
1150 tab. Ensure that the <emphasis role="bold">Enable Network
1151 Adapter</emphasis> check box is selected and choose
1152 <emphasis role="bold">Host-Only Adapter</emphasis> for the
1153 <emphasis role="bold">Attached To</emphasis> field.
1154 </para>
1155 </listitem>
1156
1157 <listitem>
1158 <para>
1159 On the command line, use <command>VBoxManage modifyvm
1160 <replaceable>"vmname</replaceable>
1161 --nic<replaceable>x</replaceable> hostonly</command>. See
1162 <xref linkend="vboxmanage-modifyvm" />.
1163 </para>
1164 </listitem>
1165
1166 </itemizedlist>
1167
1168 <para>
1169 For host-only networking, as with internal networking, you may
1170 find the DHCP server useful that is built into &product-name;.
1171 This is enabled by default and manages the IP addresses in the
1172 host-only network. Without the DHCP server you would need to
1173 configure all IP addresses statically.
1174 </para>
1175
1176 <itemizedlist>
1177
1178 <listitem>
1179 <para>
1180 In the VirtualBox Manager you can configure the DHCP server by
1181 choosing <emphasis role="bold">File</emphasis>,
1182 <emphasis role="bold">Host Network Manager</emphasis>. The
1183 Host Network Manager lists all host-only networks which are
1184 presently in use. Select the network name and then use the
1185 <emphasis role="bold">DHCP Server</emphasis> tab to configure
1186 DHCP server settings.
1187 </para>
1188 </listitem>
1189
1190 <listitem>
1191 <para>
1192 Alternatively, you can use the <command>VBoxManage
1193 dhcpserver</command> command. See
1194 <xref linkend="vboxmanage-dhcpserver" />.
1195 </para>
1196 </listitem>
1197
1198 </itemizedlist>
1199
1200 <note>
1201 <para>
1202 On Linux and Mac OS X hosts the number of host-only interfaces
1203 is limited to 128. There is no such limit for Oracle Solaris and
1204 Windows hosts.
1205 </para>
1206 </note>
1207
1208 <para>
1209 On Linux, Mac OS X and Solaris &product-name; will only allow IP
1210 addresses in 192.168.56.0/21 range to be assigned to host-only
1211 adapters. For IPv6 only link-local addresses are allowed. If other
1212 ranges are desired, they can be enabled by creating
1213 <filename>/etc/vbox/networks.conf</filename> and specifying allowed
1214 ranges there. For example, to allow 10.0.0.0/8 and 192.168.0.0/16
1215 IPv4 ranges as well as 2001::/64 range put the following lines into
1216 <filename>/etc/vbox/networks.conf</filename>:
1217 <screen>
1218 * 10.0.0.0/8 192.168.0.0/16
1219 * 2001::/64
1220 </screen>
1221 Lines starting with the hash <command>#</command> are ignored. Next
1222 example allows any addresses, effectively disabling range control:
1223 <screen>
1224 * 0.0.0.0/0 ::/0
1225 </screen>
1226 If the file exists, but no ranges are specified in it, no addresses
1227 will be assigned to host-only adapters. The following example
1228 effectively disables all ranges:
1229 <screen>
1230 # No addresses are allowed for host-only adapters
1231 </screen>
1232 </para>
1233
1234 </sect1>
1235
1236 <sect1 id="network_udp_tunnel">
1237
1238 <title>UDP Tunnel Networking</title>
1239
1240 <para>
1241 This networking mode enables you to interconnect virtual machines
1242 running on different hosts.
1243 </para>
1244
1245 <para>
1246 Technically this is done by encapsulating Ethernet frames sent or
1247 received by the guest network card into UDP/IP datagrams, and
1248 sending them over any network available to the host.
1249 </para>
1250
1251 <para>
1252 UDP Tunnel mode has the following parameters:
1253 </para>
1254
1255 <itemizedlist>
1256
1257 <listitem>
1258 <para>
1259 <emphasis role="bold">Source UDP port:</emphasis> The port on
1260 which the host listens. Datagrams arriving on this port from
1261 any source address will be forwarded to the receiving part of
1262 the guest network card.
1263 </para>
1264 </listitem>
1265
1266 <listitem>
1267 <para>
1268 <emphasis role="bold">Destination address:</emphasis> IP
1269 address of the target host of the transmitted data.
1270 </para>
1271 </listitem>
1272
1273 <listitem>
1274 <para>
1275 <emphasis role="bold">Destination UDP port:</emphasis> Port
1276 number to which the transmitted data is sent.
1277 </para>
1278 </listitem>
1279
1280 </itemizedlist>
1281
1282 <para>
1283 When interconnecting two virtual machines on two different hosts,
1284 their IP addresses must be swapped. On a single host, source and
1285 destination UDP ports must be swapped.
1286 </para>
1287
1288 <para>
1289 In the following example, host 1 uses the IP address 10.0.0.1 and
1290 host 2 uses IP address 10.0.0.2. To configure using the
1291 command-line:
1292 </para>
1293
1294<screen> VBoxManage modifyvm "VM 01 on host 1" --nic&lt;x&gt; generic
1295 VBoxManage modifyvm "VM 01 on host 1" --nic-generic-drv&lt;x&gt; UDPTunnel
1296 VBoxManage modifyvm "VM 01 on host 1" --nic-property&lt;x&gt; dest=10.0.0.2
1297 VBoxManage modifyvm "VM 01 on host 1" --nic-property&lt;x&gt; sport=10001
1298 VBoxManage modifyvm "VM 01 on host 1" --nic-property&lt;x&gt; dport=10002</screen>
1299
1300<screen> VBoxManage modifyvm "VM 02 on host 2" --nic&lt;y&gt; generic
1301 VBoxManage modifyvm "VM 02 on host 2" --nic-generic-drv&lt;y&gt; UDPTunnel
1302 VBoxManage modifyvm "VM 02 on host 2" --nic-property&lt;y&gt; dest=10.0.0.1
1303 VBoxManage modifyvm "VM 02 on host 2" --nic-property&lt;y&gt; sport=10002
1304 VBoxManage modifyvm "VM 02 on host 2" --nic-property&lt;y&gt; dport=10001</screen>
1305
1306 <para>
1307 Of course, you can always interconnect two virtual machines on the
1308 same host, by setting the destination address parameter to
1309 127.0.0.1 on both. It will act similarly to an internal network in
1310 this case. However, the host can see the network traffic which it
1311 could not in the normal internal network case.
1312 </para>
1313
1314 <note>
1315 <para>
1316 On UNIX-based hosts, such as Linux, Oracle Solaris, and Mac OS
1317 X, it is not possible to bind to ports below 1024 from
1318 applications that are not run by <literal>root</literal>. As a
1319 result, if you try to configure such a source UDP port, the VM
1320 will refuse to start.
1321 </para>
1322 </note>
1323
1324 </sect1>
1325
1326 <sect1 id="network_vde">
1327
1328 <title>VDE Networking</title>
1329
1330 <para>
1331 Virtual Distributed Ethernet (VDE) is a flexible, virtual network
1332 infrastructure system, spanning across multiple hosts in a secure
1333 way. It enables L2/L3 switching, including spanning-tree protocol,
1334 VLANs, and WAN emulation. It is an optional part of &product-name;
1335 which is only included in the source code.
1336 </para>
1337
1338 <para>
1339 VDE is a project developed by Renzo Davoli, Associate Professor at
1340 the University of Bologna, Italy.
1341 </para>
1342
1343 <para>
1344 The basic building blocks of the infrastructure are VDE switches,
1345 VDE plugs, and VDE wires which interconnect the switches.
1346 </para>
1347
1348 <para>
1349 The &product-name; VDE driver has a single parameter: VDE network.
1350 This is the name of the VDE network switch socket to which the VM
1351 will be connected.
1352 </para>
1353
1354 <para>
1355 The following basic example shows how to connect a virtual machine
1356 to a VDE switch.
1357 </para>
1358
1359 <orderedlist>
1360
1361 <listitem>
1362 <para>
1363 Create a VDE switch:
1364 </para>
1365
1366<screen>vde_switch -s /tmp/switch1</screen>
1367 </listitem>
1368
1369 <listitem>
1370 <para>
1371 Configure VMs using the command-line:
1372 </para>
1373
1374<screen>VBoxManage modifyvm "VM name" --nic&lt;x&gt; generic</screen>
1375
1376<screen>VBoxManage modifyvm "VM name" --nic-generic-drv&lt;x&gt; VDE</screen>
1377
1378 <para>
1379 To connect to an automatically allocated switch port:
1380 </para>
1381
1382<screen>VBoxManage modifyvm "VM name" --nic-property&lt;x&gt; network=/tmp/switch1</screen>
1383
1384 <para>
1385 To connect to a specific switch port
1386 <replaceable>n</replaceable>:
1387 </para>
1388
1389<screen>VBoxManage modifyvm "VM name" --nic-property&lt;x&gt; network=/tmp/switch1[&lt;n&gt;]</screen>
1390
1391 <para>
1392 This command can be useful for VLANs.
1393 </para>
1394 </listitem>
1395
1396 <listitem>
1397 <para>
1398 (Optional) Map between a VDE switch port and a VLAN.
1399 </para>
1400
1401 <para>
1402 Using the switch command line:
1403 </para>
1404
1405<screen>vde$ vlan/create &lt;VLAN&gt;</screen>
1406
1407<screen>vde$ port/setvlan &lt;port&gt; &lt;VLAN&gt;</screen>
1408 </listitem>
1409
1410 </orderedlist>
1411
1412 <para>
1413 VDE is available on Linux and FreeBSD hosts only. It is only
1414 available if the VDE software and the VDE plugin library from the
1415 VirtualSquare project are installed on the host system.
1416 </para>
1417
1418 <note>
1419 <para>
1420 For Linux hosts, the shared library libvdeplug.so must be
1421 available in the search path for shared libraries.
1422 </para>
1423 </note>
1424
1425 <para>
1426 For more information on setting up VDE networks, please see the
1427 documentation accompanying the software. See also
1428 <ulink url="http://wiki.virtualsquare.org" />.
1429 </para>
1430
1431 </sect1>
1432
1433 <sect1 id="network_bandwidth_limit">
1434
1435 <title>Limiting Bandwidth for Network Input/Output</title>
1436
1437 <para>
1438 &product-name; supports limiting of the maximum bandwidth used for
1439 network transmission. Several network adapters of one VM may share
1440 limits through bandwidth groups. It is possible to have more than
1441 one such limit.
1442 </para>
1443
1444 <note>
1445 <para>
1446 &product-name; shapes VM traffic only in the transmit direction,
1447 delaying the packets being sent by virtual machines. It does not
1448 limit the traffic being received by virtual machines.
1449 </para>
1450 </note>
1451
1452 <para>
1453 Limits are configured through <command>VBoxManage</command>. The
1454 following example creates a bandwidth group named Limit, sets the
1455 limit to 20 Mbps and assigns the group to the first and second
1456 adapters of the VM:
1457 </para>
1458
1459<screen>VBoxManage bandwidthctl "VM name" add Limit --type network --limit 20m
1460VBoxManage modifyvm "VM name" --nicbandwidthgroup1 Limit
1461VBoxManage modifyvm "VM name" --nicbandwidthgroup2 Limit</screen>
1462
1463 <para>
1464 All adapters in a group share the bandwidth limit, meaning that in
1465 the example above the bandwidth of both adapters combined can
1466 never exceed 20 Mbps. However, if one adapter does not require
1467 bandwidth the other can use the remaining bandwidth of its group.
1468 </para>
1469
1470 <para>
1471 The limits for each group can be changed while the VM is running,
1472 with changes being picked up immediately. The following example
1473 changes the limit for the group created in the previous example to
1474 100 Kbps:
1475 </para>
1476
1477<screen>VBoxManage bandwidthctl "VM name" set Limit --limit 100k</screen>
1478
1479 <para>
1480 To completely disable shaping for the first adapter of VM use the
1481 following command:
1482 </para>
1483
1484<screen>VBoxManage modifyvm "VM name" --nicbandwidthgroup1 none</screen>
1485
1486 <para>
1487 It is also possible to disable shaping for all adapters assigned
1488 to a bandwidth group while VM is running, by specifying the zero
1489 limit for the group. For example, for the bandwidth group named
1490 Limit:
1491 </para>
1492
1493<screen>VBoxManage bandwidthctl "VM name" set Limit --limit 0</screen>
1494
1495 </sect1>
1496
1497 <sect1 id="network_performance">
1498
1499 <title>Improving Network Performance</title>
1500
1501 <para>
1502 &product-name; provides a variety of virtual network adapters that
1503 can be attached to the host's network in a number of ways.
1504 Depending on which types of adapters and attachments are used the
1505 network performance will be different. Performance-wise the virtio
1506 network adapter is preferable over Intel PRO/1000 emulated
1507 adapters, which are preferred over the PCNet family of adapters.
1508 Both virtio and Intel PRO/1000 adapters enjoy the benefit of
1509 segmentation and checksum offloading. Segmentation offloading is
1510 essential for high performance as it allows for less context
1511 switches, dramatically increasing the sizes of packets that cross
1512 the VM/host boundary.
1513 </para>
1514
1515 <note>
1516 <para>
1517 Neither virtio nor Intel PRO/1000 drivers for Windows XP support
1518 segmentation offloading. Therefore Windows XP guests never reach
1519 the same transmission rates as other guest types. Refer to MS
1520 Knowledge base article 842264 for additional information.
1521 </para>
1522 </note>
1523
1524 <para>
1525 Three attachment types: Internal, Bridged, and Host-Only, have
1526 nearly identical performance. The Internal type is a little bit
1527 faster and uses less CPU cycles as the packets never reach the
1528 host's network stack. The NAT attachment type is the slowest and
1529 most secure of all attachment types, as it provides network
1530 address translation. The generic driver attachment is special and
1531 cannot be considered as an alternative to other attachment types.
1532 </para>
1533
1534 <para>
1535 The number of CPUs assigned to VM does not improve network
1536 performance and in some cases may hurt it due to increased
1537 concurrency in the guest.
1538 </para>
1539
1540 <para>
1541 Here is a short summary of things to check in order to improve
1542 network performance:
1543 </para>
1544
1545 <itemizedlist>
1546
1547 <listitem>
1548 <para>
1549 Whenever possible use the virtio network adapter. Otherwise,
1550 use one of the Intel PRO/1000 adapters.
1551 </para>
1552 </listitem>
1553
1554 <listitem>
1555 <para>
1556 Use a Bridged attachment instead of NAT.
1557 </para>
1558 </listitem>
1559
1560 <listitem>
1561 <para>
1562 Make sure segmentation offloading is enabled in the guest OS.
1563 Usually it will be enabled by default. You can check and
1564 modify offloading settings using the
1565 <command>ethtool</command> command on Linux guests.
1566 </para>
1567 </listitem>
1568
1569 <listitem>
1570 <para>
1571 Perform a full detailed analysis of network traffic on the
1572 VM's network adaptor using a third party tool such as
1573 Wireshark. To do this, a promiscuous mode policy needs to be
1574 used on the VM's network adaptor. Use of this mode is only
1575 possible on the following network types: NAT Network, Bridged
1576 Adapter, Internal Network, and Host-Only Adapter.
1577 </para>
1578
1579 <para>
1580 To setup a promiscuous mode policy, either select from the
1581 drop down list located in the <emphasis role="bold">Network
1582 Settings</emphasis> dialog for the network adaptor or use the
1583 command line tool <command>VBoxManage</command>. See
1584 <xref linkend="vboxmanage-modifyvm" />.
1585 </para>
1586
1587 <para>
1588 Promiscuous mode policies are as follows:
1589 </para>
1590
1591 <itemizedlist>
1592
1593 <listitem>
1594 <para>
1595 <literal>deny</literal>, which hides any traffic not
1596 intended for the VM's network adaptor. This is the default
1597 setting.
1598 </para>
1599 </listitem>
1600
1601 <listitem>
1602 <para>
1603 <literal>allow-vms</literal>, which hides all host traffic
1604 from the VM's network adaptor, but allows it to see
1605 traffic from and to other VMs.
1606 </para>
1607 </listitem>
1608
1609 <listitem>
1610 <para>
1611 <literal>allow-all</literal>, which removes all
1612 restrictions. The VM's network adaptor sees all traffic.
1613 </para>
1614 </listitem>
1615
1616 </itemizedlist>
1617 </listitem>
1618
1619 </itemizedlist>
1620
1621 </sect1>
1622
1623</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