Ethernet device passthrough
Industrial PCs with IOMMU support allow physical Ethernet devices to be explicitly assigned to a virtual machine. The virtual machine can thus be connected to a network directly via the physical Ethernet device, without network packets being switched via the TwinCAT/BSD host. The general procedure for assigning PCI devices is described in the chapter PCI device passthrough.
The following figure shows how the Ethernet device at PCI address 3:0:0 is passed through to the samplevm to connect the virtual machine to an external network.
The following bhyve call assigns the Ethernet device at the physical PCI address 3:0:0 to the virtual PCI address 20 of the virtual machine:
doas bhyve \
-c sockets=1,cores=2,threads=1 \
-m 2G \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_UEFI.fd,fwcfg=qemu \
-s 0,hostbridge \
-s 20,passthru,3/0/0 \
-s 31,lpc \
-A -H -P -S\
samplevm