Skip to content
Snippets Groups Projects
Commit a2e37dd7 authored by Florent Gluck's avatar Florent Gluck
Browse files

Updated README.md with usb redirection

parent ff2838ab
Branches
No related tags found
No related merge requests found
......@@ -165,6 +165,46 @@ Note that when attached to a VM's desktop (`vmattach` command), ctrl+F12 toggles
`nexus-cli` is another **nexus-client** in the form of a single native executable featuring pretty much the exact same commands as `nexush`. Therefore we won't list them here.
## USB redirection
USB redirection allows USB devices plugged in the PC running nexus client to be accessible in the guest OS of the VM running on the server.
When creating a new VM with `vmcreate`, you can specify USB devices that are accessible in the VM. A USB device is specified by two hexadecimal number, a vendor ID (`VID`) and a product ID (`PID`). For instance, the example below creates a VM and allows two USB devices, 067b:2303 (a USB/serial connector) and 0781:5567 (a SanDisk USB key) to be accessible in the VM:
```
vmcreate "usb test" 2 4000 none 067b:2303,0781:5567 fbccb584-9ea6-40f7-926d-dabf3970525e
```
If you wish to forbid all USB devices simply specify "none" instead:
```
vmcreate "usb test" 2 4000 none none fbccb584-9ea6-40f7-926d-dabf3970525e
```
To obtain the vendor ID and product ID of a USB device, run the `lsusb` command on Linux. The output should be similar to the one below, where the sixth column indicates vendor ID and product ID separated by a colon (`:`):
```
Bus 003 Device 026: ID 04d8:0b27 Microchip Technology, Inc. USB2734
Bus 003 Device 003: ID 0b0e:245d GN Netcom Jabra Link 370
Bus 003 Device 009: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer
Bus 003 Device 006: ID 046d:08e3 Logitech, Inc. C505 HD Webcam
```
### Vendor ID and product ID of USB devices of interest
| Device description | VID:PID |
|--- |--- |
| Atmel at91sam SAMBA bootloader | 03eb:6124 |
| Prolific Technology USB/serial | 067b:2303 |
| MyLab2 serial port | 0403:6015 |
| Digilent Analog Discovery 2 | 0403:6014 |
| NXP CMSIS-DAP | 1fc9:001d |
| Saleae Logic Pro 16 | 21a9:1006 |
| Peak USB CAN | 0c72:000c |
| Segger J-Link | 1366:0101 |
| Xilinx KV260 and KR260 JTAG and UART | 0403:6011 |
| Xilinx Nexys Video JTAG | 0403:6010 |
| Xilinx Nexys Video UART | 0403:6001 |
| USBest Technology USB key | 1307:0165 |
| SanDisk Cruzer Blade USB key | 0781:5567 |
## nexush usage examples
Launch `nexush` and log in as user `janedoe@nexus.org` (note that you will be prompted for your password):
......@@ -248,14 +288,14 @@ Kill VM `6713ce26-941e-4d95-8e92-6b71d44bf75a`:
vmkill 6713ce26-941e-4d95-8e92-6b71d44bf75a
```
Create a VM named "Doom", based on the `fbccb584-9ea6-40f7-926d-dabf3970525e` (Doom) template, with 4 CPUs, 4GB RAM, and a network interface with NAT translation:
Create a VM named "Doom", based on the `fbccb584-9ea6-40f7-926d-dabf3970525e` (Doom) template, with 4 CPUs, 4GB RAM, a network interface with NAT translation, and no USB devices:
```
vmcreate Doom 4 4096 user fbccb584-9ea6-40f7-926d-dabf3970525e
vmcreate Doom 4 4096 user none fbccb584-9ea6-40f7-926d-dabf3970525e
```
Create 50 VMs with the base name "ISC_433 Exam" based on the `6713ce26-941e-4d95-8e92-6b71d44bf75a` template, with 2 CPUs, 2GB RAM, and no network interface:
Create 50 VMs with the base name "ISC_433 Exam" based on the `6713ce26-941e-4d95-8e92-6b71d44bf75a` template, with 2 CPUs, 2GB RAM, no network interface, and no USB devices:
```
vmcreate "ISC_433 Exam" 2 2048 none 6713ce26-941e-4d95-8e92-6b71d44bf75a 50
vmcreate "ISC_433 Exam" 2 2048 none none 6713ce26-941e-4d95-8e92-6b71d44bf75a 50
```
It takes about 30 seconds and 11MB of disk space to create these 50 VMs.
They will have the following names:
......@@ -266,14 +306,14 @@ ISC_433 Exam [2]
ISC_433 Exam [50]
```
Edit VM `6713ce26-941e-4d95-8e92-6b71d44bf75a` by changing its name to "Tagada VM", changing it to 1 CPU and no network interface (`none`):
Edit VM `6713ce26-941e-4d95-8e92-6b71d44bf75a` by changing its name to "Tagada VM" and no network interface (`none`):
```
vmedit 6713ce26-941e-4d95-8e92-6b71d44bf75a name="Tagada VM" cpus=1 nic=none
vmedit 6713ce26-941e-4d95-8e92-6b71d44bf75a name="Tagada VM" nic=none
```
Edit VMs matching the "PCO lab2" pattern by changing their CPU to 1 core and a network interface with NAT translation (`user`):
Edit VMs matching the "PCO lab2" pattern by changing their CPU to 1 core, a network interface with NAT translation (`user`), and adding access to USB devices baba:0007 and 1234:abcd:
```
vmedit "PCO lab2" cpus=1 nic=user
vmedit "PCO lab2" cpus=1 nic=user usb=baba:0007,1234:abcd
```
Delete VM `6713ce26-941e-4d95-8e92-6b71d44bf75a`:
......@@ -425,7 +465,7 @@ First, you need to create the VM that will be used by the students during the ex
1. Create the VM based on the chosen template. Let's say you want the VM to be named "Exam ProgSys Oct2022" and you want it to have 2 CPUs, 3GB RAM and access to the Internet (for now):
```
vmcreate "Exam ProgSys Oct2022" 2 3000 user effefb49-0402-4095-a42d-1755937fe4b1
vmcreate "Exam ProgSys Oct2022" 2 3000 user none effefb49-0402-4095-a42d-1755937fe4b1
```
This command displays the name and ID of the created VM(s):
```
......@@ -482,7 +522,7 @@ First, you need to create the VM that will be used by the students during the ex
1. You can now create the VMs for your 30 students using your new template (ID `0fb0b1f2-c72c-416e-961a-6bb802da89bb`). Let's say the base name for the 30 VMs to create is "Live Exam ProgSys Oct2022". You want the VMs to have: 2 CPUs, 3GB RAM and no network interface to prevent any fraud. Create a CSV file, say `students.csv` with the names of your 30 students, one per line. Then, create the 30 VMs with:
```
vmcreate "Live Exam ProgSys Oct2022" 2 3000 none 0fb0b1f2-c72c-416e-961a-6bb802da89bb students.csv
vmcreate "Live Exam ProgSys Oct2022" 2 3000 none none 0fb0b1f2-c72c-416e-961a-6bb802da89bb students.csv
```
This command displays each VM created:
```
......@@ -653,4 +693,5 @@ On a Ubuntu/Debian system, the `qemu-guest-agent` service can be installed with:
sudo apt-get install qemu-guest-agent
```
Consequently, it is highly recommended to install it in all templates as it gives you more features and control over the VMs.
Consequently, it is highly recommended, if not already done, to install it in all templates as it gives you more
features and control over the VMs.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment