0.Update the binutils to the latest one from ports. We need to do this because the binutils that is shipped with base does not understand how to assemble the newly added VT-x instructions. pkg_add -r binutils Also make sure that your processor supports VT-x with nested page tables. Anything after 2010 should work just fine. 1.Check out /projects/bhyve and install world and kernel on the host. 2.Compile the bhyve guest kernel make -DNO_MODULES KERNCONF=BHYVE buildkernel Note that if you plan to use the pre-built guest kernel then you don't need to do this. See step (9) 3.Set the 'hw.physmem' variable in /boot/loader.conf to restrict the memory seen by the host kernel. The remaining memory is used to allocate to VMs. For e.g. the following line in /boot/loader.conf restricts the host to seeing only the first 4GB of physical memory. hw.physmem="0x100000000" 4.The vmm.ko module causes the kernel to spit out many, many witness warnings so for the time being turn off witness warnings by setting the following tunables in /boot/loader.conf. debug.witness.watch="0" 5.Reboot so that the newly installed kernel and the hw.physmem tunable take effect. 6.Load the following kernel modules: kldload vmm kldload if_tap 7.Create the tap0 interface ifconfig tap0 create 8.Check out /projects/virtio and make sys/modules/virtio 9.Create a VM boot area (for e.g. /usr/share/vm1) and populate it with the following: A pre-built tarball of the VM boot area is available at: http://people.freebsd.org/~neel/bhyve/vm1.tar.gz It was created as follows: mkdir /usr/share/vm1 mkdir /usr/share/vm1/boot mkdir /usr/share/vm1/boot/kernel cd /usr/share/vm1 cp ${OBJDIR}/sys/boot/userboot/userboot/userboot.so . # create the virtio backing disk device (32MB in size in this example) dd if=/dev/zero of=diskdev count=32768 bs=1024 cd /usr/share/vm1/boot cp /boot/*.4th boot cp -a /boot/defaults . cp /boot/loader.help . cp /boot/loader.rc . cp /boot/menu.rc . cat > loader.conf << EOF kernel="/kernel" virtio_load="YES" if_vtnet_load="YES" virtio_pci_load="YES" virtio_blk_load="YES" kern.hz="100" hw.pci.enable_msix="0" hw.pci.honor_msi_blacklist="0" bootverbose="1" mfsroot_load="YES" mfsroot_type="mfs_root" mfsroot_name="mdroot" EOF # Guest state cd /usr/share/vm1/boot/kernel # Copy guest kernel created in step (2) cp kernel.bhyve kernel # Copy virtio modules created in step (8) find /projects/virtio/sys/modules/virtio -name '*.ko' -exec cp {} ./ \; # Root filesystem for the guest cp /guest/memory/filesystem mdroot 10. start the virtual machine ./vmrun.sh vm1 11. Interacting with the virtual machine The virtual machine has two virtio devices connected to it vtnet0: virtual network interface that is connected to the host's tap0 interface vtbd0: virtual block device that uses the backing file /usr/share/vm1/diskdev on the host The pre-build root filesystem creates a VM with a "root" user without any password. It also configures the vtnet0 interface with an IP address of 192.168.1.1 12. stopping and exiting the virtual machine Type "quit" in the loader cli.