SR-IOV (Single-Root I/O Virtualization) is the PCIe feature that lets a single physical NIC present itself as multiple virtual NICs — one physical function (PF) plus several virtual functions (VFs) — each independently assignable to a guest. Compared to virtio with a software bridge, SR-IOV cuts latency and CPU overhead because the guest talks to silicon directly. This article is the host enablement, the per-guest attachment, and the operational caveats for production use.
How to verify
Confirm the NIC supports SR-IOV (most modern Intel X710/E810, Mellanox ConnectX-4/5/6, Broadcom NetXtreme do; consumer NICs typically do not) and that the host has IOMMU enabled (a prerequisite shared with GPU passthrough VFIO IOMMU).
# Find SR-IOV-capable NICs
lspci -nn | grep -i ethernet
sudo lspci -vv -s 0000:01:00.0 | grep -iE 'SR-IOV|Total VFs|Initial VFs'
# IOMMU active (prerequisite)
sudo dmesg | grep -i -e DMAR -e IOMMU | head
ls /sys/class/iommu/
# Current VFs (zero before enabling)
cat /sys/class/net/enp1s0f0/device/sriov_numvfs
cat /sys/class/net/enp1s0f0/device/sriov_totalvfs
sriov_totalvfs tells you the maximum VFs the silicon will allow. sriov_numvfs is the current allocation — writing to it (as root) creates VFs.
What’s happening
A PCIe NIC with SR-IOV support exposes a single “physical function” (the regular driver-visible NIC) plus, on demand, a configurable number of “virtual functions” — additional PCIe devices that share the physical port’s bandwidth but appear as independent PCIe endpoints. The PF driver (e.g. i40e for Intel X710) registers each VF as a child device; a separate VF driver (iavf for Intel) handles the VF-side from the host or guest perspective.
The guest sees a VF as a real PCIe NIC. Frames the guest sends go through the PF’s internal switch and out the physical port; frames arriving for the VF’s MAC address are switched to the VF’s hardware queue. Throughput is wire-rate; latency is microseconds; the host CPU is essentially uninvolved in the data path.
The procedure
-
Enable IOMMU and SR-IOV in firmware. Same
intel_iommu=on iommu=pt(or AMD equivalent) on the kernel command line as for GPU passthrough. In firmware, look for “SR-IOV Support” — typically separate from VT-d/IOMMU. -
Create VFs at boot. A udev or systemd unit writes to
sriov_numvfson every boot. The maximum varies by silicon (16 to 256+ per port):# /etc/systemd/system/sriov-enp1s0f0.service [Unit] Description=Enable SR-IOV VFs on enp1s0f0 After=network-pre.target Before=network.target [Service] Type=oneshot ExecStart=/bin/sh -c 'echo 8 > /sys/class/net/enp1s0f0/device/sriov_numvfs' RemainAfterExit=true [Install] WantedBy=multi-user.target sudo systemctl enable --now sriov-enp1s0f0 ip link show enp1s0f0 # should show vf 0 .. vf 7 -
Pin VF MAC addresses. By default each VF gets a random MAC on every boot — guests behind them will see DHCP leases shift unpredictably. Pin MACs to the VF:
# /etc/network/interfaces (or your network manager) post-up ip link set enp1s0f0 vf 0 mac 52:54:00:11:22:33 post-up ip link set enp1s0f0 vf 1 mac 52:54:00:11:22:34 -
Find the VF PCI addresses. Each VF appears as its own PCI device:
lspci | grep -iE 'ethernet.*virtual function' # 01:0a.0 Ethernet controller: Intel ... Virtual Function # 01:0a.1 Ethernet controller: Intel ... Virtual Function -
Attach a VF to a guest via libvirt. Two patterns: a direct
<hostdev>with vfio-pci (raw passthrough), or a<network>of typehostdevwith an SR-IOV pool (libvirt picks an available VF for each guest). The pool pattern scales to many guests:<!-- The SR-IOV network pool --> <network> <name>sriov</name> <forward mode='hostdev' managed='yes'> <pf dev='enp1s0f0'/> </forward> </network>sudo virsh net-define sriov-net.xml sudo virsh net-start sriov && sudo virsh net-autostart sriovIn each guest XML, reference the pool:
<interface type='network'> <source network='sriov'/> <mac address='52:54:00:11:22:33'/> <model type='virtio'/> </interface> -
Boot the guest and confirm. Inside a Linux guest,
lspcishows the VF;ip linkshows the interface. Performance test withiperf3and compare to virtio over a Linux bridge — expect SR-IOV to be 2-5x lower CPU at the same throughput. -
Inspect from the host.
ip link show enp1s0f0shows which VF has which MAC and link state.
Operational notes
- VFs do not survive
ip link set downon the PF — bringing the PF down releases all VFs, which kicks the guests off. Treat the PF as the hypervisor’s data plane and avoid disturbing it. - Mixing VFs from the same PF across multiple guests is fine, but they share the physical port’s bandwidth — a noisy guest can saturate the link and starve the others. Configure VF rate limits via
ip link set <pf> vf <N> max_tx_rate <Mbps>. - Live migration of guests using SR-IOV is generally not supported — the VF state cannot be transferred. If live migration matters, use macvtap or virtio with vhost-net instead.
- The PF driver and VF driver must match — running an older kernel with a NIC firmware update that introduced new VF features sometimes leaves VFs that the host can create but the guest’s driver doesn’t fully support.
- VLAN tagging on SR-IOV VFs goes through the PF’s internal switch with
ip link set <pf> vf <N> vlan <id>— the VF guest sees untagged traffic; the wire sees tagged. This is how multi-tenant SR-IOV works.
Stack Harbor deploys SR-IOV for clients with latency-sensitive workloads — trading systems, real-time analytics, high-throughput packet processing — where the CPU savings and microsecond latency reduction matter. The trade-off (no live migration, hardware-specific tuning) is captured in the operational runbook, not surprising someone on day-90. The platform pattern is part of Managed Operations.