The VirtualBox can allocate 8 network cards per virtual machine. Each NIC connection can be selected as one of the following:
- Not attached
- Network Address Translation (NAT)
- Bridged networking
- Host-only Networking
- Internal Networking
- Generic Networking
Removing the first and last, we only care about 4 left:
(The following assumes that host is in the 192.168.1.* network segment)
Network Address Translation (NAT)
Host |
192.168.1.3 |
Guest1 |
10.0.2.15 |
Guest2 |
10.0.2.15 |
... |
10.0.2.15 |
NAT is the simplest way to access an external network in a virtual machine, VirtualBox the default network mode. You typically do not need to make any settings for host and guest.
However, because the virtual machine is connected to a private network inside the VirtualBox, the virtual machine is invisible to other virtual machines, to the host, and to other computers on the network. To make some of its ports externally visible, you need to use port forwarding.
Set up a forwarding rule for the NAT network card of a virtual machine named WindowsXP through the VirtualBox interface or command line Rule1
Vboxmanage MODIFYVM "windowsxp"--NATPF1 "rule1,tcp,,2222,,22"
Format:
--natpf<1-n> [<name>],tcp|udp,[
Bridged networking
It can meet the needs of more advanced network in the virtual machine, such as running servers and so on. It is connected directly to the host network via the host's NIC. Therefore, the virtual function is assigned to an independent IP, and all the network functions are exactly the same as the real machines in the network.
Host |
192.168.1.3 |
Guest1 |
192.168.1.4 |
Guest2 |
192.168.1.5 |
... |
192.168.1.* |
Internal Networking
Used to create a network between virtual machines that are not visible to host and external computers.
Host |
192.168.1.3 |
Guest1 |
169.254.75.244 |
Guest2 |
169.254.75.245 |
... |
169.254.*.* |
Host-only Networking
Host |
192.168.1.3 |
192.168.56.1 |
Guest1 |
192.168.56.101 |
Guest2 |
192.168.56.102 |
... |
192.168.56.* |
A network between host and several virtual machines. The host automatically adds a bit similar to the local loopback interface, and the guest is located on the same network segment.
Network insulation with the outside world. Cannot access the outside network or be accessed by an external computer.
Other
Since each virtual machine can be set up 8 network cards, each network card can choose a different mode, so there can be a variety of combinations, so as to achieve a variety of effects.
http://blog.csdn.net/dbzhang800/article/details/6993261
VirtualBox Network settings (6 ways)