Lately I’ve tried to share some USB devices over TCP/IP network in Windows environment. It wouldn’t be a big problem at all, because there’re many commercial solutions for doing this which probably are doing their job just perfect, but because I needed a stable and free application, preferably a GPL one, I had to find some other solution to this problem.
I’ve googled a lot, browsed through many paid apps, but none of them fit my requirements. Finally I stumbled upon a small and simple project called USB/IP (http://usbip.sourceforge.net/) which seemed to me a good alternative to achieve what I wanted. Unfortunately the software didn’t allow me to share devices from Windows systems, but I’ve managed to find some workout to make it work.
The rest of this article will be dedicated to seting up a sharing of a USB device from Windows 7 SP1 32-bit machine to other workstations running both Windows 7 SP1 32-bit and Windows XP SP3 32-bit.
Before we get started we need to meet few initial requirements:
- have a Windows 7 SP1 32-bit workstation for acting as a server for our USB/IP service. This computer needs to have also VMware Player or some other virtual machine host software installed (like Oracle Virtualbox), however only the VMware Player was tested by me.
- have a Debian 6 ISO archive to install it in VMware Player.
- have a client workstation running on Windows 7 SP1 or Windows XP SP3 both in 32-bit versions, which will lease the device attached to USB/IP server (a).
OK, let’s get going. First, on a server (a) install desired virtual machine host software and install new Debian 6 virtual machine. I’m using Debian 6.0.4 with 2 virtual CPU’s, 64MB of RAM, 8GB HDD and a NAT’ed networking.
I won’t focus here on how to install Debian inside a VM, so if You aren’t sure what You’re doing please refer to wide variety of guides all over the Internet. I highly recommend to install Debian with SSH server, so you’ll be able to continue with next configuration steps by using Putty, rather than typing everything in the VMware Player window.
After Debian installation we need to adjust the NAT settings so the trafic from port 3240 of our host machine will be forwarded to Debian VM. In VMware Player this can be done by using vmnetcfg.exe tool. Please refer to guides on the Internet for an extended explanation how to get this tool and how to forward ports from host to NATed guests.
After the NAT adjustments we’re ready to proceed with the USB/IP installation on our Debian VM. For this purpose please follow the guide located at HowToForge.com.
If the installation finished without any problems You should be able to execute following command in the terminal or via Putty:
USB/IP version available currently in Debian 6 repositories is 0.1.7. Due to this fact we need two things for our Windows client machine (c):
- USB/IP for Windows version 0.1
- USB/IP for Windows version 0.2
In our configuration we will use usbip.exe file from version 0.1 because of the compatibility reasons (version 0.2 will not work with 0.1.7 installed on Debian server), and the driver from version 0.2 (it can be used acorss different versions of usbip.exe, this has been tested up to version 0.2). Both files can be downloaded from USB/IP Project site available at http://usbip.sourceforge.net/.
To install the driver in Windows XP unpack the archive usbip_windows_v0.2.0.0_signed, go to Control Panel, click on Add new hardware, select Device is already connected, Add new hardware device and Install new hardware from the list where you need to choose Show all devices and click on From disc button to point the system to the location where you unpacked USB/IP Enumerator drivers. After a while you can check in the Device Manager/, under System Devices branch, whether USB/IP Enumerator device is present. If it isn’t you need to retry the driver installation until new device will appear in the Device Manager.
Installed device driver in Device Manager should look as follows:
Driver installation in Windows 7 is not such complicated, because everything what you need to do in order to install the USB/IP Enumerator device driver in the system is right-click on the USBIPEnum.inf file from the unpacked archive and click on Install. Again, after a while you should check Device Manager to see if the installation was successful.
RESTART THE WINDOWS CLIENT MACHINE AFTER INSTALLING THE DRIVER! IF YOU MISS THIS STEP YOU WON’T BE ABLE TO USE USB/IP TILL YOU DO IT!
Did you restart the Windows box before reading further? NO!? So, go and do it now!
OK, since we’re back after the restart we can begin our tests. Whole server-client setup is already done in the previous steps so you can start the Debian 6 server, log in, switch user to root, plug in some thumb drive or other USB device you’d like to share and execute the following command:
This command should output with something like this one:
As you can see there’s some USB storage attached on port 1-2, so let’s try to share it!
Execute following command:
usbip_bind_driver --usbip 1-2
As a result you should see output similar to:
If that’s the case it means you shared your first USB device over TCP/IP network! Let’s go now to our Windows box to attach this device! Open a command prompt, change directory to location where you’ve unpacked USB/IP and execute following command:
usbip -l server_ip_address
This will list all shared devices on Debian server, so right now you should see only the information concerning device 1-2. Let’s attach this device by executing:
usbip -a server_ip_address 1-2
And after a while you should see information that new device has been attached (in this case it’s a thumb drive).
If you want to disconnect shared device from Windows box, just close the command prompt window where you’ve attached it.
If you need to connect the device back to USB/IP host system (Debian server) just execute command in terminal:
usbip_bind_driver --other 1-2
After this the device will be connected back to host system and clients won’t be able to use it.
Last thing you need to remember is that USB/IP software is able to share one device to one client at a time. In order to use shared device in another computer you need to disconnect it from the previous client.
That’s all in this article. I hope you enjoyed it! If you have any other question or doubts concerning this topic just let me know in the comments below. See you next time!