libvirt and bhyve

Testing libvirt and bhyve

  1. Make sure that in
    that the following is set:
  2. Make sure that in
    that there are no entries which create tap or bridge devices, such as
  3. Do:
    service local_unbound onestop
  4. Do: pkg install dns/dnsmasq to install the dnsmasq port.
  5. Install the
    port, version 1.2.6 or higher. Before building the port, do make config and make sure that BHYVE and QEMU options are enabled.
  6. Edit
    and add a line:
    log_level = 2
  7. Create a file
    with the following:
    <domain type='bhyve'>
        <clock offset='utc'/>
          <disk type='file'>
            <driver name='file' type='raw'/>
            <source file='/tmp/some_disk.img'/>
            <target dev='hda' bus='sata'/>
          <interface type='bridge'>
            <model type='virtio'/>
            <source bridge="virbr0"/>
          <serial type="nmdm>
            <source master="/dev/nmdm0A" slave="/dev/nmdm0B"/>

    Make sure that source_file points to a valid disk image that can boot in bhyve.

  8. Start libvirtd from the command-line:
  9. After starting libvirtd, verify that the virbr0 device was created with ifconfig:
    # ifconfig -a
    virbr0: flags=8843 metric 0 mtu 1500
            ether 02:29:45:c7:8f:00
            inet netmask 0xffffff00 broadcast 
            nd6 options=1
            id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 4
            maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
            root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
  10. Run these commands from the command-line using using virsh:
    virsh -c 'bhyve:///system' "define /tmp/bhyve.xml"
    virsh -c 'bhyve:///system' "start --console bhyve"
    If all the configuration steps were successful, then a bhyve VM should successfully start.

Further references