VirtualBox Networks

This is a side note made for <<Vagrant Quick Start>>, for you to recall the underlying virtual network setup for VM on your host.

Virtualbox is equipped with its own CLI, for example:

1
2
3
4
# list VMs
vboxmanage list vms
# show running VMs
vboxmanage list runningvms

Virtual Network Configuration

The virtualbox has these Networks types, There is Networks types video to go through.

You can configure below network types for your VM from virtualBox UI.

  • Not attached. In this mode, Oracle VM VirtualBox reports to the guest that a network card is present, but that there is no connection. This is as if no Ethernet cable was plugged into the card, namely no internet.

  • Network Address Translation (NAT). If all you want is to browse the Web, download files, and view email inside the guest, then this default mode should be sufficient for you. The host is used as proxy for VMs.

    • The VM cannot be accessed from outside world.
    • VM no access from host, for example, ping VM IP won’t work.
    • VM no access from other VMs in the same host.
    • By setting up port forwarding under NAT, it enables VM be accessible from host or outside world (if host is accessible from outside).
  • NAT Network. A NAT network is a type of internal network setup that allows a group of VMs inter-accessible, you need to create the NAT network from virtualBox first and use it for your VMs, the VMs inside the same NAT network are inter-accessible.

  • Bridged networking. This is for more advanced networking needs, such as network simulations and running servers in a guest. When enabled, Oracle VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system’s network stack.

    • The VM will be assigned IP in the same level as the host.
    • The VM is just working as another host in your network.
    • Docker, Docker compose use bridged network by default, e.g docker0 bridge.
  • Internal networking. This can be used to create a different kind of software-based network which is visible to only selected VMs, but not to applications running on the host or to the outside world.

    • VM no access from host.
  • Host-only networking. This can be used to create a network containing the host and a set of VMs, without the need for the host’s physical network interface. Instead, a virtual network interface, similar to a loopback interface, is created on the host, providing connectivity among virtual machines and the host.

    • Connection is allowed b/w host and VMs, but VMs cannot access outside world.
0%