Bhyve(BSD Hypervisor) is an Open hypervisor developed on FreeBSD with features like EPT and Virtio. It is built in to FreeBSD from Version 10.0. In this procedure we will look at how to create a Basic VM using Bhyve.
Minimum Hardware required for bhyve are
- VT enabled Processor -Intel only (AMD is not supported as of 9/6/2014). For more details on Processor support refer to the following links. https://wiki.freebsd.org/bhyve/AMD
- 4GB RAM (Recommended)
- 7200 RPM HDD or higher
Basic configuration
Create bridge and tap interface
ifconfig bridge0 create ifconfig tap0 create sysctl net.link.tap.up_on_open=1
Add the tap interface “tap0” and ethernet interface “em0” to the bridge “bridge0”
ifconfig bridge0 addm em0 addm tap0
Bring up the bridge “bridge 0”
ifconfig bridge0 up
Copy the template file to the present folder
cp /usr/share/examples/bhyve/vmrun.sh bhyve1.sh
Issue execute permissions to the file
chmod +x bhyve1.sh
Change the configuration of the VM you are about to bring up. Edit the following lines for the virtual memory, no of cpus to be emulated and tap interface to be used
DEFAULT_MEMSIZE=512M DEFAULT_CPUS=2 DEFAULT_TAPDEV=tap0
Load the modules needed for Bhyve to work
kldload vmm kldload if_tap
Download a FreeBSD boot ISO file which has virtio feature, say FreeBSD10 boot only ISO.
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.2/FreeBSD-10.2-RELEASE-amd64-bootonly.iso
Create the HDD image file
truncate -s 10g bhyve1.img
Running the VM
Install OS on the VM using the following command by booting it off the ISO file.
./bhyve1.sh -i -I FreeBSD-10.2-RELEASE-amd64-bootonly.iso fbsd10