Electronic Team uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.

USB Redirection in KVM: Native method vs. USB Network Gate

Editorial Team Editorial Team Feb 27, 2025

USB redirection in Linux is necessary to use KVMs (Kernel-based virtual machines) for anything other than the most basic tasks. By default, only a keyboard and mouse are enabled in QEMU virtual machines, but you can redirect other devices, such as microphones, webcams, and storage devices into a VM with the help of QEMU/KVM native tools or a third-party solution, such as USB Network Gate.

Why USB Redirection in KVM?

USB redirection enables:

  • Access to physical USB devices like printers, webcams, and storage devices inside VMs.
  • The use of specialized USB hardware like security keys or diagnostic tools.
  • Redirection of USB devices over a network (with USB Network Gate).

Solution 1: Native Linux USB Redirection Using QEMU/KVM

QEMU, the emulator and virtualizer behind KVM, provides a built-in mechanism for USB redirection. You can either have the device connected on startup or use monitor commands to connect or disconnect USB devices while the machine is running.

A. Startup Options


This method only works if the device is already plugged in before you launch QEMU. Don’t forget to run QEMU with sudo, it’s necessary for USB access!
1
In order to redirect individual USB devices to QEMU, you will need to create a USB controller. Add the option -device qemu-xhci to your launch command.
 QEMU settings
2
To specify which USB device should be redirected, you should get its address from lsusb. Note the device and bus number of your device. If you’re unsure which number corresponds to your device, run lsusb while it’s unplugged and find which device appears in the output when you run it again.
 Screenshot with lush options
3
Add -device usb-host,hostbus=[your bus number],hostaddr=[your device number] to the launch command. In this example, the full command is:
 How to set up usb-host
4
If you want to check whether the device is connected successfully, use lsusb on the guest OS.
 Debian QEMU settings

Note: xawtv is a simple way to check whether your webcam is working, and xev or antimicro will help you test controllers such as keyboards and mice. Both are available on most popular Linux distributions.

B. Using the QEMU Monitor (hot swapping)


The QEMU monitor allows you to add redirected devices even while the machine is running.
1
Launch QEMU with the -device qemu-xhci option, but don’t specify any devices.
2
Switch to the monitor tab from the View menu.
 Switch to monitor tab
3
Use the device_add command with the same arguments you would use for the -device option.
 Add commands to the tab
4
Check that the device has been added with lsusb.

Note: if you’re planning to use device_del, make sure to add an id=[name of your choice] argument to the device_add command, so you can refer to the device you want to eject.

C. Add while Running with virt-manager


This method only applies to virtual machines that were created in virt-manager in the first place.
1
Open the virtual machine.
 Virtual Machine Screenshot
2
Expand the “Virtual Machine” menu, and select “Redirect USB device”
 Redirect USB device
3
Select the USB device to be redirected.
 USB device selection

D: Mount device on startup with virt-manager

1
Open the virtual machine.
2
Go to View > Details.
 USB device details
3
Click “Add Hardware”, select “USB Host Device”, and then your device.
 Adding the hardware

Advantages of the Native Linux Solution

Free and Open-Source: Fully integrated into QEMU/KVM.

Customizable: Allows fine-tuned configuration for specific devices.

Lightweight: No need for additional software.

Limitations

Local Access Only: USB redirection is limited to devices physically connected to the host.

Complexity: Command-line and XML configurations can be challenging for beginners.

Solution 2: USB Network Gate


USB Network Gate is compatible with a wide range of USB peripherals, many of which may not work properly with native KVM redirection. It also allows hot swapping without the use of console commands. However, in order for it to work, the KVM machine needs to be connected to your local network via a bridge or a TAP interface.
1
Download USB Network Gate on the host and guest OS.
 Download USB Network Gate for Linux
2
On both machines, run sudo dpkg -i on the downloaded package, and then sudo apt install -f. Python needs to be installed for the installation to be completed properly.
 USB Network Gate installation screenshot
3
Run eveusb on the host machine. In order to share devices, the app needs to be activated, but only on the host machine. You can apply for a free trial.
 Apply eveusb settings
4
Under the “Show local USB devices” tab, highlight the device that needs to be redirected, and click “Share”.
 Share USB devices screenshot
5
You can set various options for the connection before confirming the choice.
 Setting up various options before sharing USB device
6
Launch eveusb on the guest machine.
7
Switch to the “Remote USB devices” tab and click the Find button. You should be able to find the device on localhost.
 Find your remote USB device on localhost

Advantages of USB Network Gate

Network Access: Easily share USB devices over LAN, WAN, or the internet.

Cross-Platform Support: Works with Linux, Windows, and macOS.

User-Friendly: Simple interface with minimal setup required.

Limitations

Cost: USB Network Gate requires a paid license.

Dependency on Software: Both the host and guest must have the software installed.

Comparison: Native Linux vs. USB Network Gate

Cost
Free
Paid (license required)
Ease of Use
Moderate (GUI and CLI)
Very easy
Network Access
Not Supported
Fully Supported
Cross-Platform Support
Linux only
Linux, Windows, macOS
Ideal Use Case
Local USB redirection
Remote or networked setups

Which Solution is Right for You?


Choose the native Linux solution if:

  • You only need to redirect USB devices locally.
  • You prefer a cost-free, open-source approach.
  • You are comfortable with CLI or XML-based configuration.

Choose USB Network Gate if:

  • You need to redirect USB devices over a network or share them between multiple VMs.
  • You require cross-platform compatibility.
  • You prefer a user-friendly solution with minimal setup.

Conclusion

USB redirection in KVM is a powerful feature that can be achieved using either QEMU/KVM native tools or USB Network Gate. The native Linux solution is ideal for local, cost-free setups, while USB Network Gate provides advanced functionality for remote and networked environments. Depending on your use case, either solution can provide reliable USB access in virtualized environments.

logo USB Network Gate
#1 at Networking
USB Network Gate
Share USB over Ethernet on Windows
4.7 rank based on 372 + users