Repository

Looks good to me!

User Tools

Site Tools


kb:intranet:software:virtualbox

VirtualBox

If you receive a random BLKCACHE_IOERR from, say, creating a 1 GB archive, then enabling the host I/O cache will solve the problem: https://stackoverflow.com/a/37481834

Inter-VM communication

As of 2023-01-16, the host wireless card is not directly passed to the VMs, only the Ethernet card is. Something about needing to establish a link over a virtual USB bus or something. In any case, NAT is the only way to enable internet access for VMs on hosts with only a Wifi connection. The "Network Manager" is not accessible on my version of VirtualBox, so had to rely on CLI instead.

The architecture is as follows:

  • Both VMs should have a NAT network adapter to connect to the internet via the host
  • For inter-VM communication, a DHCP server can be established from within Virtualbox. The command is:
    • .\VBoxManage dhcpserver add --network=internal --server-ip=10.10.10.1 --netmask=255.255.255.0 --lower-ip=10.10.10.2 --upper-ip=10.10.10.253 --enable
    • For some reason, VirtualBox registers an upper-ip address of 10.10.10.255 as invalid, so need something lower. The network name is set to internal here.
    • Listing and removal uses list dhcpservers and remove --network=internal respectively.
  • Add the new DHCP as an internal network on the second adapter.

Once the VM is started, there will initially be no IP address assigned on the internal network interface. What's left is to register this new network interface on the VM. For Ubuntu 20+, given the new interface name of enp0s8, add the following to the file:

/etc/netplan/00-installer-config.yaml
network:
  enp0s8:
    dhcp4: true

then restart the network manager with sudo netplan apply. For other platforms / versions of Ubuntu, see the following Stackoverflow.

To enable SSH access, first establish port forwarding (recall that the host itself is acting as a DHCP server and router) on the VM's NAT network card. The relevant setting is to forward 127.0.0.1:9998/tcp to 10.0.3.15:22 (or whatever the NAT-assigned IP address is - probably can adjust the port forwarding settings dynamically while the guest is running).

kb/intranet/software/virtualbox.txt · Last modified: 18 months ago ( 2 May 2023) by 127.0.0.1