VirtualBox is a powerful x86 and AMD64/Intel64 virtualization software(VBox for short), which can be used
to construct kinds of debug or test network environments. Sometimes, for the sake of security, some
virtual hosts run parallely on the same physical platform to isolate each other, decrease complexity.
Network Adapter
VirtualBox provide 8 PCI network adapter for each virtual machine. 4 of them can be configured with
GUI, and all 8 adapters can be configured through command.
Network Types
VirtualBox supports different types of network configuration similar to physical network configuration.
- NAT(Network Adress Translation)
NAT is a default option when VirtualBox is installed. VirtualBox provides a NAT router and DHCP
service for every virtual machine.
The same IP address 10.0.2.15 is assigned to all virtual machines from the DHCP in the VirtualBox
and the default gateway address is 10.0.2.2.
All virtual machines can access to the pyhsical network through the NAT provided by the virtualBox.
But access to VM from the outside is not allowed.
- NAT Networking
All virtual machines are connected to the virtual switch and can access to the physical network
through the NAT like a wifi router at home.
Different from NAT, each virtual machine has different IP address but shares the same gateway in the
VirtualBox. Each virtual machines can connect to each other.
- Bridged Networking
All virtual machines and host machine are bridged in the same ethernet segment. In other words, all
virtual machines are connected to the physical network directly.
In this networking, all virtual machines are accessible from the outside network.
- Internal Networking
All virtual machines are connected to the virtual switch and can access each other but isolated from
the host machine and outside network.
All virtual machines can not access to the pyshical network and also the host machine can not access
to all virtual machines.
- Host-only Networking
All virtual machinesand host machine are connected to the virtual switch and can access each other
but isolated from the outside network.
The only difference is that the host machine is added into the internal network.
Summary
In the VirtualBox, multiple network interfaces can be set up on one virtual machine. For example, one interface is attached to the NAT network and the other to the Host-only network. NAT network enables connection to the internet and the Host-only network enables the connection from the host machine to the virtual machine.