Trying to google ‘USB over IP’ doesn’t give much except some business web pages that give you it as a service. This brings some information about potential on the market IMHO. The main idea is well presented on open source project page for usbip. I really recommend reading USB/IP – a Peripheral Bus Extension for Device Sharing over IP Network the technical paper it describes briefly technical details and capability.

In short USB over IP is a sharing system aim to expose USB devices from the server to client encapsulating USB I/O messages in TCP/IP payload.

usbip contains client and server side (called stub and VHCI (Virtual Host Controller Interface). The stub is used on server side to hijack USB traffic from/to connected device and send/receive it over the network. VHCI expose stubbed device on the client side and also send and receive data to/from the server. We can say that stub-VHCI pair working as an intermediate layer in USB stack, giving the ability to connect to the network. usbip project provided both Linux and Windows version. In mid of 2008 usbip was introduced to Linux kernel and matured a while in the staging directory. A few days ago I read this was Greg KH mention that if it will be possible he will include usbip in 3.17-rc2.

As you can expect the biggest problem with USB over IP is how to handle 480Mbit/s (USB2.0) or more over TCP/IP payload. The answer is it can’t. The recommended use case for usbip is LAN environment with low latency. Of course, you can try using it over a long distance but the best effort you will get varies according to device and application profile. Author of the idea (Takahiro Hirofuchi) tested his solution and created some models for queue management for different devices – you can read about it in the technical paper. Below I present Kingston USB stick test in function of delay.

Seting up usbip

What I tried to do was setting up my Rasberry Pi and connect it through my home LAN to share USB device (Kingston DataTraveler). My configuration looks like that:


First I installed latest Raspbian. Assuming SD card is /dev/sdb:

With fresh SD card, we can boot and push finish on the initial setup screen. If you have DHCP set on your router that’s great if not you have to manually configure network inside RPi.

usbip kernel modules for RPi

usbip package is available in the Raspbian default repository. Fortunately for our learning purposes, usbip-core.ko and usbip-host.ko modules are not compiled in the kernel. What you can see when trying to run usbipd:

Let’s see if support for USBIP is in kernel:

Compiling Linux kernel on RPi can take a number of hours. I saw different values like 5-6, 10 and even 22. It depends on many factors. But we should not bother and try to cross-compile RPi on the development machine. I will use my Y510P laptop with i7 4700MQ 2.4GHz (4 cores).

I compiled kernel on 3.12.y branch. Go to Device Drivers -> Staging drivers -> USB/IP support. I choose to compile usbip-core as a loadable module. Device Drivers-> Staging drivers -> USB/IP support -> Host driver also is needed it compiles usbip-host module. Optionally Debug messages for USB/IP can be set if you want to see kernel debug messages from the driver. After saving changes to config file we can start compilation:

After finishing compilation we can move our image to SD card. First, mount your SD card (it won’t automatically) and run compile modules with the correct install path.

Now we can connect the card to RPi and boot it to check if the new kernel was correctly loaded.

Running usbip on RPi

Now on RPi we can load modules needed for usbipd and run it:

To what USB devices are connected to our system we can use:

This will show output similar to this:

busid 1-1.2 (0951:1625) is my Kingstone pendrive. If you are unsure which busid is for device that you want to share compare device id and vendor id with output of lsusb. To bind device to usbip-host.ko we should use:

As you can see communication to usbip-host module is through writing into sysfs file.

NOTE : if you will try to bind device without root privileges or when modules are not loaded you will get errors like below:

usbip – client side

Our device should wait for communication. Let’s go to client side of our LAN and try to check if we can use our USB device. To check if device is available:

Where is an IP of RPi. Everything seems to be ok. So let’s try to attach it and do some test:

Oops, looks like we don’t have a driver for client side. Let’s see if it is compiled into my kernel as a module:

Great so we can load vhci-hcd:

And attach pendriver from RPi. What we have to use is IP address and bus id.

In dmesg we can find information about our device.

Device show correct pieces of information in lsusb output and /proc/partitions.

Testing usbip

From the technical paper that I mentioned above, I understand that probably the most important factor for usbip performance is latency. The simplest method to emulate WAN delays is tc from iproute2 package. It is available by as default tool in Raspbian:

To test read speed I used dd by simply:

So I tried few values with my Kingston pendrive:

And something from gnuplot noob:



Before we can disconnect the device from RPi we have to do a few things. First, detach port to which remote device was connected. Which port?

Next, detach device you want to disconnect:

Finally, on RPi you can unbind device:

Now device can be removed.

Other devices

With various results, I tried other devices.

Android phone

I also tried to connect my Samsung GT-I9070. Unfortunately without luck:

I think it could be related with fact that my smartphone exposes multiple devices over one USB connection. What can be observed on usbip list:

I see this as opportunity to debug, understand and fix the driver.


There was no problem with Arduino. I was even able to program it successfully. Unfortunately to big delay (in my case 300ms) cause software errors:


Looks like usbip is usable in low delay network. It would be great to test it in real WAN. It is possible to use usbip with more sophisticated devices but potential driver tweaking is required. As a telecommunication graduate, I cannot say about possible improvements in queue algorithms, like adaptive queueing which depends on data transfer profile. It was an interesting experience to play with usbip and probably I will back to it, especially to testing part of this post.

If you have questions, suggestions or comments please let me know.