How to Set Up USB Network Adapter Passthrough in PVE 6.x

PVE USB passthroughiKuai soft routerUSB to RJ45 adapterProxmox VE 6.xnetwork virtualization
Published·Modified·

Recently, I installed a mobile enterprise dedicated line and planned to deploy a soft router. Currently, I only have a Tianbao Mini Host, but it has only one Gigabit network port, which is not suitable for use as a soft router. Therefore, I purchased a "USB to RJ45 Adapter" to add a network port and solve this problem.

Selecting a USB to RJ45 Adapter

When selecting a USB network adapter, the following requirements must be met:

  • Support Gigabit networking or higher
  • Support Linux (driver-free is best)

I focused on two USB network adapters:

I used the Ugreen one a long time ago, and the iKuai soft router could recognize and use it normally. This time, I plan to try the TP-LINK one. The price upon arrival was 79 yuan, slightly more expensive than the Ugreen one.

Hardware & Software Status

  • Hardware: Tianbao Mini Host * 1
  • Hardware: TP-LINK USB to RJ45 * 1
  • Hardware: 8-port Gigabit Switch * 1
  • Software: Mini host has PVE 6 installed and existing running services
  • Software: Plan to install iKuai soft router system in PVE 6 using a virtual machine

Installing iKuai Soft Router System in PVE 6

In the "PVE Backend - Datacenter - PVE - local", upload the ISO image just downloaded.

49735874ba07d436.png

Creating the virtual machine is not particularly special. Note that the CPU priority should be set high. The 64-bit iKuai system requires more than 4GB of memory, and I only allocated 15GB for the hard drive.

Setting Up USB Network Adapter Passthrough in PVE 6.x

First, insert the purchased USB network adapter into the USB 3.0 interface, then enable PVE hardware passthrough. The methods for Intel and AMD are different, as follows:

  1. Check if the system supports IOMMU

    First, you need to ensure that your CPU and motherboard support IOMMU technology (e.g., Intel VT-d or AMD-Vi).

    Execute the following command to check if IOMMU is enabled:

    dmesg | grep -E "DMAR|IOMMU"
    

    If you see output related to IOMMU or DMAR, your system supports it.

  2. Enable IOMMU

    If IOMMU is not enabled, you need to enter the BIOS/UEFI settings and enable Intel VT-d (for Intel platforms) or AMD IOMMU (for AMD platforms).

    At the same time, you need to enable IOMMU in Proxmox's GRUB configuration. For most systems, edit the /etc/default/grub file and add the relevant IOMMU options:

    • For Intel:
      GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
      
    • For AMD:
      GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on"
      

    Update GRUB and reboot the machine:

    update-grub
    reboot
    
  3. Find the PCI ID of the device to be passed through

    Use the following command to list all PCI devices:

    lspci -nn
    

    Find the network card you want to pass through and note its PCI ID (e.g., 02:00.0).

  4. Add device passthrough for Proxmox

    In /etc/pve/nodes/YOUR-NODE-NAME/qemu-server/YOUR-VM-ID.conf (where YOUR-NODE-NAME is your Proxmox node name and YOUR-VM-ID is the virtual machine ID), add the following line:

    hostpci0: 02:00.0
    

    Note: The PCI ID 02:00.0 above is an example; you should use the actual ID found in step 3.

  5. Start the virtual machine

    Now, when you start the virtual machine, the network card should be passed through to it, and you should be able to see the device in the virtual machine's operating system.

Please note that passing hardware through to a virtual machine may cause certain stability and security issues, so ensure thorough testing before using it in a production environment.

The above method was provided by ChatGPT and has been tested and works. However, in steps 3 and 4, since the USB network adapter does not belong to PCI devices, you should select USB instead of PCI when adding hardware. I operated through the PVE WEB interface, as follows:

『Select your virtual machine - Hardware - Add - USB device』

06a6b81b506632d8.png

Find the USB network adapter just inserted and add it.

3c42988620cf9ebf.png

Restart the iKuai virtual machine, and the network port will be recognized normally.

Other Notes

During the entire process, I did not install any additional network card drivers. If you, like xiaoz, need to install a soft router on a mini host but the mini host has only one network port, you can try using a "USB to RJ45 Network Adapter" to achieve this.