Sun Oracle’s desktop virtualisation software package.
Virtual machines can run in various network modes:
|Mode||Details||When to use|
|Not attached||No network card attached||Configuring an OS (forces the OS to believe there is no network available)|
|Bridged networking||VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system’s network stack. Most likely will request an IP from the DHCP server (e.g. router), usually an internal one, e.g.
||Running a server (e.g. httpd) that needs to be accessible over LAN|
|NetworkAddressTranslation (NAT)||Requires port forwarding if you want to run servers etc.||Simple web browsing/email/downloads|
|Host-only networking||Creates virtual network interface on host. Use with VirtualBox’s built-in DHCP server.||Running a server (e.g. httpd) that needs to only be accessible on the host; preconfigured virtual appliances; where two appliances should be able to talk to each other but not the outside world|
To set up the common use case of an Ubuntu virtual machine with a LAMP configuration:
- In the virtual machine’s settings, use a single Adapter, and set it as Bridged Adapter, bridged to the host machine’s network interface.
- Restart the guest OS.
- Update the
/etc/hostsfile on the host machine (if required).
- Disk images (
.vdi) have a unique UUID which means that the same image cannot be used twice
- To clone disk images, use the syntax:
vboxmanage clonehd [source-vdi] [dest-vdi] --format VDI
Use the Shared Folders feature to share a folder with the guest:
- In the guest, type
idto get the ID of the current user.
- Mount the drive with
mount -t vboxsf -o uid=12345,gid=12345 name-of-vbox-share ~/path/to/mount
- Unmount using
Using SSH with port forwarding
If on a NAT network, set up port forwarding (port 3022 to 22 on the guest):
$ VBoxManage modifyvm CentOS-6.5-i386-minimal --natpf1 delete ssh $ VBoxManage modifyvm CentOS-6.5-i386-minimal --natpf1 delete http $ VBoxManage modifyvm CentOS-6.5-i386-minimal --natpf1 "ssh,tcp,,3022,,22" $ VBoxManage modifyvm CentOS-6.5-i386-minimal --natpf1 "http,tcp,,8080,,80"
Then you can SSH from the Host to the Guest using
ssh -p 3022 firstname.lastname@example.org
|Failed to open/create the internal network ‘HostInterfaceNetworking- Intel(R) 82566DM-2 Gigabit Network Connection’ VERR_INTNET_FLT_IF_NOT_FOUND||The virtual machine has been downloaded from another location which has a differently named network interface||Update the virtual machine settings to use a valid network interface|
|“Invalid settings detected”, cannot select a network interface for a Host-only Adapter connection; \|
|Then, in VirtualBox network preferences, “failed to open /dev/vboxnetctl: No such file or directory”||The system/kernel was recently updated which affected VirtualBox drivers.||On OSX, run:
|Doesn’t work in OS X High Sierra||Follow the instructions at https://developer.apple.com/library/archive/technotes/tn2459/_index.html|