Setting Up USB over IP on OpenWRT

Setting Up Usb Over Ip On Openwrt

If you’re working with OpenWRT, the highly flexible, open-source firmware for routers, you probably already know that it can do far more than just direct traffic. But did you know it’s also possible to enable USB over IP on OpenWRT? This setup allows you to access USB devices connected to your router from any computer on your network, letting you connect storage drives, printers, and other USB peripherals without needing to plug them directly into your machine.

In this guide, we’ll walk you through everything you need to know to set up USB over IP on OpenWRT and unlock the full potential of your router’s USB port.


Why USB over IP on OpenWRT?

USB over IP is essentially a way to make USB devices available over a network. This means that USB devices connected to your OpenWRT router can be accessed as though they’re plugged directly into your computer—even if they’re in a different room. Here are a few use cases for USB over IP on OpenWRT:

  • Centralized Storage Access: Access a USB storage device connected to the router from any device on the network.
  • Networked Printer Setup: Share a single USB printer with multiple computers on the network.
  • Remote Device Management: Use tools like Zigbee or Z-Wave hubs connected to USB to manage smart home devices from a distance.
FeatureBenefit
Centralized AccessConnect to USB devices without needing long cables or individual device setups.
Cost SavingsAvoid the need for additional networking equipment by using the router you already have.
Flexible Device UseShare one USB device with multiple computers without plugging and unplugging.

What You’ll Need to Set Up USB over IP on OpenWRT

To make this work, you’ll need the following:

  1. OpenWRT-Compatible Router with a USB Port – Many popular router models can run OpenWRT and have a USB port.
  2. USB Device – This could be a USB storage device, printer, or even a Zigbee hub.
  3. Linux or Windows Client – We’ll show how to access the USB device on both Linux and Windows systems.

Software Requirements: We’ll use the USB/IP project, a free and open-source solution for sharing USB devices over a network.


Step 1: Install USB/IP on OpenWRT

Let’s get started by installing USB/IP on your OpenWRT router. USB/IP allows USB devices to be shared over the network, enabling devices like printers or storage to appear as if they’re connected locally.

  1. SSH into Your Router: Open a terminal on your computer and SSH into your OpenWRT router. Replace <router-ip> with your router’s IP address:ssh root@<router-ip>
  2. Update Package Lists: Run the following command to make sure your package lists are up-to-date:opkg update
  3. Install Required Packages: Install the USB/IP server and other necessary USB packages:opkg install usbip-server kmod-usbip kmod-usb-core kmod-usb-storage If you’re connecting a printer, also install:opkg install kmod-usb-printer
  4. Start the USB/IP Daemon: Start the USB/IP server on your router so it can share USB devices over the network./etc/init.d/usbip-server start Enable it to start automatically on reboot:/etc/init.d/usbip-server enable

Step 2: Bind Your USB Device to USB/IP

Now that USB/IP is running, let’s get your USB device connected.

  1. List Available USB Devices: Use the following command to see all USB devices connected to the router:usbip list --local You’ll see a list of USB devices and their IDs, typically formatted as <busid> like 1-1.
  2. Bind the USB Device: Bind the USB device to make it available over the network. Replace <busid> with the ID of your device from the previous command:usbip bind --busid=<busid>

Your USB device is now bound to USB/IP and ready to be accessed remotely.


Step 3: Accessing the USB Device from a Client Computer

Now that the USB device is available over IP, you can access it from another computer on the network. This can be done from either a Linux or Windows computer.

Linux Client

  1. Install USB/IP on Linux: If you’re on a Linux machine, you’ll need to install USB/IP:sudo apt update sudo apt install usbip
  2. Attach the Remote USB Device: Run the following command, replacing <router-ip> with the IP address of your OpenWRT router and <busid> with the USB device’s ID:sudo usbip attach --host=<router-ip> --busid=<busid>

Your Linux system should now recognize the USB device as if it were plugged in directly.

Windows Client

For Windows, USB/IP is available, but the process involves downloading additional tools since USB/IP isn’t natively supported.

  1. Download USB/IP for Windows: You can find the Windows USB/IP binaries on GitHub (search for “USB/IP Windows binaries”).
  2. Install the USB/IP Driver: After downloading, install the USB/IP driver by running usbip.inf.
  3. Connect to the USB Device: Open Command Prompt and run the following command, substituting <router-ip> and <busid> as needed:usbip.exe attach --host=<router-ip> --busid=<busid>

After this, the USB device should appear in your Windows system.


Use Cases for USB over IP on OpenWRT

Here are some popular use cases for USB over IP with OpenWRT:

Use CaseDescription
Networked PrinterShare a single USB printer with all computers on the network, eliminating the need for individual setups.
Centralized StorageUse a USB storage device connected to the router as a centralized storage solution accessible by all.
Smart Home IntegrationConnect USB hubs for smart home devices (like Zigbee) to manage devices remotely.

Each of these setups allows you to make the most of your OpenWRT router, transforming it into a hub for sharing USB devices across your home network.


Troubleshooting Common Issues

If you encounter issues during setup, here are some troubleshooting tips:

ProblemSolution
Device Not RecognizedDouble-check the USB device ID and make sure it’s correctly bound. Restart the router if needed.
Connection DropsEnsure stable Wi-Fi or wired connection between the router and client devices.
Device Not Appearing on ClientVerify that USB/IP is correctly installed on the client device and restart USB/IP services.
Permissions Issues on LinuxRun commands with sudo to avoid permission issues.

Pro Tip: For best performance, use Ethernet instead of Wi-Fi when setting up USB over IP, as it can reduce lag and improve data transfer speeds.


Final Thoughts: USB over IP on OpenWRT

While OpenWRT doesn’t have built-in support for USB over IP, combining it with USB/IP software creates a powerful, low-cost way to share USB devices across your network. Whether you’re managing a home office, sharing a printer, or accessing remote storage, USB over IP on OpenWRT gives you flexibility without the extra hardware or cables.

With just a bit of setup, you can transform your OpenWRT router into a central hub for all your USB needs. Give it a try and enjoy the freedom to access your USB devices from anywhere on your network!