>

VirtualBox provides several ways for the Guest OS to access the internet, they are

  • NAT - Your host will act as a router (firewall) and your hosts will be on a private subnet. Use this if you are not running servers on the guests.
  • Bridged - Your guests will get a ip address on the same subnet as your host. Use this if you are running servers on the guest and wish to connect from other computers on the LAN.
  • Host Only - Sort of a hybrid. As the name implies, with this option you can connect to the guest servers from the host only. Use this for “private” (host only) servers. I use this if I am running a test web server. The guest machine cannot communicate with the outside world too, since they are not connected via a physical interface.

Note:
Actually, VirtualBox provides NAT and NAT network, we should notice the differences between them:
The major difference is that in NAT mode, Guest are in completely separated network, they can’t see each other. However, in NAT Network mode, all Guests are in the same network, they still use the NAT to access the outer world internet, and they can see each other.

Exerpt from VirtualBox User Manual

Ch 9. Fine-tuning the VirtualBox NAT engine
In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2. So x is 2 when there is only one NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.
If, for any reason, the NAT network needs to be changed, this can be achieved with the following command:

$ VBoxManage modifyvm "VM name" --natnet1 "192.168/16"

This command would reserve the network addresses from 192.168.0.0 to 192.168.254.254 for the first NAT network instance of “VM name”. The guest IP would be assigned to 192.168.0.15 and the default gateway could be found at 192.168.0.2.

Referencehttps://jekewa.com/blogs/index.php/weBlog/2014/01/09/virtualbox-4-3-adds-nat
https://www.virtualbox.org/manual/ch09.html#changenat
https://www.thomas-krenn.com/en/wiki/Network_Configuration_in_VirtualBox
https://blogs.oracle.com/fatbloke/entry/networking_in_virtualbox1
http://www.makeuseof.com/tag/what-is-network-address-translation-nat-and-how-does-it-work/