How to use Physical Ethernet Port [update]

Hi! Im trying to create a new network.

lxc network create routerout parent=enp2s0f0

error:
Error: Invalid option for network “routerout” option “parent”

when I try to add the physical port directly to the LXD vm im getting this
lxc config device add routeros eth1 nic nictype=network parent=enp2s0f0 name=eth1

error:
Invalid devices: Device validation failed for “eth1”: Failed loading device “eth1”: Unsupported device type

lxc config device add routeros eth2 nic nictype=physical parent=enp2s0f0
error:
Failed to start device “eth2”: lstat /sys/bus/pci/devices/0000:02:00.0/iommu_group: no such file or directory

I need to use a Physical port to manage the outconnections from LXD VM… can be done?

[update]

I create a bridge using bridge-utils over the physical port. and later create a network using lxc network create and add device to the VM. exist another way to do this?

With virtual machines, using nictype physical means you’d be passing through the actual PCI-E device to the virtual machines, not just an network-interface, and for that you need to enable IOMMU. The virtual machine would then be using the PCI-E device directly, just like any non-virtualized machine would.

So, you need to enable IOMMU first, then you need to check, if the NIC you’re trying to pass through is in an IOMMU-group of its own, or if it’s grouped with other devices. If it is, that’s going to be another problem.

The Arch Linux wiki-page isn’t specifically for LXD, but it is still useful, since the same instructions apply: PCI passthrough via OVMF - ArchWiki

2 Likes

Thanks, just above on that page is how to enable it. Which maybe all you need to do.

https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#Enabling_IOMMU

1 Like