Create interfaces in rc.conf.

# vi /etc/rc.conf

cloned_interfaces="bridge0 tap1"
ifconfig_bridge0="addm tap1 addm re0 up"

Add modules.

# vi /boot/loader.conf

vmm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"
hw.vmm.topology.cores_per_package=2 

Add autostart tap interface.

# echo 'net.link.tap.up_on_open=1' >> /etc/sysctl.conf

Reboot server.

# reboot

Create directory for iso-images.

# mkdir -p /vm/iso

Create directory for virtual machine.

# mkdir /vm/w10

Go to this directory and create VM image.

# cd /vm/w10

# truncate -s 50G w10.img

Install bhyve firmware.

# pkg ins -y bhyve-firmwware

Download virtio-win driver.

# fetch https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.118-2/virtio-win-0.1.118.iso

Create install file.

# vi install.sh

#!/bin/sh

bhyve -c 2 -m 2G -H -w \
  -s 0,hostbridge \
  -s 3,ahci-cd,/vm/iso/windows10-install-cd.iso \
  -s 4,ahci-hd,w10.img \
  -s 5,virtio-net,tap1 \
  -s 29,fbuf,tcp=0.0.0.0:5900,wait \
  -s 30,xhci,tablet \
  -s 31,lpc \
  -l com1,stdio \
  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
  w10  

Give rights to execute and start script.

# chmod +x install.sh
# ./install.sh

Connect to server any vnc client and continue setup.

After finishing setup, shutdown guest os and kill process:

# bhyvectl --destroy --vm=w10

Edit install.sh

Change string:

-s 3,ahci-cd,/vm/iso/windows10-install-cd.iso \

on:

-s 3,ahci-cd,virtio-win-0.1.118.iso \

Run install.sh and connect with vnc client.

Install virtio driver.

In windows, go to: Net-KVM-w10-amd64 and click right button on netkvm, install.

Setup RDP connection and shutdown guest os.

Kill process.

# bhyvectl --destroy --vm=w10

Create boot file.

# cp install.sh boot.sh

# vi boot.sh

#!/bin/sh

bhyve -c 2 -m 2G -H -w \
  -s 0,hostbridge \
  -s 4,ahci-hd,w10.img \
  -s 5,virtio-net,tap1 \
  -s 30,xhci,tablet \
  -s 31,lpc \
  -l com1,stdio \
  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
  w10

Run boot.sh

Connect any RDP client to windows.