How To Set Up A USB-Over-IP Server And Client With Mandriva 2010.0

Version 1.0
Author: Falko Timme
Follow me on Twitter

This tutorial shows how to set up a USB-over-IP server with Mandriva 2010.0 as well as a USB-over-IP client (also running Mandriva 2010.0). The USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates "USB I/O messages" into TCP/IP payloads and transmits them between computers. USB-over-IP can be useful for virtual machines, for example, that don't have access to the host system's hardware - USB-over-IP allows virtual machines to use remote USB devices.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

This tutorial is based on AliRezaTaleghani's tutorial How To Modify Your Gnu/Linux Box To Serve As A USB Over IP Server, but I've adjusted it for Mandriva 2010.0 (server and client). If you want to use a Windows client, please take a look at AliRezaTaleghani's tutorial - that part is still the same.

In this tutorial I use the server with the IP address and the client with the IP address, both running Mandriva 2010.0. These settings might differ for you, so you have to replace them where appropriate.


2 Installing And Using USB/IP On The Server


First we load the usbip kernel module:

modprobe usbip

To check if it really got loaded, run:

lsmod | grep usbip

The output should be similar to this one:

[root@server1 administrator]# lsmod | grep usbip
usbip                  17988  0
usbip_common_mod       22168  1 usbip
usbcore               219188  2 usbip
[root@server1 administrator]#

To make sure that the module gets loaded automatically whenever you boot the system, you can add it to /etc/modprobe.preload:

vi /etc/modprobe.preload

There's no usbip package for Mandriva 2010.0, so we have to build it manually:

urpmi wget flex gcc gcc-c++ libsysfs-devel libglib2.0-devel
cd /tmp
tar xvfz usbip-0.1.7.tar.gz
cd usbip-0.1.7/src/
make install

usbip expects the file containing the list of known USB devices (usb.ids) in the directory /usr/share/hwdata, but on Mandriva 2010.0 it's located in /usr/share/usb.ids - therefore we create a symlink:

mkdir /usr/share/hwdata
ln -sf /usr/share/usb.ids /usr/share/hwdata/

Now we can start the usbip daemon:

usbipd -D
[root@server1 src]# usbipd -D
Bind usbip.ko to a usb device to be exportable!
[root@server1 src]#

Now attach a USB device that you want to export to the server - I'm using a SanDisk USB flash drive here.

Execute the command


to find the corresponding Vendor/Device ID which is in the form of:

Bus XXX Device YYY: ID VendorID:DeviceID

The output on my server is as follows:

[root@server1 src]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 058f:6362 Alcor Micro Corp. Hi-Speed 21-in-1 Flash Card Reader/Writer (Internal/External)
Bus 001 Device 003: ID 0781:5151 SanDisk Corp. Cruzer Micro Flash Drive
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
[root@server1 src]#

The Vendor/Device ID of my SanDisk USB flash drive is 0781:5151.

Now run

bind_driver --list

The output on my server is as follows:

[root@server1 src]# bind_driver --list
List USB devices
 - busid 1-4 (058f:6362)
         1-4:1.0 -> usb-storage

 - busid 1-5 (0781:5151)
         1-5:1.0 -> usb-storage

[root@server1 src]#

As you see, the Vendor/Device ID of my SanDisk USB flash drive (0781:5151) corresponds to the BUSID 1-5. We need this BUSID to attach the USB device to the server:

bind_driver --usbip 1-5
[root@server1 src]# bind_driver --usbip 1-5
** (process:5807): DEBUG:  1-5:1.0      -> usb-storage
** (process:5807): DEBUG: unbinding interface
** (process:5807): DEBUG: write "add 1-5" to /sys/bus/usb/drivers/usbip/match_busid
** Message: bind 1-5 to usbip, complete!
[root@server1 src]#

That's it, we can now use the SanDisk USB flash drive on a remote usbip client.

BTW, if you run...

netstat -tap

... you should see that the usbip daemon is listening on port 3240 so please make sure that this port isn't blocked by your firewall:

[root@server1 src]# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 *:nfs                       *:*                         LISTEN      -
tcp        0      0 *:41286                     *:*                         LISTEN      2258/rpc.mountd
tcp        0      0 *:3240                      *:*                         LISTEN      5780/usbipd
tcp        0      0   *:*                         LISTEN      2309/master
tcp        0      0   *:*                         LISTEN      1843/memcached
tcp        0      0 *:59887                     *:*                         LISTEN      1865/rpc.statd
tcp        0      0 *:sunrpc                    *:*                         LISTEN      1828/rpcbind
tcp        0      0 *:5555                      *:*                         LISTEN      1867/dc_server
tcp        0      0 *:ftp                       *:*                         LISTEN      2315/proftpd: (acce
tcp        0      0 *:44725                     *:*                         LISTEN      -
tcp        0      0 *:ssh                       *:*                         LISTEN      2185/sshd
tcp        0      0    *:*                         LISTEN      2309/master
tcp        0      0 *:https                     *:*                         LISTEN      2321/httpd
tcp        0    596            ESTABLISHED 2364/sshd: administ
tcp        0      0 *:netbios-ssn               *:*                         LISTEN      2164/smbd
tcp        0      0 *:sunrpc                    *:*                         LISTEN      1828/rpcbind
tcp        0      0 *:http                      *:*                         LISTEN      2321/httpd
tcp        0      0 *:48117                     *:*                         LISTEN      -
tcp        0      0 *:ssh                       *:*                         LISTEN      2185/sshd
tcp        0      0 *:microsoft-ds              *:*                         LISTEN      2164/smbd
[root@server1 src]#
Share this page:

0 Comment(s)