Vmware как пробросить usb
You are using an outdated browser. Please upgrade your browser to improve your experience.
You can add one or more USB passthrough devices from an ESXi host to a virtual machine if the physical devices are connected to the host on which the virtual machine runs.
If a USB device is connected to another virtual machine, you cannot add it until that machine releases it.
If you have the Apple Frontpanel Controller device in your environment, you can safely add it to a virtual machine. However, this device has no documented function and no known use. ESXi hosts do not use it and do not provide Xserver functionality for USB passthrough.
USB passthrough: проброс USB флешки/устройства в виртуальную машину на VMWare ESXi
30.07.2020
itpro
VMware, Виртуализация
комментариев 12
На хосте VMWare ESXi вы можете пробросить подключенное к хосту локальное USB устройство/флешку/диск внутрь виртуальной машины. Эта технология называется USB Passthrough и доступна, начиная с ESXi 4.1.
Предположим, наша задача – пробросить в виртуальную машину локально подключенный к хосту ESXi 6.7 внешний USB 3.0 диск. Доступ к диску нужен для быстрого копирования данных напрямую из ВМ на отдельный USB диск.
Особенности работы режима USB Passthrough в VMWare
Как вы уже поняли, режим Passthrough позволяет пробросить физическое устройство, подключенное к ESXi хосту, напрямую в гостевую ОС виртуальной машины. В режиме Passthrough (passing the device through) вы можете предоставить виртуальной машине прямой доступ к USB флешке/диску, модему, или целиком PCI/USB контроллеру.
Для проброса USB устройств в ESXi нужны несколько основных компонентов:
- Arbitrator – отдельный сервис на сервере ESXi, который выполняет сканирование подключенных физических USB устройств, отвечает за маршрутизацию трафика USB устройства между хостом и ВМ, управляет блокировкой доступа к устройству (только одна ВМ может использовать подключенное USB устройство). USB arbitrator одновременно может отслеживать до 15 USB контроллеров.
- USB контроллеры – USB контроллер должен быть установлен как на физическом хосте, так и на виртуальной машине.
Чтобы установить USB контроллер для ВМ на VMWare ESXi, откройте ее настройки и добавьте новое устройство — USB контроллер (USB controller). При добавлении USB контроллера нужно выбрать его тип:
- USB 2.0 (EHCI+UHCI) – контроллер с поддержкой USB 2.0 и USB 1.1 устройств;
- USB 3.0 (xHCI) – поддерживаются быстрые устройства USB 3.0, требуется версия virtual hardware 8 и выше.

USB Passthrough: проброс USB устройства в ВМ на ESXi
В нативном режиме USB Passthrough вы можете подключить физическое USB устройство с хоста в виртуальную машину VMWare.
Основные требования и ограничения такого способа проброса:
- Virtual Hardware 7.0 или выше;
- Вы можете предоставить прямой доступ к USB устройству только одной ВМ;
- Максимально количество проброшенных USB устройств для одной ВМ – 20;
- Не поддерживается загрузка ВМ с USB.
После добавления виртуального USB контроллера для ВМ, вы можете пробросить подключенный к хосту USB диск.

- В настройках ВМ добавьте устройство Host USB device и нажмите Add;
- В выпадающем списке выберите подключенное USB устройство, которое нужно добавить;
- Для поддержки vMotion для ВМ с подключенным физическим USB диском нужно включить опцию “Support vMotion while device is connected”;
- После этого USB диск должен появится внутри гостевой ОС виртуальной машины.
- Нельзя выключить ВМ или поставить на паузу. При включении такой машины ее нужно вручную смигрировать на хост, к которому подключено USB устройство;
- Не поддерживается режим DPM, т.к. vCenter может выключить хост с USB устройством для экономии электроэнергии;
- ESXi хосты с ВМ и физическим USB устройством должно быть доступны через vmk0 по порту TCP 902.
Если при добавлении нового USB устройства клиент vSphere пишет, что USB устройств не обнаружено (No available USB devices), значить ваш USB диск не поддерживается VMWare для проброса в таком режиме. Список совместимых USB устройств есть на сайте VMWare (он не очень большой). Смотрите секцию “USB Devices tested for Passthrough from an ESXi Host to a Virtual Machine in ESXi 6.7” в статье https://kb.vmware.com/s/article/1021345.

В этом случае вы можете с вашего ESXi хоста пробросить в ВМ USB контроллер целиком.
VMware PCI Passthrough (VMDirectPath): проброс USB контроллера в ВМ
Другой, менее удобный метод предоставления доступа из ВМ к физическому USB устройству – проброс целиком USB контроллера с ESXi хоста. Этот режим называется VMDirectPath. Для его использования чипсет сервера должен поддерживать Intel Directed I/O или AMD I/O Virtualization Technology (AMD IOMMU), и этот режим включен в настройках BIOS/UEFI.
Если на сервере установлен только один USB контроллер, при пробросе его в ВМ, вы не сможете использовать локально подключенные USB устройства хоста (клавиатуру, мышь). В этом случае лучше добавить в сервер дополнительный PCI USB контроллер.
Если на хосте имеется несколько USB контроллеров, вы можете идентифицировать подключенное USB устройство и номер контроллера через ESXi shell. Вывести список USB устройств:
lsusb -v | grep -e Bus -e iSerial
В выводе команду нужно найти строку USB накопителя, например:
Затем по номеру контроллера (Bus02 в этом случае) определяем root hub и его iSerial:
tail -f /var/log/vmkernel.log | grep -i USB
Если USB диск не определяется ESXi хостом, проверьте что служба запущена:
#chkconfig usbarbitrator —list.
Соответственно, мы получили номер USB контроллера, который нужно пробросить в ВМ.

- Чтобы пробросить физический USB контроллер, выберите ESXi хоста, на котором запущена ваша ВМ и перейдите в раздел Manage -> Settings -> PCI Devices -> Edit;
- В списке PCI устройств найдите и выберите нужный USB контроллер по его ID (в моем примере 00:1D.0, контроллер называется C610/X99 series chipset USB Enhanced Host Controller #1 Intel Corporation);
- Статус USB контролера должен смениться с Unavailable (This device is not currently available for VMs to use) на Available (This device available for VMs to use). Нажмите Ок.
- Для сохранения изменений нужно перезагрузить хост ESXi.
- После загрузки хоста, выключите ВМ и добавьте новое PCI устройство (New Device -> PCI Device -> Add). В выпадающем списке выберите ваш USB контроллер (например 0000:00:1D| Intel Corporation USB Chipset…).
Configuring USB Devices Passthrough from VMWare ESXi to a Virtual Machine
On your VMWare ESXi host, you can redirect an attached local USB device/flash drive/disk inside the virtual machine. This technology is called USB Passthrough and available starting from ESXi 4.1.
Suppose, our task is to redirect an external USB 3.0 drive locally connected to the ESXi 6.7 host into a virtual machine. We need to access a drive to quickly copy data directly from the VM to a separate USB drive.
VMWare USB Passthrough
The Passthrough mode allows to redirect a physical device connected to an ESXi host directly to the guest OS of a virtual machine. In the Passthrough mode you can grant a virtual machine the direct access to a USB drive, a modem or a PCI/USB controller.
To redirect a USB device in ESXi, you will need some main components:
- Arbitrator is a separate service on an ESXi host that scans connected physical USB devices, routes USB device traffic between a host and a VM, and controls access to a device (only one VM may use a connected USB device). A USB arbitrator can track up to 15 USB controllers simultaneously.
- USB controllers — a uSB controller must be installed both on a physical host and on a virtual machine.
To install a USB controller for a VM on VMWare ESXi, open the VM settings and add a new device — a USB controller. When adding a USB controller, select its type:
- USB 2.0 (EHCI+UHCI) – a controller supporting USB 2.0 and USB 1.1 devices;
- USB 3.0 (xHCI) – supports fast USB 3.0 devices, requires virtual hardware version 8 or higher.

Passthrough a USB Device to ESXi VM
In the native USB Passthrough mode, you can connect a physical USB device from a host to a VMWare virtual machine.
The main requirements and restrictions of this redirection method:
- Virtual Hardware 7.0 or newer;
- You can provide direct access to a USB device for one VM only;
- The maximum number of redirected USB devices for a VM is 20;
- A VM boot from the attached USB device is not supported.
After adding a virtual USB controller for a VM, you can redirect a USB drive connected to the host:

- Add a new Host USB device in the VM settings and click Add;
- Select a connected USB device from a dropdown list to add it;
- To enable vMotion support for a VM with a connected physical USB drive, check the Support vMotion while device is connected option;
- Then the USB drive will appear in the guest OS of the virtual machine.
- You cannot stop or pause a VM. If you turn on the machine, you must manually migrate it to the host the USB device is connected to;
- DPM mode is not supported, since vCenter can shutdown a host with the connected USB device to save power;
- ESXi hosts with the VM and a physical USB device must be accessible via vmk0 over TCP Port 902.
If when adding a new USB device a vSphere client shows a message that no USB devices has been found (No available USB devices), it means that VMWare doesn’t support your USB drive for redirecting in the USB passthrough mode. You can find the list of compatible USB devices on the official VMWare website (the list is not long). Check the “USB Devices tested for Passthrough from an ESXi Host to a Virtual Machine in ESXi 6.7” section in the article https://kb.vmware.com/s/article/1021345.

In this case you can redirect the whole USB controller to a VM from the ESXi host.
VMware PCI Passthrough (VMDirectPath): Redirect a USB Controller to a VM
Another, less convenient method to provide access to a physical USB device from a VM is to redirect the whole USB controller from the ESXi host. This mode is called VMDirectPath. To use it, your server chipset must support Intel Directed I/O or AMD I/O Virtualization Technology (AMD IOMMU), and this mode is enabled in the BIOS/UEFI settings.
If only one USB controller is installed on a server and you redirect it to a VM, you won’t be able to use USB devices connected to your host locally (keyboard, mouse). In this case, it is better to add an additional PCI USB controller to the server.
If a host has multiple USB controllers, you can identify a connected USB device and a controller number through the ESXi shell. To display the list of USB devices:
# lsusb -v | grep -e Bus -e iSerial
Find the line related to the USB drive in the output. For example:
Then identify a root hub and its iSerial by the controller number (Bus02, in this case):
tail -f /var/log/vmkernel.log | grep -i USB

If the USB drive is not detected by your ESXi host, make sure that the usbarbitrator service is running:
#chkconfig usbarbitrator —list
Stop the usbarbitrator service only if you want to access the USB stick directly from ESXi shell to copy files.
So we have got the number of the USB controller to be redirected to the VM.

- To redirect a physical USB controller, select the ESXi host your VM is running on and go to Manage -> Settings -> PCI Devices -> Edit;
- In the list of PCI devices select the required USB controller by its ID (in my example, it is 00:1D.0 , the controller is called C610/X99 series chipset USB Enhanced Host Controller #1 Intel Corporation );
- The status of the USB controller must change from Unavailable (This device is not currently available for VMs to use) to Available (This device available for VMs to use). Click OK;
- To save the changes, restart your ESXi host;
- After booting the host, turn your VM off and add a new device (New Device -> PCI Device -> Add). Select your USB controller in the dropdown list (for example, 0000:00:1D| Intel Corporation USB Chipset… );
In the VMDirectPath mode, you can redirect up to two physical PCI devices to a VM.
How to Passthrough USB Devices on VMware Workstation Pro 16 Virtual Machines
In this article, I will show you how to passthrough USB devices to your VMware Workstation Pro 16 virtual machines. So, let’s get started.
Table of Contents:
Configuring System-wide USB Passthrough Settings:
VMware Workstation Pro 16 has some system-wide USB passthrough settings. Depending on the system-wide USB passthrough settings, VMware Workstation Pro decides what to do with your USB device when they are first plugged into your computer.
To access the system-wide USB passthrough settings of VMware Workstation Pro 16, open VMware Workstation Pro 16 and click on Edit > Preferences as marked in the screenshot below.

Navigate to the USB tab, and you should see 3 options. Select the option that suits you the best and click on OK.
Ask me what to do – VMware Workstation Pro 16 will ask you whether you want to connect it to a virtual machine or connect it to the host (your computer) every time you connect a USB device to your computer.
Connect the device to the host – VMware Workstation Pro 16 will connect the USB device to the host (your computer) every time you connect a USB device to your computer.
Connect the device to the foreground virtual machine – VMware Workstation Pro 16 will connect the USB device to the virtual machine that you will be using when you’ve connected the USB device to your computer.

Setting Up Virtual Machines for USB Passthrough:
To enable USB passthrough for a VMware Workstation Pro 16 virtual machine, open the virtual machine and click on Edit virtual machine settings as marked in the screenshot below.

You must have a USB Controller hardware added to the virtual machine for the USB passthrough to work, as you can see in the screenshot below.

If the virtual machine does not have a USB Controller already, you can add one to the virtual machine.
Just click on Add… as marked in the screenshot below.

Select the USB Controller from the Hardware types section and click on Finish as marked in the screenshot below.
NOTE: At a time, you can add only 1 USB Controller to a virtual machine. You can’t add multiple USB Controllers to a virtual machine. As I already have a USB Controller added to my virtual machine, the Finish button is grayed out (disabled) in my case.

Once you’ve added a USB Controller to the virtual machine, you can configure the type of devices that you would like to share with the virtual machine.
Show all USB input devices – VMware Workstation Pro 16 will allow passthrough of USB input devices (USB 1.1 and USB 2.0 input devices) to the virtual machine.
Share Bluetooth devices with the virtual machine – VMware Workstation Pro 16 will allow you to share Bluetooth devices from your computer to the virtual machine.

You can also select a specific USB version from the USB compatibility dropdown menu, as marked in the screenshot below. Selecting a USB 3.1 should be fine for most cases.

Once you’re done configuring the USB Controller, click on OK.

Passthrough USB Devices to VMware Virtual Machines:
Once you’ve added/configured the USB Controller for the virtual machine, click on Power on this virtual machine to start the virtual machine.

The virtual machine should start.

If you insert a USB device on your computer, VMware Workstation Pro 16 will ask you what you want to do with the USB device.

To connect the USB device to the virtual machine, select Connect to a virtual machine, select the virtual machine where you want to connect the USB device and click OK.
You may also check to Remember my choice and do not ask again if you’re sure that you will be using that USB device only in this virtual machine. That way, VMware Workstation Pro 16 will not ask you to select a virtual machine again when you connect the same USB device to your computer. It will automatically connect the USB device to your selected virtual machine.

You can also click on VM > Removable Devices and passthrough a USB device to your virtual machine as marked in the screenshot below.
Just select the USB device that you want to connect to the virtual machine and click on Connect (Disconnect from Host).

Click on OK.

The USB device should be connected to your virtual machine, as seen from the lsusb command in the screenshot below.

Disconnecting USB Devices from VM:
To disconnect the USB device from the virtual machine, click on VM > Removable Devices. Then, select the USB device that you want to disconnect from the list and click on Disconnect (Connect to host) as marked in the screenshot below.

The USB device should be disconnected from the virtual machine, as you can see from the output of the lsusb command.

Conclusion:
In this article, I have shown you how to configure system-wide USB passthrough settings for VMware Workstation Pro 16. I have also shown you how to configure a VMware Workstation Pro 16 virtual machine for USB passthrough. I have shown you how to connect a USB device to a VMware Workstation Pro 16 virtual machine and disconnect it from the virtual machine as well.