With Windows Subsystem for Linux (WSL), you get the power of Linux within Windows, but WSL lacks built-in USB passthrough support. Fortunately, USB over IP offers a workaround for sharing USB devices across the network from WSL, even if a dedicated Linux machine isn’t available. While it requires a few extra steps, this guide will show you how to configure USB over IP on WSL so you can share or access USB devices remotely.
Here, we’ll walk through setting up USB over IP on WSL itself, without needing a separate Linux server.
Why Use USB over IP on WSL?
WSL offers a flexible environment, but it doesn’t support direct USB passthrough like native Linux systems. By using USB over IP, you can make USB devices accessible from WSL, allowing Linux tools within WSL to interact with USB devices connected to your Windows machine. This setup is ideal if you need Linux-based tools for managing USB devices but don’t have the option of connecting them directly to WSL.
| Benefit | Why It’s Useful |
|---|---|
| Remote USB Access | Access USB devices from WSL even if they’re physically connected to a Windows machine. |
| Increased Flexibility | Run Linux applications on USB devices without native passthrough. |
| Device Sharing Over Network | Share USB devices from your WSL instance to other computers on the network. |
Setting Up USB/IP on WSL to Access USB Devices from Windows
While WSL itself lacks direct USB support, you can share USB devices connected to your Windows machine to WSL using USB/IP. This approach leverages WSL’s network capabilities to interact with USB devices connected to the Windows host.
Here’s the setup:
Step 1: Installing USB/IP on WSL
To access USB devices over IP, you’ll need USB/IP installed in your WSL environment. USB/IP is available as an open-source tool for sharing USB devices over the network.
- Open Your WSL Terminal: Start by opening a WSL terminal (such as Ubuntu on WSL).
- Install USB/IP: Install USB/IP by running the following commands in WSL:
sudo apt update sudo apt install usbip - Load USB/IP Modules (if needed): USB/IP typically requires kernel modules (
usbip-coreandusbip-host) which are challenging to load in WSL due to the lack of full kernel control. However, WSL 2’s network layer lets you communicate with a USB over IP server running on your Windows host, so loading these modules within WSL isn’t necessary if Windows is hosting the USB over IP server.
Step 2: Setting Up a USB/IP Server on Windows
Since WSL alone cannot host USB devices, we’ll use USB Network Gate or an open-source equivalent on Windows to act as the USB/IP server, allowing WSL to connect to these shared devices over the network.
Using USB/IP for Windows (Open Source)
- Download USB/IP for Windows: USB/IP is available as a third-party open-source tool on GitHub (search for USB/IP Windows binaries). Download and install the necessary files to set up USB/IP on your Windows machine.
- Install the USB/IP Driver: Extract the files, right-click
usbip.inf, and select Install to add the USB/IP driver. - Start the USB/IP Server: Open a Command Prompt as Administrator and navigate to the USB/IP directory. Run the following command to list USB devices:
usbip.exe list --localThis will show all USB devices connected to your Windows host along with their bus IDs. - Share a USB Device: Use the following command to share the USB device by replacing
<busid>with the device’s actual ID:usbip.exe bind --busid=<busid>The USB device is now shared over IP, and WSL (or any other networked machine) can connect to it.
Step 3: Accessing the USB Device from WSL
With the USB/IP server running on Windows, WSL can now connect to the shared USB device.
- List Available USB Devices from WSL: In WSL, use the following command to check the list of USB devices shared by the Windows host. Replace
<windows-ip>with the IP address of your Windows machine:usbip list -r <windows-ip> - Attach the USB Device: To connect to the shared USB device, run the following command, replacing
<busid>with the device’s ID from the previous step:sudo usbip attach --host=<windows-ip> --busid=<busid> - Verify Device Detection: Once attached, the USB device should appear in your WSL environment. You can verify this by running Linux commands specific to your device type (such as
lsusbor other device-specific tools).
Using USB over IP on WSL for Practical Scenarios
Here are some real-world applications for using USB over IP on WSL:
| Use Case | How USB over IP on WSL Enables It |
|---|---|
| Remote Printer Control | Allows WSL-based applications to interact with a printer connected to the Windows machine. |
| Zigbee or Z-Wave Hubs | Use smart home tools in WSL to manage Zigbee or Z-Wave networks with a hub connected over IP. |
| External Storage Access | Mount USB storage devices in WSL for direct access to files and storage for Linux-based applications. |
By using USB over IP with WSL, you expand WSL’s capabilities and make it possible to use USB-dependent applications within WSL.
Troubleshooting Common USB over IP Issues with WSL
Here are some solutions for typical USB over IP problems with WSL:
| Issue | Solution |
|---|---|
| Device Not Recognized | Confirm correct bus ID and IP address, and verify the USB/IP server is running on Windows. |
| Connection Drops | Ensure both WSL and Windows USB/IP server are on the same network; avoid Wi-Fi for critical tasks. |
| Permissions Errors | Run WSL commands with sudo to avoid permission issues when connecting to USB devices. |
| USB/IP Driver Errors on Windows | Restart USB/IP service or reinstall the driver, as some Windows installations may need driver reinstalls. |
Security Tips for USB over IP on WSL
USB over IP offers great convenience, but it’s important to consider security, especially if devices are shared over a public or untrusted network.
- Use Secure Networks: Only access USB over IP on trusted networks, avoiding public or unsecured Wi-Fi.
- Limit Access: Configure firewalls to restrict access to the USB/IP server on Windows, limiting exposure.
- Use VPNs for Sensitive Devices: For extra security when accessing sensitive devices, use a VPN to encrypt your connection.
Expanding WSL’s Capabilities with USB over IP
With USB over IP, you can unlock powerful new functionality for your WSL environment. By setting up a USB/IP server on Windows, WSL can effectively access and control USB devices remotely, bridging the gap between Linux tools and USB functionality. Whether you’re managing smart home devices, accessing printers, or using specialized tools, USB over IP brings added flexibility to WSL.
So go ahead, bring your WSL setup to the next level—USB over IP makes it possible to access a world of devices right from your WSL terminal!




