EVE-NG NESTED USB WIFI-NIC and ETHERNET-NIC Passthrough To VMs

I have an EVE-NG VM and I am passing through my USB ethernet and WIFI nics to it. Then I am passing those nics over to the guests running in labs.

Here is how to get this properly working, when editing your windows 7, 8, 10, or even linux guests, you need to change a few QEMU parameters.

Before you begin, you’ll want the latest QEMU drivers for your guest VMs to make sure all of this will work, and will work as fast as possible. Add these in yor VMs and commit them.

Now let’s begin.

First edit your EVE-NG VM in ESXI and add a USB controller and then add the host USB Devices:

Next SSH into your EVE-NG VM and run “lsusb” and grab the bus and host address of your device.

In my case it was host bus 1 host address 8 for the WIFI nic I am passing.

Then create a guest VM in a lab and use the following parameters or else it won’t work properly.

Before -usbdevice tablet add -device usb-ehci,id=ehci and then at the end after if=floppy,readonly add ,if=virtio -usb -device usb-host,hostbus=1,hostaddr=8

I have also had good luck with the following usb controller for the VM: -device qemu-xhci but it required raising my QEMU version to 2.12.0. Note that Windows 7 only supports usb-ehci not qemu-xhci.

So just pick one of those (esb-ehci or qemu-xhci) and try it.

Here’s my full example from a Windows 10 VM, you don’t need the cpu parameters I used but they speed up Windows versions after 2008r2 (7, 8, 10)

The full example I used: -machine type=pc-1.0,accel=kvm -cpu qemu64,+fsgsbase,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -vga std -device usb-ehci,id=ehci -usbdevice tablet -boot order=cd -drive file=/opt/qemu/share/qemu/virtio-win-drivers.img,index=1,if=floppy,readonly,if=virtio -usb -device usb-host,hostbus=1,hostaddr=8

Now start your guest and optionally get the drivers for the NIC

If you don’t do the ehci usb parameters you’ll find the NIC passes okay but doesn’t actually work.

If you want to add multiple devices, here’s how:

-machine type=pc-1.0,accel=kvm -cpu qemu64,+fsgsbase,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time -vga std -device usb-ehci,id=ehci -usbdevice tablet -boot order=cd -drive file=/opt/qemu/share/qemu/virtio-win-drivers.img,index=1,if=floppy,readonly,if=virtio -usb -device usb-host,hostbus=1,hostaddr=8 -device usb-host,hostbus=1,hostaddr=6<

Notice I just added a -device parameter.

Here's another example of this working with multiple nics on windows 10 except I used QEMU versino 2.12.0 and I used QEMU-XHCI which is a more mature usb emulator.

-machine type=pc-1.0,accel=kvm -cpu qemu64,+fsgsbase -vga std -usbdevice tablet -device qemu-xhci -boot order=cd -drive file=/opt/qemu/share/qemu/virtio-win-drivers.img,index=1,if=floppy,readonly,if=floppy,readonly,if=virtio -usb -device usb-host,hostbus=3,hostaddr=15 -device usb-host,hostbus=3,hostaddr=16

Sources:

For more info on USB pass through with QEMU go here