Vfio app to solve Truenas host<->VM connectivity

Sharing a small program I made to manage VF network devices and solve the pesky host<->guest VM connectivity problem with TrueNAS. It’s named vfnet, written in python, and can be grabbed with:

curl -LJO https://github.com/bryanvaz/vfnet/releases/download/v0.1.3/vfnet && chmod +x vfnet

If you’re using VMs with TrueNAS, or VMs in general, try it out and let me know what you think.

vfnet originally started as a simple python script to bring up VFs after being annoyed that the only way to give VMs on TrueNAS access to the host was to switch everything to static configs and use a bridge. However, as I added features to get the system to work, I realized that, outside of VMWare, there is really no simple way to use VFs, despite the tech being over a decade old and present in almost every homelab.

Right now vfnet just has the bare minimum features so I don’t curse at my TrueNAS box (which is otherwise awesome):

  • Creates VF network devices
  • Deterministic assignment of MAC addresses for VFs
  • Persist VFs and MAC addresses across reboot
  • Detect PF and VFs that are in use by VMs via VFIO.

All my VMs now have their own 10G/40G network connection to the lab’s infrastructure, and with no CPU overhead. In theory, it should be able to handle 100G without dpdk and rss, but to get 100G with small packets, which is almost every use case outside of large file I/O, dpdk is required.

You can checkout the github repo here:

I don’t have a full-fledged bench to test how VFs behave in other OSes and on other cards beside Intel X500, Intel X700 and CX3, so if you notice anything funny or quirky please open an issue.

1 Like