# PCI passthrough of host network interface into a guest VM

**URL:** <https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146>\
**Category:** Product Support\
**Created:** [May 28, 2024, 4:07pm UTC](https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146 "2024-05-28T16:07:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexk](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@alexk](https://forum.opennebula.io/u/alexk)\
**Post date:** [May 28, 2024, 4:07pm UTC](https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146/1 "2024-05-28T16:07:34Z")

</div>

Hi All,

I am trying to directly attach a host NIC to a guest VM.

I did enable IOMMU at the host, and adjusted the filters at `/var/lib/one/remotes/etc/im/kvm-probes.d/pci.conf` so as to be able to view the detected PCI devices at the host PCI tab.

When I try to attach a NIC using a PCI NIC device I get the error `ATTACHNIC: Missing VN_MAD, BRIDGE, TARGET or MAC in VM NIC` at the VM logs. This seems that I need to provide more information when defining the network but I am not sure what I am missing, since I just need to passthrough the device to the VM without defining any VLAN IDs or bridges. How can one attach such a physical device through the Sunstone UI? Is this only possible through raw xml injection into the VM template?

I am attempting this from the Sunstone UI at 6.8.0 OpenNebula version with a single KVM host.

## Thanks, Alex

**Versions of the related components and OS (frontend, hypervisors, VMs):**  
Host OS: 22.04.4 LTS (where Opennebula runs also)  
Opennebula: 6.8.0  
VM: Windows 11 64 bit

**Steps to reproduce:**  
Enable PCI detection at the host and try to attach one NIC directly to the guest VM as using a passthrough NIC device.

**Current results:**  
The NIC is not attached at the VM giving the error ` ATTACHNIC: Missing VN_MAD, BRIDGE, TARGET or MAC in VM NIC`  
**Expected results:**

---

<div class="post-metadata">

**Author:** ![alexk](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@alexk](https://forum.opennebula.io/u/alexk)\
**Post date:** [May 28, 2024, 8:55pm UTC](https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146/2 "2024-05-28T20:55:08Z")

</div>

Seems that one needs only to manually select the passthrough device using the short name of the specific interface, in case of multi-port NICs, and do this only while the VM is shutdown. I encountered a different bug though which seems to have been fixed at 6.8.2. [VM deployment fails with an error "XML error: Invalid PCI address 0000:01:01.0. slot must be \<= 0" if MACHINE=q35 · Issue #6492 · OpenNebula/one · GitHub](https://github.com/OpenNebula/one/issues/6492)

---

<div class="post-metadata">

**Author:** ![ruben](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/ruben/32/19_2.png) [@ruben](https://forum.opennebula.io/u/ruben)\
**Post date:** [June 14, 2024, 9:21am UTC](https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146/3 "2024-06-14T09:21:22Z")

</div>

Hi Alex,

Thanks for updating 🙂 So did you solve the issue? As for the other part, yes PCI attach is not supported while running so this needs to be at instantiation or in poweroff state (we have added recently this option for GPU’s as well).

Cheers

---

<div class="post-metadata">

**Author:** ![alexk](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@alexk](https://forum.opennebula.io/u/alexk)\
**Post date:** [June 14, 2024, 9:13pm UTC](https://forum.opennebula.io/t/pci-passthrough-of-host-network-interface-into-a-guest-vm/12146/4 "2024-06-14T21:13:49Z")

</div>

Thanks Ruben for asking. I did not solve the issue at the moment. I will need to wait when 6.8.2 or upper (which include the bug fix) is available for the CE edition as currently I am evaluating CE edition.
