Serial Port Monitor is an advanced software solution for monitoring and recording COM port data. For more details see [[https://os.mbed.com/users/MaxCrash/code/RS232-Recorder-Record-and-analyze-data/wiki/Homepage]]

USB redirection to VMware

How to redirect USB modem to a VMware ESXi virtual machine

Hi everyone! Today I’ll tell you how to redirect a USB modem to a VMware ESXi virtual machine. In the same way, you can redirect a memory stick and some other USB devices. This long-established VMware function has its advantages and drawbacks, so we'll go over everything. In our organization, we’ve been testing said function for our servers’ monitoring and availability notification system so the designated employees can receive Zabbix notifications on an operational basis. Then again, I bet you’ll be able to adapt this function to your own needs.

What is USB redirection to VMware used for?

In most cases, people redirect USB devices to a particular virtual machine for the services that need a hardware key or a modem for correct operation (e.g. notification services). This mode is called Host-Connected USB Passthrough. Next, I’ll provide you with a list of requirements that must be met for this function to work properly.

USB redirection rules:

  • The first rule sounds very logical: one USB device can be added to one virtual machine. Said machine can have up to 20 USB devices, that’s enough and to spare.
  • Virtual Hardware should be 8 or higher
  • There must be a USB controller on a host. The ESXi host’s USB arbitrator can operate up to 15 controllers
  • Take note that whenever you perform a migration procedure (vMotion) on your VM, USB won’t migrate with it
  • Prior to adding a USB device, you’ll have to add a USB controller to your VM’s devices
  • Before you can disconnect a USB device from your VM, first you’ll need to disconnect the USB controller redirected to the Virtual Machine
  • You’ll have to disconnect USB devices from the VM before using memory or CPU hot add. An increase in resources will cut them off anyways and that may result in data loss.
  • You can’t start a VM from a redirected USB device

Here is a VMware’s list of the officially supported devices. It’s not exhaustive, so if your device isn’t there, it can still work just fine. Give it a try anyway.

https://os.mbed.com/media/uploads/MaxCrash/image9.png

How to redirect a USB flash drive and ZTE MF863 modem

Go to the virtual machine’s properties (don’t turn the VM off) and click “Add” https://os.mbed.com/media/uploads/MaxCrash/image1.png

First thing you need to add is USB Controller

https://os.mbed.com/media/uploads/MaxCrash/image11.png

Choose “EHCI+UHCI”

https://os.mbed.com/media/uploads/MaxCrash/image5.png

Click “Finish” to complete the first step.

https://os.mbed.com/media/uploads/MaxCrash/image6.png

Now let’s try to add a USB memory stick and a ZTE MF863 modem. Click “Add” again.

https://os.mbed.com/media/uploads/MaxCrash/image10.png

Choose the USB Device to add a USB device to VMware ESXi, and click “Next”.

https://os.mbed.com/media/uploads/MaxCrash/image2.png

The hypervisor will automatically detect your device. In my example, the first device in the list is Zalman external box ZM-VE400.

https://os.mbed.com/media/uploads/MaxCrash/image4.png

Look through summary statistics and click “Finish”.

https://os.mbed.com/media/uploads/MaxCrash/image12.png

As you can see, ZM-VE400 was successfully added.

https://os.mbed.com/media/uploads/MaxCrash/image13.png

Now, let’s do the same thing for ZTE MF 863. Note: I had to activate no CD-ROM mode for ZTE MF863 to be detected.

https://os.mbed.com/media/uploads/MaxCrash/image8.png

That’s all! MF863 has been added as well.

https://os.mbed.com/media/uploads/MaxCrash/image3.png

You can use VMware ESXi 5.5 command prompt to review the device list. Here is a command for VMware SSH:

<<code>>esxcli storage core device list | grep -i USB<</code>>

From the log output, you can see that my modem was in a dual mode and thus can’t be recognized as a USB device:

Is USB: false

Is Boot USB Device: false

Is USB: false

Is Boot USB Device: false

Is USB: false

Is Boot USB Device: false

Display Name: Local USB CD-ROM (mpx.vmhba34:C0:T0:L0)

Model: USB SCSI CD-ROM

Is USB: true

Is Boot USB Device: false

Display Name: Local USB Direct-Access (mpx.vmhba34:C0:T0:L1)

Is USB: true

Is Boot USB Device: false

How to reset your ZTE MF from a CD-ROM mode to a modem mode

Here is a list of commands you’ll need to enter for your ZTE MF to be recognized as a modem.

Note: Before you start, make sure you have Eltima Terminal software installed.

1. Connect to your modem using Terminal (see Windows Device Manager for port number and speed).

2.Enter command ATE1 to enable input text display (skip this step if you don’t need that)

3. Type AT+ZCDRUN=8 and press ENTER to unmount the CD-ROM

4. At this point, your terminal responds with something like this:

Close autorun state result(0:FAIL 1:SUCCESS):1

OK

5. Disconnect the modem from your PC and then plug it back in.

To enable standard mode, enter the command AT+ZCDRUN=9.

There is also a modem-only mode (you won’t be able to use a USB memory stick). Enter AT+ZCDRUN=E to enable and AT+ZCDRUN=F to disable this mode.

It is best to upgrade your firmware to the latest version. That worked like a charm for my ZTE MF863.

And here is another command showing more detailed information on the USB devices attached to ESXi

<<code>> lsusb -v <</code>>

This command’s output will look like this:

https://os.mbed.com/media/uploads/MaxCrash/image7.png

And there you go, easy as pie.


All wikipages