Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

5.3. Using KVM virtio Drivers for Network Interface Devices

When network interfaces use KVM virtio drivers, KVM does not emulate networking hardware which removes processing overhead and can increase the guest performance. In Red Hat Enterprise Linux 7, virtio is used as the default network interface type. However, if this is configured differently on your system, you can use the following procedures:
  • To attach a virtio network device to a guest, use the virsh attach-interface command with the model --virtio option.
    Alternatively, in the virt-manager interface, navigate to the guest's Virtual hardware details screen and click Add Hardware. In the Add New Virtual Hardware screen, select Network, and change Device model to virtio:
  • To change the type of an existing interface to virtio, use the virsh edit command to edit the XML configuration of the intended guest, and change the model type attribute to virtio, for example as follows:
      <devices>
        <interface type='network'>
          <source network='default'/>
          <target dev='vnet1'/>
          <model type='virtio'/>
          <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off'/>
        </interface>
      </devices>
      ...
    Alternatively, in the virt-manager interface, navigate to the guest's Virtual hardware details screen, select the NIC item, and change Device model to virtio:

Note

If the naming of network interfaces inside the guest is not consistent across reboots, ensure all interfaces presented to the guest are of the same device model, preferably virtio-net. For details, see the Red Hat Knowledgebase.