Network Configuration in VirtualBox
VirtualBox provides several types for virtual networks. This article will explain the differences and potential uses for the various network configurations.
overview table of access options
Network type | Access Guest -> other Guests |
Access Host -> Guest |
Access Guest -> external Network |
---|---|---|---|
Not attached | - | - | - |
Network Address Translation (NAT) | - | - | ✔ |
Network Address Translation Service | ✔ | - | ✔ |
Bridged networking | ✔ | ✔ | ✔ |
Internal networking | ✔ | - | - |
Host-only networking | ✔ | ✔ | - |
Virtual Network Hardware
VirtualBox 4.* provides the following virtual network cards:[1]
- AMD PCNet PCI II (Am79C970A)
- AMD PCNet FAST III (Am79C973, the default)
- Intel PRO/1000 MT Desktop (82540EM)
- Intel PRO/1000 T Server (82543GC)
- Intel PRO/1000 MT Server (82545EM)
- Paravirtualized network adapter (virtio-net)
Network Modes
For network configuration, VirtualBox 4.* provides the following network modes:[2]
- "Not attached" mode (not connected)
- Network Address Translation (NAT)
- Bridged networking (network bridge)
- Internal networking (internal network)
- Host-only networking (Host-only adapter)
- Generic networking
"Not attached" mode
In this mode, the guest system will see a network card, whose (virtual) cable has been disconnected.[3]
Network Address Translation (NAT)
NAT is the simplest option from the point of view of the guest system for accessing external networks. External access to the guest system (such as accessing a web server installed on a guest system) is not possible.[4]
Note: Even from the host system, the services on the guest system cannot be accessed. If access should be possible, an additional interface can be configured using Host-only networking.
NAT service
Network Address Translation Service is a new NAT variant, which was newly introduced (experimental) with VirtualBox 4.3. The functionality is similar to a router. Direct access to the client systems from outside the network is prevented and the guest systems can communicate with TCP and UDP over IPv4 and IPv6 to each other and to the outside world. The NAT service is connected to an internal network. Virtual machines using this service should be connected to this internal network. The name of the internal network is selected when configuring the NAT service. The internal network will be recreated if it does not already exist.
Example configuration of a static NAT network
VBoxManage natnetwork add -t nat-int-network -n "192.168.15.0/24" -e
natnetwork
is the name of the internal network.
192.168.15.0/24
represents the network and subnet mask.
192.168.15.1
is the gateway address.
Example configuration with DHCP server
VBoxManage natnetwork add -t nat-int-network -n "192.168.15.0/24" -e -h on
Adding a DHCP server later
VBoxManage natnetwork modify -t nat-int-network -h on
For more information and configuration options, see Network Address Translation Service (Virtualbox Manual).
Bridged Networking
In this mode, the guest system will receive direct access to the network, to which the host system has been connected.[5]
Internal Networking
Only those guest systems that have been connected to the same internal network will be able to communicate with each other in the internal network configuration. Communication with the host system or another network outside of VirtualBox will not be possible.[6]
Host-only Networking
In this mode, communication between connected guest systems and the host system is possible.[7]
Customized network interfaces will be used on the host system for the host-only network, such as: vboxnet0
. The IP address on the host as well as the DHCP server for this network will be configured directly in VirtualBox:
The following table shows the host-only network configuration used in this example:
Description | IP(s) |
---|---|
IP address for the host | 192.168.56.1 (network mask 255.255.255.0) |
DHCP-Server Range | 192.168.56.101 - 192.168.56.254 |
The IP range limiting the IP addresses that will be provided to the guest systems | 192.168.56.2 - 192.168.56.100 |
Generic networking
There are currently two possible sub-modes for Generic networking mode:
References
- ↑ Oracle VirtualBox User Manual (Virtual networking hardware section)
- ↑ Oracle VirtualBox Users Manual (Introduction to Networking Modes section)
- ↑ Sun VirtualBox User Manual ("Not Attached" Mode Section)
- ↑ Oracle VirtualBox User Manual (Network Address Translation (NAT) section
- ↑ Oracle VirtualBox User Manual (Bridged networking section)
- ↑ Oracle VirtualBox User Manual (Internal networking section)
- ↑ Oracle VirtualBox User Manual (Host-only networking section)
- ↑ Oracle VirtualBox User Manual (UDP Tunnel networking section)
- ↑ Oracle VirtualBox User Manual (VDE networking section)
Additional Information
- Oracle VirtualBox User Manual (Chapter 6. Virtual networking)
Author: Werner Fischer Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.
|