Install vm-bhyve:

pkg install vm-bhyve

Add to /etc/rc.conf:

vm_enable="YES"
vm_dir="zfs:zroot/vms"
vm_list=""
vm_delay="5"

Create /vms:

zfs create -o mountpoint=/vms zroot/vms

Initialize vm:

vm init

crete the switch:

vm switch create -i em0 -n 20 public

I am using interface em0 and vlan 20

Create ubuntu template: /vms/.templates/ubuntu.conf:

loader="uefi"
cpu=2
memory=2G
network0_type="virtio-net"
network0_switch="public"
disk0_name="disk0"
disk0_dev="sparse-zvol"
disk0_type="virtio-blk"
graphics="yes"

Download ubuntu:

vm iso https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-live-server-amd64.iso

Create VM using template ubuntu:

vm create -t ubuntu -s 40G m1

Install VM using the iso

vm install m1 ubuntu-22.04.1-live-server-amd64.iso

Use VNC client :5900

To stop/start:

vm stop m1
vm start m1

or using bhyvectl:

bhyvectl --destroy --vm=m1

To enable on boot the VM:

sysrc vm_list="m1"

If you have multiple VM's:

sysrc vm_list="m1 m2 m3"

To get a list of VM's:

vm list