Proxmox VE inside VirtualBox: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(Mr.Holmes' updates, per http://forum.proxmox.com/threads/20054-Proxmox-under-Virtualbox-no-outbound-networking?p=103041#post103041)
(replaced ¥ with ' and questioned the vbox name in VBoxManage)
Line 6: Line 6:


== Goals and Prerequisites ==
== Goals and Prerequisites ==
For development and testing purposes, it can be useful to install PVE inside a virtual machine on e.g. a laptop. For this to work it¥s strongly recommended (otherwise it may work but can be extremely slow) that
For development and testing purposes, it can be useful to install PVE inside a virtual machine on e.g. a laptop. For this to work it's strongly recommended (otherwise it may work but can be extremely slow) that
* your laptop needs to support HW acceleration (to be activated in BIOS, but check it your CPU supports it)
* 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  
* 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.  
It has to be run as Linux Debian (64-bit) guest.  


This will allow you to run Containers (OpenVZ) in PVE without any problems. It will allow you to configure KVM (Virtual Machines), you can run them too 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!
This will allow you to run Containers (OpenVZ) in PVE without any problems. It will allow you to configure KVM (Virtual Machines), you can run them too 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!
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.
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.


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. In any case it¥s recommended to use for access ''to'' PVE VirtualBox¥s "Host-only Network" via "Host-only Adapter". For access to outside (internet) ''from'' PVE use VirtualBox¥s "NAT". '''Do not use''' (it¥s not reliable!)
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. In any case it's recommended to use for access ''to'' PVE VirtualBox's "Host-only Network" via "Host-only Adapter". For access to outside (internet) ''from'' PVE use VirtualBox's "NAT". '''Do not use''' (it's not reliable!)
* "NAT network" (note the addional word "network"!)
* "NAT network" (note the additional word "network"!), nor
* "Bridged Adapter" (to wlan)
* "Bridged Adapter" (to WLAN)


The assumption of this article is that the PVE installation needs to be accessible only from the laptop.
The assumption of this article is that the PVE installation needs to be accessible only from the laptop.
Line 22: Line 22:
These instructions suppose the reader has minimal knowledge of networking, advanced configuration options that assume more knowledge are at [[Network Model]].  
These instructions suppose the reader has minimal knowledge of networking, advanced configuration options that assume more knowledge are at [[Network Model]].  


In principal we have from PVE¥s point of view 2 (type of) networks:
In principal we have from PVE's point of view 2 (type of) networks:


=== Default Network ===
=== Default Network ===


Proxmox default network is set up at the last stage of configuration to e.g. IP address 172.241.0.101. It appears in PVE¥s configuration as bridge adapter vmbr0. The WEB GUI then runs on port 8006 answering to https.
Proxmox default network is set up at the last stage of configuration to e.g. IP address 172.241.0.101. It appears in PVE's configuration as bridge adapter vmbr0. The WEB GUI then runs on port 8006 answering to https.


Note: During installation PVE¥s Default Network is set to eth0 / vmbr0 - but since it is recommended to have NAT in connected to the first virtual NIC here you should use eth1 / vmbr0. You can this adapt in WEB GUI after installation!
Note: During installation PVE's Default Network is set to eth0 / vmbr0 - but since it is recommended to have NAT in connected to the first virtual NIC here you should use eth1 / vmbr0. You can this adapt in WEB GUI after installation! (How?)


=== Access to Internet ===
=== Access to Internet ===


For accessing the internet use NAT - an address would be assigned by VirtualBox¥s DHCP service, usually something like 10.0.2.15 - But to have it under control you should not use DHCP but set the IP address in PVE manually and define the subnet manually too.
For accessing the internet use NAT - an address would be assigned by VirtualBox's DHCP service, usually something like 10.0.2.15 - But to have it under control you should not use DHCP but set the IP address in PVE manually and define the subnet manually too.


==== Define the Subnet for NAT ====
==== Define the Subnet for NAT ====


This has to be done in VirtualBox¥s Machine Settings. Set Adapter 1 to "NAT" and - the following has to be done on command line - assuming your machine¥s name is "proxmox-vm"
This has to be done in VirtualBox¥' Machine Settings. Set Adapter 1 to "NAT" and - the following has to be done on command line - assuming your machine's name is "proxmox-vm"


  VBoxManage modifyvm "Proxmox" --natnet1 "192.168.11.0/24"
  VBoxManage modifyvm "Proxmox" --natnet1 "192.168.11.0/24"
(Shouldn't that be 'modifyvm "proxmox-vm"'?)


==== Define the Address(es) in PVE ====
==== Define the Address(es) in PVE ====
Line 54: Line 56:
=== Network in Containers or KVMs ===
=== Network in Containers or KVMs ===


In PVE¥s virtual machines both networks can be used by bridging to vmbr0 (Internal Network) or direct IP addressing (venet0 with address in NAT subnet; for Containers only, don¥t set both networks with venet0!).
In PVE's virtual machines both networks can be used by bridging to vmbr0 (Internal Network) or direct IP addressing (venet0 with address in NAT subnet; for Containers only, don't set both networks with venet0!).


== Create Host-Only Network in Virtualbox==
== Create Host-Only Network in Virtualbox==

Revision as of 13:29, 14 November 2014

How to install Proxmox PVE inside Oracle VirtualBox

  • WARNING: Article in development - please comment on http ://forum.proxmox.com/threads/19966-Proxmox-under-Virtualbox
  • Instructions assume VirtualBox 4.3.16 or higher
  • Much credit goes to the authors of the article on orestad-linux.se

Goals and Prerequisites

For development and testing purposes, it can be useful to install PVE inside a virtual machine on e.g. a laptop. For this to work it's strongly recommended (otherwise it may work but can be extremely slow) that

  • 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.

This will allow you to run Containers (OpenVZ) in PVE without any problems. It will allow you to configure KVM (Virtual Machines), you can run them too if they don't have any graphical interface and don't consume to much CPU resources (tested e.g. with slax-router); be careful: in all other cases the Virtual Machine will freeze and can block your guest system too! Wanting to use Virtualbox as a host for Proxmox on a laptop is a common wish but can be tricky to get right.

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. In any case it's recommended to use for access to PVE VirtualBox's "Host-only Network" via "Host-only Adapter". For access to outside (internet) from PVE use VirtualBox's "NAT". Do not use (it's not reliable!)

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

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.

In principal we have from PVE's point of view 2 (type of) networks:

Default Network

Proxmox default network is set up at the last stage of configuration to e.g. IP address 172.241.0.101. It appears in PVE's configuration as bridge adapter vmbr0. The WEB GUI then runs on port 8006 answering to https.

Note: During installation PVE's Default Network is set to eth0 / vmbr0 - but since it is recommended to have NAT in connected to the first virtual NIC here you should use eth1 / vmbr0. You can this adapt in WEB GUI after installation! (How?)

Access to Internet

For accessing the internet use NAT - an address would be assigned by VirtualBox's DHCP service, usually something like 10.0.2.15 - But to have it under control you should not use DHCP but set the IP address in PVE manually and define the subnet manually too.

Define the Subnet for NAT

This has to be done in VirtualBox¥' Machine Settings. Set Adapter 1 to "NAT" and - the following has to be done on command line - assuming your machine's name is "proxmox-vm"

VBoxManage modifyvm "Proxmox" --natnet1 "192.168.11.0/24"

(Shouldn't that be 'modifyvm "proxmox-vm"'?)

Define the Address(es) in PVE

Assuming the NIC connected to "NAT" is eth0.

  • Make a bridge called vmbr1
  • Bridge eth0 to it
  • Assign an address from the NAT subnet to it, e.g. 192.168.11.15
  • Set default gateway to "2" in the NAT subnet, e.g. 192.168.11.2

Network in Containers or KVMs

In PVE's virtual machines both networks can be used by bridging to vmbr0 (Internal Network) or direct IP addressing (venet0 with address in NAT subnet; for Containers only, don't set both networks with venet0!).

Create Host-Only Network in Virtualbox

This network is to permit traffic from the laptop to the Virtualbox.

In Virtualbox, there may be a Host-Only network already configured. This is set up at the Preferences > Network > Host-only Networks tab. Each adapter has an IPv4 address + a IPv4 Network Mask, addresses can be served by a VirtualBox DHCP server, Proxmox PVE is best set up with a static address on the Host-Only network.

For example Virtualbox Host-Only network.png


Check from the host machine:

 $ ifconfig
       vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
       ether 0a:00:27:00:00:00 
       inet 172.241.0.100 netmask 0xffffff80 broadcast 172.241.0.127

Install PVE

1. Create a new Virtualbox Virtual Machine for Proxmox

Sample settings:

  • Name: Proxmox
  • OS Type: Linux
  • Version: Debian (64 bit)
  • Memory: 6GB
  • Disk: Use a SSD if possible. Preallocated might provide faster access.

2. Edit the settings

  • Audio: disable
  • Storage:
    • IDE - Select Empty - click IDE Secondary - select the disk symbol, pick ISO for Proxmox
  • Network:
    • Adapter 1: NAT (attention: NOT NAT-network!!)
    • Adapter 2: Host-only Adapter, vboxnet0; recommended leave the advanced settings as they are.

Start the Virtual Machine

Configure the Network

At the last step in PVE set up you will be asked for an IP address. Choose a static address in the IPv4 Network.

Proxmox in Virtualbox Network Setup.png

Try it!

PVE started in Virtualbox.png

https://172.241.0.101:8006/#v1:0:18:4::::::

Test access

  1. From the laptop you should be able to ping the static ip address you assigned
$ ping 172.241.0.101
PING 172.241.0.101 (172.241.0.101): 56 data bytes
64 bytes from 172.241.0.101: icmp_seq=0 ttl=64 time=0.579 ms
64 bytes from 172.241.0.101: icmp_seq=1 ttl=64 time=0.710 ms 
64 bytes from 172.241.0.101: icmp_seq=2 ttl=64 time=0.411 ms


  1. From the PVE machine you should be able to see the bridge

Network from within PVE.png

  1. But because the network is host-only, only the laptop can see the VM containing PVE

References