3.4. Assigning SR-IOV VF Network Adapter to Linux KVM VM

We have a virtual machine running CentOS 7. This virtual machine already has a primary network interface with IP address Our goal is to assign a function network interface created previously to this running CentOS 7 virtual machine.

We have identified the new virtual function network adapter as enp37s16 and can see that it appears as an available network interface on our hypervisor.


Now, let’s see how to pass through this network virtual function to a virtual machine in a persistent way.

  1. We will be using the Bus info in the next steps. However, you need to replace “:” and “@” with “_” when querying the device. For example, pci@0000:25:10:0 >> pci_0000_25_10_0.

  2. Gather information about the VF network adapter. Use virsh and the pci address in the format from the previous step.

    # virsh nodedev_dumpxml pci_0000_25_10_0
  3. Using the information highlighted in the image from the previous step, create an xml file to define the network interface.

    [root@vhs ~]# vim /tmp/vf.xml

    Attach the device using virsh. You can use the following flags:

    • –live - attach the interface to the running virtual machine

    • –persistent - use this network interface definition for future guest reboots (it doesn’t persist on host reboots)

    • –config - apply the changes after VM reboot


    Verify that the device has been attached to the virtual machine correctly.

  4. We have attached a virtual function network card to the virtual machine as a secondary network NIC. Let’s see the status of the network interfaces on the virtual machine before assigning the device.

  5. After assigning the device, we can see the new virtual function network adapter inside the virtual machine at the guest layer.


That’s all! Now, you can proceed with network interface configuration as in any regular virtual machine.