Virtual Box Notes

Page Contents

Headless Mode

When run in headless mode, Virtual Box runs as a daemon with no graphical interface. I've used this to allow it to be auto-started during the my host OS's boot.

To setup headless mode:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm THE_VBOX_NAME --type headless

To connect to the headless VBox a host-only network should be setup.

With host-only networking, virtual box doesn't try to use a physical network adapter on the host. Instead in VirtualBox you can create one or more (up to 8) virtual adapters for connections between the host and virtual machines created in VirtualBox on the host.

When host-only networking is used, Oracle VM VirtualBox creates a new software interface on the host which then appears next to your existing network interfaces. In other words, whereas with bridged networking an existing physical interface is used to attach virtual machines to, with host-only networking a new loopback interface is created on the host. And whereas with internal networking, the traffic between the virtual machines cannot be seen, the traffic on the loopback interface on the host can be intercepted.

The guest can then be accessed using ssh -l USER-NAME 192.168.56.101

Networking Modes

References:

NAT

From the Virtual Box manual we read:

A virtual machine with NAT enabled acts much like a real computer that connects to the Internet through a router. The router, in this case, is the Oracle VM VirtualBox networking engine, which maps traffic from and to the virtual machine transparently ... placed between each virtual machine and the host ... by default virtual machines cannot talk to each other ...

... The network frames sent out by the guest operating system are received by Oracle VM VirtualBox's NAT engine, which extracts the TCP/IP data and resends it using the host operating system...

... The virtual machine receives its network address ... on the private network from a DHCP server integrated into Oracle VM VirtualBox ...

This can be represented as so (taking inspiration from the Naviko guide).

Bridged

With bridged networking, Oracle VM VirtualBox uses a device driver on your host system that filters data from your physical network adapter. This driver is therefore called a net filter driver. This enables Oracle VM VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software. When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable. The host can send data to the guest through that interface and receive data from it.