Notes:
- The following configuration was used on XenServer 6.0.2 and 6. I also used previous versions of USB-Redirector on instances of XenServer 5.x, but will not cover installation.
- The solution has been rigorously tested and is not supported by Citrix.
- This article does not go into detail on how to use the Linux command line. Please refer to the Linux documentation for more information if necessary.
Since early versions of XenServer 5 I wanted to run my print server as a virtual machine. The problem is that XenServer does not natively support USB passthrough anything but mass storage devices. It made me look at other solutions. One solution that is popular is the approach of the equipment used by companies like Digi. This approach works, but is prohibitively expensive for a very small home office deployment, which led me to look for a cost-effective software solution. At first I tried a few different implementations, but there were relatively few solutions that have allowed the use of Linux as a USB Network Server.
One that I found to work, and have used it for about 3 years now is USB Redirector Incentives Pro. The Linux-based server is actually free, but you pay for the client side when using Windows (as in my case). That said, I find this solution to be the most profitable at the time, and although I have not done extensive research in recent times, I am still waiting to be very, if not the most profitable.
Before someone suggests that Open Source USB / IP project would be more profitable, I tried using it after XenServer 6 was released. If memory serves, I think I had a little success with it, but use it with specific printers that I should not work properly. It offers hope for future implementation, but at the time I tried the project and XenServer stars are not aligned.
So before getting into the nitty gritty, here's what I had to do. I XenServer 6.0.2 running on a machine, and I wanted to connect a Sony UP-D75 printer picture in XenServer USB device and transmits it in a Windows Server 03 VM running on the same resource pool . The printer is quite old, and therefore they do not make a driver for newer operating systems, so I'm stuck with 03.
Now, without further ado ... the process.
Compiling the kernel module
- Download DDK for the version of XenServer you use http://www.citrix.com/English/ss/downloads/
- Inside ISO DDK is the DDK virtual appliance. Do one of the following:
- remove meter DDK ISO
- mount the ISO
- burn the ISO image to CD, insert the CD the maching running XenCenter
then imported via XenCenter
- Power on the VM DDK and answer questions firstboot
- log on to the DDK either at the console or through an SSH session
- Download Redirector for Linux from USB http://www.incentivespro.com/usb-redirector-linux-i386.tar.gz:
wget http: //www.incentivespro.com/usb -redirector-linux-i386.tar.gz
- Extract the archive:
tar xzvf uSB-redirector-linux-i386.tar.gz
- Change in the resulting directory:
usb cd-redirector-linux-i386
- Run the installation program to compile the kernel module and install in DDK:
./ installer.sh install-server
- Change to the parent directory:
cd ..
- Create an archive directory installing the kernel module compiled for your specific version of XenServer:
tar czvf uSB-redirector-linux-i386-XS6.0.2-53456p.tgz uSB-redirector-linux-i386
- Copy the archive to the correct version of XenServer that you want to install on: root@10.10.1.10
scp uSB-redirector-linux-i386-XS6.0.2-53456p.tgz: / root
If desired, uninstall the USB-redirector of the DDK
uninstall /usr/local/usb-redirector/uninstall.sh
this is all we will need the DDK, so you can do what you want.
now it's time to install on your XenServer
Installing USB Redirector on XenServer
- Log into your XenServer or at the console or through SSH session
- Extract the archive that you copied from the DDK:
tar xzvf uSB-redirector-linux-i386-XS6.0.2-53456p.tgz
- change in the resulting directory:
usb cd-redirector-linux-i386
- Then we need to change the setup so it does not try to compile the kernel module, we have already done. There are two ways to do it. The first is to make the changes manually using vi. If you are not comfortable editing text files on Linux, you can use the second method of applying a patch. complete the two following patterns:
Manual Patch
vi installer.sh
In usbsrv_install () function comment on the following 3 lines with hash marks (#)
if [ ! -d $KERNELDIR ] then exit_with_error "Kernel source or headers directory not found kernel. Please install the corresponding package first." fi
In usbsrv_make_kernel_module () function comment on the following 2 lines with hash marks (#):
do KERNELDIR = $ clean KERNELDIR> / dev / null 2> & 1 make MAKE_FLAGS $ $ $ KERNELDIR driver_config KERNELDIR => $ script_dir / buildlog.txt 2> & 1
Save and close the file
Automated patch
Download the patch and patchfile installer.sh .:
wget /blogs/wp-content/uploads/2012/02/installer.patch_.zip unzip installer.patch_.zip Patch installer.sh.patch -i
- Run the installer:
./ installer.sh install-server
- now, you must change the firewall settings so that customers can connect to your USB server:
vi / etc / sysconfig / iptables
add
state --state NEW tcp -m -m -A RH-Firewall-1-INPUT -p tcp --dport 32032 - j ACCEPT
before the declaration REJECT, by default, the third to the last line, making it look like the following:
... Status --state NEW tcp -m -m -A RH-Firewall-1-INPUT -p tcp - j ACCEPT state --dport 80 --state NEW tcp -m -A RH-Firewall-1-INPUT -p tcp --dport 443 j ACCEPT -A state RH-Firewall-1-INPUT --state NEW -m tcp -p tcp --dport 32032 j ACCEPT -A RH-Firewall-1-INPUT -j REJECT --reject-COMMIT with icmp-host-prohibited
- Restart the firewall service:
iptables restart services
kernel module Shades / driver
Depending on the device you are wanting sharing, there may be a driver installed on XenServer which will become active when you plug the device conflicts and provoke. In my case, I share a USB printer Sony. When I plug the printer, by default, grabs the driver usblp hold of the device, which is not what I want, then I have to turn it off. To determine if a driver is enabled for a given device BEFORE connecting the device, run the following command:
0 -fn tail / var / log / messages
This will keep a connection open the message file and if anything it writes messages will also be displayed in your session. In my case, the following messages were displayed when I plugged in the device:
February 29 1:48:35 p.m. schizo kernel: usb 2-4: new high speed USB device using ehci_hcd and address 5 February 29, 13: 48: 35 schizo kernel: usb 2-4: configuration # 1 chosen from 1 choice February 29 1:48:36 p.m. schizo core: usblp0: bidirectional USB printer if dev 5 0 0 proto alt 2 0x054C vid pid 0x0202 29 February 13: 48:36 schizo core: usbcore: usblp registered new interface driver
After disconnecting the device, the driver remains responsible usblp. This is determined by the following command:
lsmod | head
which in my case has produced the following output:
[root@schizo ~] # lsmod | Size head module Used by usblp 9577 0 iptable_filter 1277 1 ip_tables 8497 1 iptable_filter tusbd 32182 1 cifs 210827 4 nfs 257444 1 nfs_acl 2153 32640 1 nfs auth_rpcgss 1 NFS lockd 61583 1 nfs
To unload the module, the rmmod
rmmod usblp
To disable the module:
echo usblp blacklist> /etc/modprobe.d/blacklist-usblp
generically, this would be:
echo blacklist> /etc/modprobe.d/blacklist-
Sharing a USB device from XenServer
now it's time to share a USB device with your newly installed USB server. Connect a USB device that you want to share into the XenServer, and then share it with USB Redirector:
To find the options available to you:
usbsrv
To see the devices attached to the system and their status:
usbsrv -list
this is what I get on my server:
[root@schizo usb-redirector-linux-i386] # usbsrv -list ====== =========== USB SERVER OPERATION SUCCESSFUL =============== list USB devices: 1: Virtual Keyboard and Mouse American Megatrends Inc. Vid USB composite device: 046B Pid: FF10 Port: 1-3.1 Status: trendy 2: UP-D75 Sony USB printer Vid: 054c Pid: 0202 Port: 2-3 Status: trendy ================ ===== ======================= ===================
To share a USB device:
usbsrv -s 2
or
usbsrv -share -vid 054c -pid 0202 -usbport 2-3
now, notice the status "shared" for the Sony printer:
[root@schizo usb-redirector-linux-i386] # usbsrv -list ================= USB SERVER USE = = SUCCESS ============= list USB devices: 1: Virtual Keyboard and Mouse American Megatrends Inc. USB composite device Vid: Pid 046B: FF10 Port: 1-3.1 Status: trendy 2: UP -D75 Sony USB printer Vid: 054c Pid: 0202 Port: 2-3 Status: trendy, shared ===================== ======== == =================== =============
Connect to a shared device from a customer
to use the shared device on a client machine to download the client and connect to the USB shared resource. I used Windows and downloaded the v5.1 USB Redirector Client. After installing the client, run it.
You must add the license using "Enter the license key ..." from the Help menu.
After you "Add USB Server ..." from the Connect menu, using the XenServer IP address.
assuming that the server adds correctly, you can then click on the USB device and "Connecting USB Device" from the Connect menu.
then your device will be connected and you can install the driver for the device and start using it.
and that's all there is to it! Good luck!
0 Komentar