1. What is virtualization
Virtualization, i.e. technology that allows creating a virtual version of a device or a resource, such as server, storage device, network or even an operating system, has been around for years. It offers you so many benefits that it is hard to imagine now that once upon the time we lived in ‘physical only’ world. But beware – virtualization has certain shortcomings too. One of them is having no access to USB ports, i.e. in Microsoft Hyper-V, VMware USB passthrough is not possible. This means you cannot use contents of a USB dongle attached to a host computer on virtual servers, and arises a questions how to connect USB to VMware virtual machine?
There are two main ways of going about this issue:
- Using third party software solutions that pass data of USB in VMware and other virtual environments
- Utilizing integrated methods of adding USB devices into virtual machines
2. Software to access USB in virtual machine
With the help of USB over Ethernet you get access to USB ports that are physically connected to the main (host) operating system of the computer where virtual OS is installed or any other remote computer no matter where it is actually located. USB Network Gate also enables you to pass data of remote USB device in virtual machine.
To create a virtual connection with the help of USB Network Gate do as follows:
- Install the application on the host and virtual machines;
- Share a USB device over network;
- Setup connection to USB device for a virtual machine.
The device is displayed in Device manager of your virtual machine and your OS sees it as it were directly inserted into your machine. One of the biggest advantages USB Network Gate offers is multiple OS support – Windows, Linux, Mac.
3. About VMware: Workstation and ESXi
VMware is an information technology company founded in 1998 to deliver various platform virtualization software and services. Now it takes one of the leading positions in the market of virtualization apps. VMware generally provides solutions of two types: desktop software and server applications.
The first category covers VMware Workstation - a hosted hypervisor working on Windows and Linux x64 platforms. With the help of VMware Workstation users can set up virtual machines (VMs) on their actual computer and run them concurrently with the physical device. That means a physical machine can execute multiple operating systems at a time, each on its own VM.
For those looking for a non-commercial use of the solution, the company offers a free VMware Workstation Player. And for Mac users, there’s a VMware Workstation analogue called VMware Fusion. This software makes it possible for Macs based on Intel processors to execute different OSes atop of macOS.
The second most popular VMware product is VMware ESXi, a type-1 (bare-metal) hypervisor which does not work as a typical software installed on an OS. ESXi comes with all crucial components of OS already included and runs right on the server hardware. As a result, a user doesn’t need to install any additional operating system.
4. Software solution for VMware USB redirection
The big advantage of the solution is that it’s capable of forwarding nearly any USB device across the Internet, local network or Ethernet. That means you don’t even need to have a USB device physically present near your host computer to enable VMware workstation USB passthrough. A simple installation of the program on both host and guest platforms will be enough to add USB to VMware virtual machine.
With its unique ability to redirect USB over IP to VMware, USB Network Gate opens new boundless opportunities for users working with POS equipment, automated industrial lines, mission-critical enterprise apps, etc.
Based on an advanced port virtualization technology, the utility can also easily share those particular USB devices that have never been supported by VMware solutions. For instance, if you try to access a mouse or a keyboard with a bootable HID interface from VMware ESXi, you’ll face a real problem, as these peripherals, as well as real-time video cameras and audio devices that use isochronous data transfers, cannot be redirected to VMware ESXi server by native methods. Thankfully, USB Network Gate can resolve this challenge once and for all.
Here’s all you need to do to enable VMware ESXi USB passthrough:
- Download USB Network Gate and install it on the computer where the required USB device is connected physically.
- Start the software and share the peripheral in the app’s interface.
- Install the program on a VM, launch it and connect to the shared device in the “Remote USB devices” tab.
USB Network Gate is cross-platform, so you can establish network communications between Windows, Linux and Mac machines in different combinations.
5. The native method to connect USB to VMware
- Following is the description of how to connect USB to VMware virtual machine running on VMware Workstation:
When you attach a USB device to a host PC, the device by default connects to the VM instead of the host computer. If it doesn’t, you’ll need to manually redirect the device to the virtual machine. If the device is connected to the guest OS, Workstation retains the connection to the host system’s USB port. In case you suspend the VM, power it off or unplug the device and then plug it again or resume the guest operating system, Workstation reconnects the device. If the device is not reconnected by Workstation but is still available, you can redirect it manually.
To do this: Choose VM > Removable Devices > Device Name > Connect (Disconnect from host). - To redirect USB devices to VMware ESXi you should follow these steps:
- Log into your VMware vSphere Web Client and access your Inventory.
- Open the list of Virtual Machines and choose the one to which needs to access the USB device. Right-click and select the “Edit” settings.
- Then, go to the “New device” menu, choose “Host USB device” and hit “Add”.
- In the drop-down menu, select the USB device that will be added to the virtual machine.
6. Connect USB device to a virtual machine
If you plug in a device into the host computer when a virtual machine is running and its window is active, the device automatically gets connected to the guest system instead of the host. You can disable the autoconnect feature in the USB Controller panel accessible via Virtual Machine Settings Editor.
If a USB device is attached when all the USB ports of the virtual machine are already occupied, a dialog box will be displayed. It will give you options either to disconnect one of the already connected devices so you can free up a port for a newly inserted device or ignore a new device. If you choose the latter, the device will be connected to the host.
If you would like to specify what USB devices are to be connected to a virtual machine, go to VM > Removable Devices. The max number of USB devices you can connect at a time is two. If a hub is used for connecting devices to the host, you will not see the hub, only the virtual devices.
Each of the USB ports has a menu item, hover over them to display a cascading menu of devices plugged into your host computer and available for use on your virtual machine. Clicking the name of a device will connect it to the virtual machine. If a device is already connected to that port, click the name of a newly attached device to release the first device and connect the new one.
To release a device, find a port to which it is connected and choose None in its cascading menu.
If a device is connected to the host machine, e.g. you plugged it into the computer while the autoconnect feature was disabled, you can connect it to the virtual machine manually via VM > Removable Devices menu.
7. How to mount USB drive to Hyper-V
To connect a USB drive to a virtual machine install it as virtual hard disk in Hyper-V virtual environment. You can do it if you know the size of the drive, to find it out on your host machine click Computer, find your removable disk, right-click to display the context menu and go to Properties. General tab will have information on the size of your hard drive in Bytes and GB.
How to install a USB drive as a virtual hard drive:
- Right-click on your Hyper-V server, choose New > Hard Disk, or do the same from Actions menu; follow the instructions.
- When prompted enter a name for your drive, click Next.
- Choose ‘Copy the content of the specified physical disk’ and enter the details to identify the disk.
Copying the content of the removable storage and creating the USB.vhd file might take a while, it depends on its size. The amount of free space does not matter, a vhd file is created with the entire size of the removable storage. - Choose Settings on your virtual machine, select SCSI Controller – see the left pane; select Hard drive – see the right pane, click Add.
- Click Browse and choose to open the vhd file to which you mounted your removable storage. Your removable storage should be displayed as a drive.
If ‘My Computer’ does not show it as a removable storage, it might be because the drive is offline. To check it, go to your VM, right-click Computer, choose ‘Manage’ or ‘Administrative Tools’ and go to Computer Management.
Expand Storage and select Disk Management. Red arrow icon means that the disk is offline, right-click the disk and in the context menu displayed select Online. Once your disk gets Online status, a drive letter will be assigned to it.
There are certain drawbacks to this method: you will have to reproduce the entire actions sequence for each USB drive connected to your Hyper-V virtual environment. As we already mentioned, creating a vhd file might consume some time, it directly depends on the size of your USB disk.