Proxmox VE inside VirtualBox

From Proxmox VE
Jump to navigation Jump to search

Running Proxmox VE inside VirtualBox is possible but is not recommended for production use. Virtualizing the Proxmox VE hypervisor inside VirtualBox is usually done for development and testing purposes. For example, wanting to use VirtualBox as a host for Proxmox on a laptop is a common wish but can be tricky to get right. This page covers special considerations necessary for Proxmox VE to function as expected when it is being hosted by the VirtualBox hypervisor.

Unless otherwise stated, this page assumes you are using:

  • VirtualBox 4.3.16 or higher.
  • Proxmox VE 4.x or higher (i.e. for lxc containers only, OpenVz is not supported any more)

Prerequisites

For Proxmox VE inside VirtualBox to work well, it's strongly recommended that your VirtualBox host (e.g., your laptop) meets the minimum hardware requirements and software configuration. Otherwise, Proxmox VE may still work but it can be extremely slow.

  • VirtualBox should support hardware virtualization acceleration. This means the feature is activated in EFI/BIOS. If you don't see this option in your EFI/BIOS screens, you should double-check to see if your CPU supports it.
  • Further, if you plan to host any guests within Proxmox and are running VirtualBox 6.1 or later, you should enable nested hardware virtualization acceleration in the VirtualBox settings for the Proxmox VE virtual machine itself. The setting is in the VirtualBox Machine Processor Tab (System → Processor → Enable Nested VT-x/AMD-V).
  • When creating the VirtualBox VM to host Proxmox VE, you should set its OS type to be run as Linux: Debian (64-bit) guest.

Nested Containers and simple Virtual Machines

You can run LXC Containers in the virtualized Proxmox VE without any problems. It's also possible to create and configure fully nested virtual machines, so long as you enable VirtualBox's supported for nested VT-X/AMD-V hardware instructions, noted above. Nested virtual machines will run fairly well if they don't have any graphical interface and don't consume too many CPU resources. (This was tested with, e.g., slax-router.) Do be careful, though. If your nested VMs require too many resources, they will freeze up and can block your guest system too!

Also, note that some VirtIO drivers are known to make problems if nested in a VirtualBox environment, although this seems to have gotten more reliable with later version of VirtualBox (specifically 6.1 and higher). For this reason, it's recommend to use e1000 for the nested VM's network adapters if you can, especially since the improved performance offered by the virtio driver is not typically required in a nested scenario such as this.

Further, when using earlier VirtualBox versions, KVM hardware virtualization does not work and must not be set! The reason is that with these VirtualBox versions, nested hardware virtualization support is not possible. Nested virtualization became possible starting in VirtualBox version 6.1.

Network Considerations

Most VirtualBox networking modes will work as expected when running Proxmox VE as a guest within VirtualBox. However, there are a few things to consider specially.

Internet access

The easiest way to give your Proxmox VE node access to the Internet when it is running as a guest within VirtualBox is to use VirtualBox's NAT networking mode. (This is not the same as the NAT network networking mode!) For example, configure the VirtualBox VM's "Adapter 1" to use the NAT networking mode and boot the Proxmox VE guest.

When Proxmox starts, it will recognize its physical NIC and receive an IP address from VirtualBox's internal DHCP service. Usually, this is something like 10.0.x.x (for example: 10.0.2.15). Your Proxmox VE node is now on its own, totally independent network, separated from VirtualBox host's network access. From here, you can configure any number of Proxmox VE guests as you normally would within Proxmox VE itself.

However, since your Proxmox VE node is now behind a NAT router, you will not be able to access the Proxmox VE Web GUI nor the SSH port unless you also configure the VirtualBox NAT service to forward traffic for these services to the correct ports. For details, see §6.3.1, "Configuring Port Forwarding with NAT", of the VirtualBox User Manual.

For example, if you forward host post 8006 to guest port 8006, you can access the Proxmox VE Web GUI via a URL such as https://localhost:8006 in a browser running on your VirtualBox host.

VirtualBox guest to Proxmox guest communication requires VirtualBox NIC in promiscuous mode

If you plan to have Proxmox VE host its own (nested) virtual machines or containers that are attached to a VirtualBox virtual network (as opposed to running entirely within Proxmox VE's own internal bridged networking) and would like those guests to be able to communicate with the VirtualBox host or with other VirtualBox-hosted (as opposed to Proxmox VE-hosted) virtual machines, you should ensure that the relevant VirtualBox virtual network adapter is permitted to use promiscuous mode.

This is not the default setting! Rather, by default, VirtualBox denies its guest VMs from effectively enabling promiscuous mode. (Its default setting is Deny.) The setting is available from the Network tab in a VirtualBox VM Machine Settings window (Network → Adapter N [where N is the adapter number] → Advanced → Promiscuous Mode) or can be changed via command line with:

vboxmanage modifyvm <uuid|vm_name> --nicpromiscN <deny|allow-vms|allow-all>

Without this option changed away from Deny, communication from a VirtualBox-hosted VM to a (nested) Proxmox VE-hosted VM or container will fail.

If communication from a VirtualBox-hosted guest to a nested Proxmox VE-hosted guest still fails after making the above change, try restarting the virtualized Proxmox VE node itself.

Install and Run Proxmox VE

The following instructions describe how to configure an example, simple, single virtualized Proxmox VE node within VirtualBox that is known to work reliably:

1. Create a new VirtualBox Virtual Machine for Proxmox

Sample settings:

  • Name: Proxmox-vm
  • OS Type: Linux
  • Version: Debian (64 bit)
  • Memory: 6GB
  • Disk: At least 8GB in size

2. Edit the settings

  • Audio: disable
  • Storage:
    • IDE - Select Empty - click IDE Secondary - select the disk symbol, pick ISO for Proxmox
  • Network:
    • Adapter 1: Host-only Adapter, vboxnet0; recommended leave the advanced settings as they are, unless you plan to have VirtualBox-hosted VMs in communication with Proxmox VE-hosted guests, in which case be sure to allow Promiscuous Mode. (Paravirtualized Network (virtio-net)).
    • Adapter 2: NAT (again, this is not the same as NAT network!)

Notably, the following networking modes caused trouble historically, but you may have better luck these days:

  • "NAT network" (note the additional word "network"!), nor
  • "Bridged Adapter" (to WLAN)

Then start the newly created Virtual Machine normally. You should see the Proxmox VE installer and can continue with installing Proxmox VE inside VirtualBox as you like.