FreeBSD Virtual Machines on Microsoft Hyper-v
Hyper-V supports both emulated and Hyper-V-specific devices for FreeBSD virtual machines. When running with emulated devices, no additional software is required to be installed. However emulated devices do not provide high performance and cannot leverage the rich virtual machine management infrastructure that the Hyper-V technology offers. In order to make full use of all benefits that Hyper-V provides, it is best to use Hyper-V-specific devices for FreeBSD. The collection of drivers that are required to run Hyper-V-specific devices are known as FreeBSD Integration Services (BIS).
For older FreeBSD releases (before 10.0), Microsoft provides ports which is available here:
It contains the installable BIS drivers and corresponding daemons for FreeBSD virtual machines.
For newer FreeBSD releases, BIS is built in to the FreeBSD operating system, and no separate download or installation is required except for a KVP ports download that is needed for FreeBSD 10.0.
FreeBSD Integration Services (BIS) on Hyper-v
BIS provide Core, Networking, Storage, Memory, Video and other functionalities. For feature availability in each FreeBSD version, it is published here:
- Hyper-V drivers are included since FreeBSD 10.0
Ports for FreeBSD 8.4, 9.1~9.3 and KVP ports for FreeBSD 10.0
FreeBSD 10.1 and 10.2 users should refer to the below 2 errata to update the kernels. FreeBSD 10.3 has included the fixes.
1. “Hyper-V KVP (Key-Value Pair) daemon indefinite sleep (When FreeBSD 10.1 and 10.2 virtual machines run on Hyper-V, the host may not get the expected response of a KVP query. When such a virtual machine runs on Azure, the host may try to recover the "irresponsive" virtual machine by killing it and starting it later, causing unnecessary virtual machine downtime.)”:
https://www.freebsd.org/security/advisories/FreeBSD-EN-16:04.hyperv.asc (This applies to FreeBSD 10.1 and 10.2. )
2. “hv_netvsc(4) incorrect TCP/IP checksums(If the guest running on Hyper-V is configured as a gateway, the host will silently drop certain packets from the guest.)”:
https://www.freebsd.org/security/advisories/FreeBSD-EN-16:05.hv_netvsc.asc (This applies to FreeBSD 10.2.)
FreeBSD 11 users should refer to the below 1 errata to update the kernels.
3. "There are some compatibility issues with the FreeBSD Hyper-V driver, which will cause the OS disk to be detached if August 2016 update rollup is applied on Windows host (KB3172614 or KB3179574)."
1. During startup, device nodes are created as new devices are discovered. This can mean that device names can change when new devices are added. If you get a ROOT MOUNT ERROR during startup, you should create labels for each IDE partition to avoid conflicts and changes. As for how, refer to https://www.freebsd.org/doc/handbook/geom-glabel.html.
2. If the virtual switch on the host is based on wireless network adapter, reduce the ARP expiration time to 60 seconds by "sysctl net.link.ether.inet.max_age=60". Otherwise the networking of the VM may stop working after a while.
3. How to connect to Virtual Machine on Hyper-V through virtual serial? For Generation 1 Virtual Machine, it is straightforward to add hardware – COM. For Generation 2 Virtual Machine, follow below steps.
Set-VMComPort -VMName <vm_name> -number 1 -path \\.\pipe\Testpipe
2) Enable the serial in the VM. Below is the example of FreeBSD VM.
echo 'console="comconsole"' >> /boot/loader.conf
3) Use putty to connect to the named pipe which is \\.\pipe\Testpipe in above example.
Microsoft announces Hyper-V support for FreeBSD, August 9, 2012
FreeBSD Testimonials from Microsoft, August, 2015
FreeBSD Integration Services Team, email@example.com