Question for USB VM nic passthrough

Dears.

A question about pci nic passthrough.
Apologies if an answer exists for this.

I searched the forum but couldn’t find it.

If you can passthrough the pci nic to the vm, please tell me how.

Thank you very much.

Yep, you’d want something like:

  • lxc config device add VM1 eth1 nic nictype=physical parent=eth1

This will track down the PCI device for the interface eth1 on the host, detach it from the driver and pass the device to the VM.

An alternative would be:

  • lxc config device add VM1 eth1 pci address=PCI-ADDRESS

Which is a generic PCI passthrough device. The former is preferred as having it as a nic device means that LXD will place the device in a virtual PCI slot in the range we use for NIC devices. This should reduce the likelihood of the address on the guest’s PCI bus changing and so keep a stable interface name in the VM.

Thank you very much @stgraber.

01, My environment is nested vm
Levono p15s - windows 10 - vmware worstation 16 - ubuntu 21.04 - c01(vm, centos 8.4)

enx nic is a usb nic card that is passthrough from host (window10) to ubuntu. And passthrough this enx back to the vm. (nested passthrough)

  1. See the below pictures.

Thank you very much.

I don’t think we support non-PCI network cards at this time. As you say, this is a USB NIC.

One option you could do however is to use a NIC type of macvlan to use that parent NIC in your VM.

E.g.

lxc config device add VM1 eth1 nic nictype=macvlan parent=eth1

Dear @tomp and @stgraber .

It’s working very well.
The purpose of testing this is to test LACP on the vm.
Have a nice weekend.

Thank you very much. ^^

Great! The only limitations are that the VM won’t be able to communicate with the host (this is a limitation/feature of macvlan) and that it can only have 1 MAC address.

1 Like