Cookie
FlexiHub 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.
Olga Weis Olga Weis Aug 1, 2024

How to Share USB over IP With Raspberry Pi

Many people prefer to set up their own devices, and Raspberry Pi is a popular system for this purpose. There are numerous Raspberry Pi DIY projects available. This article focuses on creating USB over IP Raspberry Pi connections using top software solutions. We have tested and compared all of them so that you can choose the best one for your needs. If you don't want to read more, you can simply click the button below and try FlexiHub for Raspberry Pi USB over IP connections.

FlexiHub


Windows, macOS, Linux, Android 4.8 Rank based on 386+ Reviews
USB Devices over Ethernet With Raspberry Pi

As you may already know, there is a way to set up your Raspberry Pi as a USB-over-Ethernet server. Well, actually, there is not one, but three roads you can take here: an easy path with the hundred-per-cent efficient paid app or a bumpy ride with an open-source solution and its fiddly config process. And we’re about to take a look at all of them.

Quick and safe USB sharing from Raspberry Pi with FlexiHub

With the right USB-Ethernet extender software tool, sharing USB over IP from a Raspberry Pi is less than simple, and you won't have to buy any USB extension cables, extra gadgets, or layout miles of CAT5e or CAT6 LAN wire, or even use a USB to RS32 adapter.

How to sharing USB over IP from a Raspberry Pi
1
Register a FlexiHub account here and start a free demo period.
 register a FlexiHub account
2
Download and install the app on the server computer;
 download and install the app
3
In your Raspberry’s terminal, run the following command: yum install [package];
4
Start the app and click “Share” next to your USB device.

That’s it!

From that point on, the shared USB device will be remotely accessible from all computers with FlexiHub installed and an internet connection, regardless of the operating systems or physical distances involved.

Key Features:

Universal Solution:

Redirection USB Server: FlexiHub’s unique Redirection USB Server allows the app to work through all firewalls without requiring public IP addresses.

Peripheral Sharing: You can share a USB hub so that any peripheral connected to its USB ports becomes instantly available for remote connections with no additional configuration needed.

Enhanced Performance:

Traffic Compression: FlexiHub offers an optional traffic compression feature, which is particularly useful for bandwidth-sensitive USB devices like USB printers or web cameras. This means you don't need a high-speed 1 Gbps internet connection to make them work efficiently.

Security:

SSL Encryption: FlexiHub provides bulletproof 2048-bit SSL encryption to completely prevent unwanted access to your security cameras, USB dongles, or any data transmitted through FlexiHub.

USB over Network Raspberry Pi sharing - Video tutorial

A Free Way to Setup a Raspberry Pi as a USB-over-IP server

In principle, this method is similar to the one we've just described, but through the agency of a different USB to Ethernet extension app. And given that this time we’ll be using an open-source solution that's still in development, the set-up process requirements are there for a decent level of technical competence to perform so if you don’t have any, don't be surprised if it won’t work on the first go.

USB-over-IP server

Here are some more important points you need to consider before opting for this method:

  • Only works for sharing USB devices in your LAN.
  • Can’t share USB devices from a non-Linux machine.
  • This sharing method won’t work for USB hubs.
  • It's highly recommended to have at least a 100 Mbps connection.
  • The more the distance to the shared device — the worse the connection.
  • No protection from unauthorized access.
  • No traffic compression, so an image from remote cameras may lag a lot.

Let’s start the configuration process by setting up your Raspberry Pi as a server:

1
Install the app using this command: sudo apt install usbip
2
Once the installation is complete, add the kernel module we’ll need by entering:
sudo modprobe usbip_host
echo 'usbip_host' >> /etc/modules
3
Now, use the lsusb command to view a list of all USB devices physically connected to your Raspberry Pi and remember (or write down) the 8-digit USB ID number of a device you’re going to share.
4
Use the usbip list -p -l command to find out your device’s bus ID (use the USB ID number from a previous step to identify the right device on the list). Write down that number.
5
Run the command:
sudo usbip bind --busid=N
(N is the bus ID number from the previous step)
6
Run the demon to attach the device to the USB/IP by executing the command: usbipd

Alternatively, you can create a systemd service:

vi /lib/systemd/system/usbipd.service

with the following definition (don’t forget to change the N for an actual USB ID number of your device):


[Unit]
Description=usbip host daemon
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/usbipd -D
ExecStartPost=/bin/sh -c "/usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid=N#' | cut '-d#' -f1)"
ExecStop=/bin/sh -c "/usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid=N#' | cut '-d#' -f1); killall usbipd"
[Install]
WantedBy=multi-user.target



And then you'll need to run these commands to start that service:

sudo systemctl --system daemon-reload
sudo systemctl enable usbipd.service
sudo systemctl start usbipd.service

Ok, now let's set up a client:

Note: The app does have a client for Windows, but it’s a flimsy beta version with no signed drivers or any support for Windows 10, thus not really worth mentioning.

1. To install the same app for sharing USB over IP in Ubuntu, execute these commands:
sudo -s
apt-get install linux-tools-generic -y

2. Enable the required module:
modprobe vhci-hcd
echo 'vhci-hcd' >> /etc/modules

Now, to connect the shared device to this machine, run the command: sudo usbip attach -r 0.0.0.0
(type the actual IP address of your Raspberry Pi instead of 0.0.0.0)

Or you can create a systemd service:
vi /lib/systemd/system/usbip.service

With the definition (replace N with an actual USB ID number of your device and 0.0.0.0 with your Raspberry’s IP address):

[Unit]
Description=usbip client
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c "/usr/lib/linux-tools/$(uname -r)/usbip attach -r 0.0.0.0 -b $(/usr/lib/linux-tools/$(uname -r)/usbip list -r 0.0.0.0 | grep 'N' | cut -d: -f1)"
ExecStop=/bin/sh -c "/usr/lib/linux-tools/$(uname -r)/usbip detach --port=$(/usr/lib/linux-tools/$(uname -r)/usbip port | grep '<Port in Use>' | sed -E 's/^Port ([0-9][0-9]).*/\1/')"

[Install]
WantedBy=multi-user.target

Save, and then run these commands to start the service:

sudo systemctl --system daemon-reload
sudo systemctl enable usbip.service
sudo systemctl start usbip.service

After that, you should be able to access the shared device remotely. If not, try all the steps again from the very beginning.

Important! If you unplug a USB device from the Raspberry Pi while it’s shared by this method it may result in permanent data loss. Turn off your Raspberry first (after it’s off, you can also disconnect its AC adapter for extra precautions).

USB sharing with FlexiHub
30-day demo period

Video Tutorial for USB over IP Raspberry Pi

USB over IP Hub with Raspberry Pi and VirtualHere

Building a wireless USB over IP hub with a Raspberry Pi is a relatively simple exercise if you have the following two components.

  1. A VirtualHere USB server

  2. An operational Raspberry Pi module. The module must be Pi 3 or above running the Raspberry Pi OS and be equipped with USB ports and WiFi capabilities.

VirtualHere enables the sharing of network-attached USB devices. It’s a solution that lets you connect remote USB devices and use them as if they were directly attached to your local machine. A VirtualHere server allows you to remotely access USB devices like scanners, printers, and webcams from any location on your network.

How to use Raspberry Pi USB over IP capabilities to build a wireless USB hub


You can create a hub to support USB over IP using Raspberry Pi with the following steps.

  1. Login to Raspberry Pi using XRDP, SSH, or any other technique.

  2. Download the VirtualHere USB server plugin for Raspberry Pi with the following command:

    $ wget https://www.virtualhere.com/sites/default/files/usbserver/vhusbdarm

  3. Set the execution permission on the downloaded file with the chmod command:

    $ chmod +x vhusbdarm

  4. Run the VirtualHere USB server in the background using this command:

    $ sudo ./vhusbdarm -b
    See the available options by executing this command:
    $ ./vhusbdarm -h


  5. Download and install the VirtualHere client application on the client computers that will attach to a network-connected USB device.

  6. You can now access the USB device on the USB-disabled virtual machine. When the USB drive is connected, it will be displayed in the Raspberry Pi Hub.

Any type of USB device can be connected over the network with this method. The number of open ports presents the only limitation on the number of devices you can connect. You can also add a physical USB hub to provide more USB ports and enable you to connect additional devices.



Raspberry Pi USB over IP solutions comparison

Proxi-server Redirection Server
no need for external IP
multi-network communication
works through the Firewall
N/A N/A
Supported platforms
Server-side:
✓ Windows
✓ Linux
✓ macOS
✓ Android
✓ Linux
✓ Windows
✓ Linux
✓ Embedded
✓ Android
Client-side:
✓ Windows
✓ Linux
✓ macOS
✓ Windows
✓ Linux
✓ Windows (beta) Mac
✓ Linux
Firmware for microcontrollers Raspberry (upon request) N/A Raspberry
Security
Login tokens for safe account sharing
Lock for device access control
N/A N/A
Encryption 2048-bit SSL SSL, not from GUI SSL, for program
Enhanced stability Keep connection active option N/A N/A

Closing remarks


The decision of which method to adopt from the ones described in this article is entirely yours. However, it might be wiser to opt for a user-friendly tool with a track record of effectiveness rather than risking potential downtime, which could lead to considerable stress, time loss, and financial expenses. Choose what works best for you.


Top choice
FlexiHub
  • 4.8 overall rank based on 386+ Reviews
  • Windows, macOS, Linux, Android and Raspberry Pi.
  • 10.76MB Size.
  • Version 7.0.15125. (3 Jun, 2024).