1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
2 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
3 | <topic xml:lang="en-us" id="network_hostonly">
|
---|
4 | <title>Host-Only Networking</title>
|
---|
5 |
|
---|
6 | <body>
|
---|
7 | <p>
|
---|
8 | Host-only networking can be thought of as a hybrid between the
|
---|
9 | bridged and internal networking modes. As with bridged networking,
|
---|
10 | the virtual machines can talk to each other and the host as if
|
---|
11 | they were connected through a physical Ethernet switch. As with
|
---|
12 | internal networking, a physical networking interface need not be
|
---|
13 | present, and the virtual machines cannot talk to the world outside
|
---|
14 | the host since they are not connected to a physical networking
|
---|
15 | interface.
|
---|
16 | </p>
|
---|
17 | <p>
|
---|
18 | When host-only networking is used, <ph conkeyref="vbox-conkeyref-phrases/product-name"/> creates a new
|
---|
19 | software interface on the host which then appears next to your
|
---|
20 | existing network interfaces. In other words, whereas with bridged
|
---|
21 | networking an existing physical interface is used to attach
|
---|
22 | virtual machines to, with host-only networking a new
|
---|
23 | <i>loopback</i> interface is created on the host.
|
---|
24 | And whereas with internal networking, the traffic between the
|
---|
25 | virtual machines cannot be seen, the traffic on the loopback
|
---|
26 | interface on the host can be intercepted.
|
---|
27 | </p>
|
---|
28 | <note>
|
---|
29 | <p>
|
---|
30 | Hosts running recent macOS versions do not support host-only
|
---|
31 | adapters. These adapters are replaced by host-only networks,
|
---|
32 | which define a network mask and an IP address range, where the
|
---|
33 | host network interface receives the lowest address in the range.
|
---|
34 | </p>
|
---|
35 | <p>
|
---|
36 | The host network interface gets added and removed dynamically by
|
---|
37 | the operating system, whenever a host-only network is used by
|
---|
38 | virtual machines.
|
---|
39 | </p>
|
---|
40 | <p>
|
---|
41 | On macOS hosts, choose the <b outputclass="bold">Host-Only
|
---|
42 | Network</b> option when configuring a network adapter.
|
---|
43 | The <b outputclass="bold">Host-Only Adapter</b> option is
|
---|
44 | provided for legacy support.
|
---|
45 | </p>
|
---|
46 | </note>
|
---|
47 | <p>
|
---|
48 | Host-only networking is particularly useful for preconfigured
|
---|
49 | virtual appliances, where multiple virtual machines are shipped
|
---|
50 | together and designed to cooperate. For example, one virtual
|
---|
51 | machine may contain a web server and a second one a database, and
|
---|
52 | since they are intended to talk to each other, the appliance can
|
---|
53 | instruct <ph conkeyref="vbox-conkeyref-phrases/product-name"/> to set up a host-only network for the two.
|
---|
54 | A second, bridged, network would then connect the web server to
|
---|
55 | the outside world to serve data to, but the outside world cannot
|
---|
56 | connect to the database.
|
---|
57 | </p>
|
---|
58 | <p>
|
---|
59 | To enable a host-only network interface for a virtual machine, do
|
---|
60 | either of the following:
|
---|
61 | </p>
|
---|
62 | <ul>
|
---|
63 | <li>
|
---|
64 | <p>
|
---|
65 | Go to the <b outputclass="bold">Network</b> page in the
|
---|
66 | virtual machine's <b outputclass="bold">Settings</b>
|
---|
67 | dialog and select an <b outputclass="bold">Adapter</b>
|
---|
68 | tab. Ensure that the <b outputclass="bold">Enable Network
|
---|
69 | Adapter</b> check box is selected and choose
|
---|
70 | <b outputclass="bold">Host-Only Adapter</b> for the
|
---|
71 | <b outputclass="bold">Attached To</b> field.
|
---|
72 | </p>
|
---|
73 | </li>
|
---|
74 | <li>
|
---|
75 | <p>
|
---|
76 | On the command line, use <userinput>VBoxManage modifyvm vmname --nic
|
---|
77 | <varname>x</varname> hostonly</userinput>. See <xref href="vboxmanage-modifyvm.dita"/>.
|
---|
78 | </p>
|
---|
79 | </li>
|
---|
80 | </ul>
|
---|
81 | <p>
|
---|
82 | For host-only networking, as with internal networking, you may
|
---|
83 | find the DHCP server useful that is built into <ph conkeyref="vbox-conkeyref-phrases/product-name"/>.
|
---|
84 | This is enabled by default and manages the IP addresses in the
|
---|
85 | host-only network. Without the DHCP server you would need to
|
---|
86 | configure all IP addresses statically.
|
---|
87 | </p>
|
---|
88 | <ul>
|
---|
89 | <li>
|
---|
90 | <p>
|
---|
91 | In <ph conkeyref="vbox-conkeyref-phrases/vbox-mgr"/> you can configure the DHCP server by choosing
|
---|
92 | <b outputclass="bold">File</b>,
|
---|
93 | <b outputclass="bold">Tools</b>,
|
---|
94 | <b outputclass="bold">Network Manager</b>. The Network
|
---|
95 | Manager window lists all host-only networks which are
|
---|
96 | presently in use. Select the network name and then use the
|
---|
97 | <b outputclass="bold">DHCP Server</b> tab to configure
|
---|
98 | DHCP server settings. See <xref href="network-manager.dita#network-manager"/>.
|
---|
99 | </p>
|
---|
100 | </li>
|
---|
101 | <li>
|
---|
102 | <p> Alternatively, you can use the <userinput>VBoxManage dhcpserver</userinput> command. See
|
---|
103 | <xref href="vboxmanage-dhcpserver.dita"/>. </p>
|
---|
104 | </li>
|
---|
105 | </ul>
|
---|
106 | <note>
|
---|
107 | <p>
|
---|
108 | On Linux and macOS hosts the number of host-only interfaces is
|
---|
109 | limited to 128. There is no such limit for Oracle Solaris and
|
---|
110 | Windows hosts.
|
---|
111 | </p>
|
---|
112 | </note>
|
---|
113 | <p> On Linux, macOS and Solaris <ph conkeyref="vbox-conkeyref-phrases/product-name"/> will only
|
---|
114 | allow IP addresses in 192.168.56.0/21 range to be assigned to host-only adapters. For IPv6
|
---|
115 | only link-local addresses are allowed. If other ranges are required, they can be enabled by
|
---|
116 | creating <filepath>/etc/vbox/networks.conf</filepath> and specifying allowed ranges there. For
|
---|
117 | example, to allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges as well as 2001::/64 range put the
|
---|
118 | following lines into <filepath>/etc/vbox/networks.conf</filepath>: </p>
|
---|
119 | <pre xml:space="preserve"> * 10.0.0.0/8 192.168.0.0/16
|
---|
120 | * 2001::/64
|
---|
121 | </pre>
|
---|
122 | <p>
|
---|
123 | Lines starting with the hash <userinput>#</userinput> are ignored. The
|
---|
124 | following example allows any addresses, effectively disabling
|
---|
125 | range control:
|
---|
126 | </p>
|
---|
127 | <pre xml:space="preserve"> * 0.0.0.0/0 ::/0
|
---|
128 | </pre>
|
---|
129 | <p>
|
---|
130 | If the file exists, but no ranges are specified in it, no
|
---|
131 | addresses will be assigned to host-only adapters. The following
|
---|
132 | example effectively disables all ranges:
|
---|
133 | </p>
|
---|
134 | <pre xml:space="preserve"> # No addresses are allowed for host-only adapters
|
---|
135 | </pre>
|
---|
136 | </body>
|
---|
137 |
|
---|
138 | </topic>
|
---|