Running Windows 2012-R2 under Bhyve

freebsd bhyve windows

Bhyve Preparations

  1. Install FreeBSD 11.0-RC2
    You can also install FreeBSD 11.0-RC1 or any latest builds.
  2. Retrieve the firmware binary
    We must install “bhyve-firmware”.the best way to achieve this goal is to install with the port mechanism. this process is very time-consuming and needs very user-interaction but with some tricks, we do it very easy:
    #cd /usr/ports/sysutils/bhyve-firmware
    # make install clean -DBATCH
    -DBATCH force port building process to not prompt you for confirmation and do it automatically.
  3. Hypervisor, Network and Storage Preparation
    # kldload vmm
    this command will load bhyve kernel module or driver.
    # ifconfig tap0 create up
    this command creates a new interface and makes it up. # ifconfig bridge0 create up
    this command also creates a bridge and make it up and ready.
    # ifconfig bridge0 addm em0
    this command adds em0(network interface) to bridge0
    # ifconfig bridge0 addm tap0
    this command add tap0 to bridge0.
    # truncate -s 50G disk.img
    this command create a file with 50GB size.
  4. Boot a Virtual Machine
    # bhyve -c 2 -m 4G -w -H \
    -s 0,hostbridge \
    -s 3,ahci-cd,/path/to/windows-2012R2.iso \
    -s 4,ahci-hd,disk.img \
    -s 5,virtio-net,tap0 \
    -s 29,fbuf,tcp=,w=800,h=600,wait \
    -s 30,xhci,tablet \
    -s 31,lpc -l com1,stdio \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    this command make a virtual machine(vm0) with 2 cores CPU and with a display resolution of 800 by 600 that can be accessed via VNC at:
    The fbuf wait parameter instructs bhyve to only boot upon the initiation of a VNC connection, simplifying the installation of operating systems that require immediate keyboard input. This can be removed for post-installation use.
    The xhci, tablet parameter provides precise cursor synchronization when using VNC, but is not supported by FreeBSD.
    Desktop versions of Microsoft Windows require the presence of a CD/DVD device, which can be an empty file created with touch(1).
    -H Yield the virtual CPU thread when an HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU.
    -w Ignore accesses to unimplemented Model Specific Registers (MSRs). This is intended for debugging purposes.
  5. Connect to VM with VNC client
    # vncviewer
    in VNC Client screen you can see what happening also mouse are supported. I prefer to use “tightvnc”.my hypervisor IP is “” and I have a DHCP on my network so windows get the IP address automatically.
  6. Setup Process
    setup process needs to restart VM.after each restart you must run it again until the setup completion.
  7. Virtio is a virtualization standard for network and disk device drivers where just the guest’s device driver “knows” it is running in a virtual environment and cooperates with the hypervisor. This enables guests to get high-performance network and disk operations and gives most of the performance benefits of paravirtualization.
    virtio can be downloaded from the below link:
  8. Setup NIC Driver
    after first login you must to shut down the VM and issue this command:
    # bhyvectl –destroy –vm=vm0
    # bhyve -c 2 -m 4G -w -H \
    -s 0,hostbridge \
    -s 3,ahci-cd,/path/to/virtio-win-0.1.118.iso \
    -s 4,ahci-hd,disk.img \
    -s 5,virtio-net,tap0 \
    -s 29,fbuf,tcp=,w=800,h=600,wait \
    -s 30,xhci,tablet \
    -s 31,lpc -l com1,stdio \
    -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
    after login to your desktop you can easily find proper driver and install it.then you can set IP and connect to your VM with remote desktop client.rdp is much faster than vnc.

You can get full edition at:

enter image description here