Difference between revisions of "Proxmox VE inside VirtualBox"

From Proxmox VE
Jump to navigation Jump to search
m (Typos.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= General =
+
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 [http://forum.proxmox.com/google.php?cx=partner-pub-1240956337013298%3A0281164794&cof=FORID%3A9&ie=ISO-8859-1&q=virtualbox&sa.x=-1192&sa.y=-47&siteurl=forum.proxmox.com%2F&ref=&ss=1399j312179j10 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:
  
* Instructions assume VirtualBox 4.3.16 or higher
+
* VirtualBox 4.3.16 or higher.
* The article refers to Proxmox VE 4.x (i.e. for lxc containers only, OpenVz is not supported any more)
+
* Proxmox VE 4.x or higher (i.e. for lxc containers only, OpenVz is not supported any more)
  
Running Proxmox VE as productive environment is not really possible, but for development and testing purposes, it can be useful to install PVE inside a virtual machine on e.g. a laptop. Wanting to use Virtualbox as a host for Proxmox on a laptop is a [http://forum.proxmox.com/google.php?cx=partner-pub-1240956337013298%3A0281164794&cof=FORID%3A9&ie=ISO-8859-1&q=virtualbox&sa.x=-1192&sa.y=-47&siteurl=forum.proxmox.com%2F&ref=&ss=1399j312179j10 common wish] but can be tricky to get right.
+
= Prerequisites =
  
Laptops use usually (only) WLAN connections which can be tricky because their network address continually change, and sometimes disappear, whereas desktops can assign a static ip address on a stable network. This can cause loss of stability unless an extra network is set up.
+
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 [https://www.virtualbox.org/manual/UserManual.html#settings-processor 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 [https://www.virtualbox.org/manual/UserManual.html#settings-basic 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., [http://slaxrouter.sourceforge.net/slax-router 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 <tt>e1000</tt>''' 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. [https://www.virtualbox.org/manual/UserManual.html#nested-virt Nested virtualization became possible starting in VirtualBox version 6.1].
  
 
= Network Considerations =
 
= Network Considerations =
  
For accessing the internet use NAT - an address would be assigned by VirtualBox's DHCP service, usually something like 10.0.x.x, totally independent from host's network access (works as a small LAN which connects just the VBox virtual Proxmox and the NAT service).
+
Most [https://www.virtualbox.org/manual/UserManual.html#networkingmodes 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.
  
Since the "main" Proxmox network address should be under user's control it's recommended to use a vitual HostOnly LAN; but it depends of the currecnt situation you may have.
+
== Internet access ==
  
= Prerequisites / Assumptions =
+
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.
  
For PVE inside Virtualbox to work well it's strongly recommended (otherwise it may work but can be extremely slow) that
+
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 <tt>10.0.x.x</tt> (for example: <code>10.0.2.15</code>). 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.
* your laptop needs to support HW acceleration (to be activated in BIOS, but check it your CPU supports it)
 
* in virtual machine's settings the above is activated by System > Acceleration > Hardware Virtualization: Enable VT-x/AMD-V
 
It has to be run as Linux Debian (64-bit) guest.  
 
* The assumption of this article is that the PVE installation needs to be accessible only from the laptop.
 
* These instructions suppose the reader has minimal knowledge of networking, advanced configuration options that assume more knowledge are at [[Network Model]].
 
  
= Containers and simple KVM as target =
+
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 [https://www.virtualbox.org/manual/UserManual.html#natforward §6.3.1, "Configuring Port Forwarding with NAT", of the VirtualBox User Manual].
  
You can run lxc Containers in PVE without any problems. It's also possible to configure KVM (Virtual Machines)... you can run these as well if they don't have any graphical interface and don't consume to much CPU resources (tested e.g. with [http://slaxrouter.sourceforge.net/slax-router slax-router]); be careful: in all other cases the Virtual Machine will freeze and can block your guest system too!
+
For example, if you forward host post <tt>8006</tt> to guest port <tt>8006</tt>, you can access the Proxmox VE Web GUI via a URL such as <tt>https://localhost:8006</tt> in a browser running on your VirtualBox host.
  
KVM hardware virtualization does not work and must not be set! The reason is that with VirtualBox nested hardware virtualization support is not possible.
+
== VirtualBox guest to Proxmox guest communication requires VirtualBox NIC in promiscuous mode ==
  
= Install and Run PVE =
+
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 [https://forum.proxmox.com/threads/why-is-this-simple-bridge-network-not-receiving-arp-replies-correctly.75695/#post-337550 ensure that the relevant VirtualBox virtual network adapter is permitted to use promiscuous mode].
1. Create a new Virtualbox Virtual Machine for Proxmox
+
 
 +
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 &rarr; Adapter N [where N is the adapter number] &rarr; Advanced &rarr; Promiscuous Mode) or can be changed via command line with:
 +
 
 +
<pre>
 +
vboxmanage modifyvm <uuid|vm_name> --nicpromiscN <deny|allow-vms|allow-all>
 +
</pre>
 +
 
 +
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:
 
Sample settings:
* Name: Proxmox-vm  
+
* Name: Proxmox-vm
* OS Type: Linux  
+
* OS Type: Linux
 
* Version: Debian (64 bit)
 
* Version: Debian (64 bit)
 
* Memory: 6GB
 
* Memory: 6GB
* Disk: Use a SSD if possible. Preallocated might provide faster access.
+
* Disk: At least 8GB in size
  
 
2. Edit the settings
 
2. Edit the settings
Line 47: Line 68:
 
** IDE - Select Empty - click IDE Secondary - select the disk symbol, pick ISO for Proxmox
 
** IDE - Select Empty - click IDE Secondary - select the disk symbol, pick ISO for Proxmox
 
* Network:  
 
* Network:  
** Adapter 1: Host-only Adapter, vboxnet0; recommended leave the advanced settings as they are (Paravirtualized Network (virtio-net)).
+
** 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 (attention: '''NOT''' NAT-network!!)
+
** 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:
  
'''Do not use''' (it's not reliable!)
 
 
* "NAT network" (note the additional word "network"!), nor
 
* "NAT network" (note the additional word "network"!), nor
 
* "Bridged Adapter" (to WLAN)
 
* "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.
 
 
Then start the newly created Virtual Machine and Proxmox VE will be installed and can be used as any hardware installed Proxmox VE (but note the limitations mentioned above).
 

Latest revision as of 02:02, 15 September 2020

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.