migrating from proxmox to freebsd (part 12): bhyve
there are other options to use for virtual machines but i am going to go with the freebsd project standard, bhyve.
# kldload vmm
# editor /boot/loader.conf
...
vmm_load="YES"
this will load the virtual machine module for freebsd. for management i am going to go with vm-bhyve which is now part of the whole freebsd.org team of things. these instructions are taken directly from their github page.
1. pkg install vm-bhyve
2. zfs create pool/vm
3. sysrc vm_enable="YES"
4. sysrc vm_dir="zfs:pool/vm"
5. vm init
6. cp /usr/local/share/examples/vm-bhyve/* /mountpoint/for/pool/vm/.templates/
7. vm switch create public
8. vm switch add public em0
9. vm iso https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.2/FreeBSD-14.2-RELEASE-amd64-bootonly.iso
10. vm create myguest
11. vm install [-f] myguest FreeBSD-14.2-RELEASE-amd64-bootonly.iso
12. vm console myguest
i am going to do things just a little bit differently though because i already set up a bridge for jails. might as well keep that there.
# pkg install vm-bhyve
# zfs create platters/vm-bhyve
# zfs set mountpoint=/usr/local/vm-bhyve platters/vm-bhyve
# sysrc vm_enable="YES"
vm_enable: -> YES
# sysrc vm_dir="zfs:platters/vm-bhyve"
vm_dir: -> zfs:platters/vm-bhyve
# vm init
# ls /usr/local/vm-bhyve/
.config .img .iso .templates
# cp /usr/local/share/examples/vm-bhyve/* /usr/local/vm-bhyve/.templates/
# ls /usr/local/vm-bhyve/.templates/
alpine.conf centos7.conf debian.conf freebsd-zvol.conf linux-zvol.conf resflash.conf
arch.conf config.sample default.conf freepbx.conf netbsd.conf ubuntu.conf
centos6.conf
# vm switch create -t manual -b bridge0
# vm switch list
NAME TYPE IFACE ADDRESS PRIVATE MTU VLAN PORTS
public manual bridge0 n/a no n/a n/a n/a
since i have the jails in /usr/loca/bastille i thought it consistent to put vms in /usr/local/vm-bhyve. to each their own. since i have bridge0 running already for jails i went ahead and used the -t manual and -b bridge0 flags to add the virtual switch to bridge0. bridge0 is using lagg0 which in turn is using all the ports on the server. so my configuration is [ix0, igb0, igb1] ➡️[lagg0]➡️[bridge0]➡️vm-public(vswitch) if that makes any sense.
that should be it for the setup of vm-bhyve. i will test it later and see how it goes with debian or something since i had a bad go of debootstrap in freebsd (spat out some usr-is-merged error). tbf the resources saved by using linux jails probably doesn’t justify it but i wanted to at least have the option.