KVM: how to connect a USB GSM modem to a virtual machine

When we are virtualizing, either with VirtualBox o KVM, one of the problems we find is that sometimes the devices that we connect to the Host (Physical PC) cannot be viewed on the Client (Virtual PC).

VirtualBox has a Plugin to see the USB memories, and in the case of KVM it should not be a problem to see this type of device because the Kernel that we have installed is used directly. But the devices are not always shown, as in the example that we will see below, where a user needed to connect your GSM Modem via USB.

I found the article very interesting, so I am bringing them to you so you can see what he did.

Connect a USB GSM modem using KVM

1- Connect the modem to the PC and execute a command to find out some information:

$ lsusb Bus 001 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b: 0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 004 Device 002: ID 0557: 2221 ATEN International Co., Ltd Winbond Hermon Bus 002 Device 003: ID 12d1: 1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230 / E270 / E870 HSDPA / HSUPA Modem

In this case what the author needed was the last line, specifically the vendor ID number (12d1) and the product ID (1003).

When you run the same command on the client, as you can see, you don't get the same result:

$ lsusb Bus 001 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0627: 0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409: 55aa NEC Corp. Hub

Now the device must be defined in the client XML (VM). We can do this by directly editing the XML file using the command:

$ sudo virsh edit example-server.

The USB device must be added in the devices section:

[...] 
Notice that it has been added 0x in front of each ID

We save the file, restart the VM, and see if we can now see the connected device:

$ lsusb Bus 001 Device 001: ID 1d6b: 0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0627: 0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409: 55aa NEC Corp. Hub Bus 001 Device 004: ID 12d1: 1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E230 / E270 / E870 HSDPA / HSUPA Modem

And that's it.

Source: http://liquidat.wordpress.com


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   ignacio said

    What is the gui of kvm? is it in the debian repos?

    PS: excellent entry!

    1.    dhunter said

      virt-manager works very well, it's in the repo.

  2.   eliotime3000 said

    Very good tip. And on top of that, it has to serve me a lot when using my Malestar modem.

  3.   toñolocatedelano_e said

    Praise VMWare !!!!
    All one click away 🙂

  4.   thisnameisfalse said

    For those of us who do not want to save our system with graphical assistants, it can also be done by hand, launching qemu-kvm from the command line using the "-device pci-assign" argument, or if it is a hotplug device, from the QEMU monitor using the "device_add" or "device_del" commands.

    For more info:
    http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM

  5.   static said

    Excellent

    It helped me to connect WifiSlax with an external wifi antenna and be able to audit a Wifi network, I need a higher gain one (20 Dbi) but I think it is not the right place to ask it

    regards