One of the little known and infrequently used features of vSphere since version 4.1 is the ability to connect a USB device to an ESXi host and then mount that device to a VM, and still allow vMotion to work without any problems. This is usually used for USB dongles required for software licensing, but can be used with a number of other devices. More often these days the USB connectivity is being used from a VMware Horizon View client to connect a USB device to a desktop. But if you’re 9000 miles away from your desktop, and you’ve been asked to connect a console cable to a physical network switch in the same location and run some debug commands, how can you do that? Well I figured it out and it makes for a good story.
I’ve been having a few weird things go on in my network with my home lab and from time to time the engineers I’m working with on this problem have asked me to run debug commands, which can only be run via the console to the switch. Usually this is no drama as I’m sitting right next to the switch and I have my console cable handy. However this week I’m in Boston, MA, and my lab environment is in Auckland, New Zealand (282ms RTT). So connecting up the console cable presenting a bit of a problem from 9000 miles away. Especially when I usually connect the console into my laptop, and in this case I have it with me. At least my VMware Horizon View virtual desktop was usable, almost to the point of not noticing the distance at all, even when using graphics intensive applications.
I figured that if I could get the console cable connected to the switch, I could connect it to a USB port on the back of one of my Nutanix ESXi hosts using a RS232 Serial to USB converter. From there I should be able to connect the virtual serial port to one of my virtual desktops. My first problem was getting all this connected.
Fortunately my 7yr old son Sebastian is pretty clever and often watches me as I pull my systems apart and put them back together. So I decided I would call him on FaceTime and walk him through the process of connecting up the console cable to the switch, and then into the back of one of my ESXi hosts. This was relatively easy, and using the FaceTime call I was able to verify that it had connected properly. As a reward I’ve bought Sebastian a T-Shirt from Cheers in Boston. I’m sure in the future his rates will go up. When I’m not around the house Sebastian takes the role of home tech support.
Next challenge was to find out which host the USB device was connected into, and then to connect it into my VDI desktop. After a quick search I found that using the command lsusb would tell me what devices were connected into my hosts. To save a bit of time I used a for loop to check all my hosts for the devices as follows (only works on Nutanix from one of the CVM’s):
for i in `hostips`; do echo “Host: $i”; ssh root@$i “lsusb”; done
That was easy. Identified which host the USB device is connected to. Now the fun part. Getting it connected to my VDI desktop, while I’m running on the VDI desktop. This is actually very easy. To start with all I had to do was vMotion my VDI desktop (while I’m accessing it) over to the host with the device connected. After that it’s just a matter of installing a USB controller on my desktop (in this case Windows 8.1), which is a simple hot add operation. I had to use the EHCI controller as xHCI didn’t work for this particular device. Within a couple of seconds Windows had detected and installed the correct driver for the USB controller.
Next step, connect the USB device. This turned out to be a little harder. I connected the device and it popped up in Windows, but it couldn’t find the right device driver. After a bit of surfing around I found the right driver and got it installed. Wala, I had a new USB virtual serial port inside my Windows VDI desktop, and could not connect that into Putty to use to access the switch. All of this was done line, using hot add features of vSphere and Windows, and all while I was accessing and vMotioning around the desktop I was connected to. This is how it looked in the virtual machine configuration once I had it completed:
USB Device support is different across the different versions of vSphere and dependant on whether you want to connect a local device directly connected to the ESXi host or via a client, including a View desktop. More information on USB device connections to ESXi and what is supported can be found in VMware KB 1022290.
Final Word
I was successfully able to get onto the console of my switch via Putty using this USB virtual serial port, connected into my Windows 8.1 VDI desktop, via VMware Horizion View from Boston, MA, to Auckland, NZ over a distance of 9000 miles (26 hr flight with layover time included). All without leaving my hotel room. I could collect the data and upload it to the engineers that are working on the problem with me. All while online using the same virtual desktop, including vMotioning it around my hosts, and all without losing connection to the USB device. A big thanks to my 7yr old son Sebastian, as I would not have been able to do this without his help.
—
This post first appeared on the Long White Virtual Clouds blog at longwhiteclouds.com. By Michael Webster +. Copyright © 2012 – 2014 – IT Solutions 2000 Ltd and Michael Webster +. All rights reserved. Not to be reproduced for commercial purposes without written permission.