From 4001dbb28e352a7c7bd5d9a697ad2b6e375c34d3 Mon Sep 17 00:00:00 2001 From: Martin Wimpress <304639+flexiondotorg@users.noreply.github.com> Date: Sun, 12 May 2024 22:08:44 +0100 Subject: [PATCH] Added information about clipboard sharing and improve the networking section --- 05-Advanced-quickemu-configuration.md | 103 ++++++++++++++++++-------- 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/05-Advanced-quickemu-configuration.md b/05-Advanced-quickemu-configuration.md index 5ef4231..e5356b8 100644 --- a/05-Advanced-quickemu-configuration.md +++ b/05-Advanced-quickemu-configuration.md @@ -44,7 +44,7 @@ Arguments # Connecting to your VM -**SPICE** +## SPICE The following features are available while using the SPICE protocol: @@ -60,7 +60,7 @@ quickemu --vm ubuntu-22.04.conf --display spice To enable copy/paste with a Windows guest, install [SPICE Windows guest tools](https://www.spice-space.org/download.html) in the guest VM. -**Headless** +## Headless To start a VM with SPICE enabled, but no display attached use `--display none`. This requires that the `spicy` client is installed, available from the `spice-client-gtk` package in Debian/Ubuntu to connect to the running VM @@ -109,7 +109,7 @@ Add additional lines to your virtual machine configuration: - `ram="4G"` - Specify the amount of RAM to allocate to the VM - `disk_size="16G"` - Specify the size of the virtual disk allocated to the VM -**Disk preallocation** +## Disk preallocation Preallocation mode (allowed values: `off` (default), `metadata`, `falloc`, `full`). An image with preallocated metadata is initially larger but can improve performance when the image needs to grow. @@ -160,7 +160,7 @@ To set the display resolution on macOS, you will also need to install a 3rd part All File Sharing options will only expose `~/Public` (or localised variations) for the current user to the guest VMs. -**Samba** +## Samba Supported on Linux, macOS and Windows guests. If `smbd` is available on the host, Quickemu will automatically enable the built-in QEMU support for exposing a Samba share from the host to the guest. @@ -179,7 +179,7 @@ If everything is set up correctly, the `smbd` address will be printed when the v If using a Windows guest, right-click on "This PC", click "Add a network location", and paste this address, removing `smb:` and replacing forward slashes with backslashes (in this example `\\10.0.2.4\qemu`). -**SPICE WebDAV** +## SPICE WebDAV Supported on Linux and Windows guests. @@ -193,7 +193,47 @@ Supported on Linux and macOS guests # Networking -**Port forwarding** +Quickemu sets up User Networking, which provides a full TCP/IP stack within QEMU to implement a virtual NAT'd network, which is (10.0.2.0/24) by default. +From inside the guest, connecting to a port on the "gateway" IP address of 10.0.2.2 will connect to that port on the host; so for instance `ssh 10.0.2.2` will SSH from the guest to the host. + +## Disable networking + +To completely disable all network interfaces in a guest VM add this additional line to your virtual machine configuration: + +```shell +network="none" +``` + +Since Quickemu 4.9.5 you can also use the command line argument `--offline` to completely override any networking configuration and disable networking for the given VM. + +## Restricted networking + +You can isolate the guest from the host (and broader network) using the restrict option, which will restrict networking to just the guest and any virtual devices. + +This can be used to prevent software running inside the guest from phoning home while still providing a network inside the guest. Add this additional line to your virtual machine configuration: + +```shell +network="restrict" +``` + +## Bridged networking + +To connect your virtual machine to a preconfigured network bridge, add an additional line to your virtual machine configuration: + +```shell +network="br0" +``` + +If you want to have a persistent MAC address for your bridged network interface in the guest VM you can add `macaddr` to the virtual machine +configuration. QEMU requires that the MAC address is in the range: **52:54:00:AB:00:00 - 52:54:00:AB:FF:FF** + +So you can specify a MAC address with something like this in the VM configuration: + +``` +macaddr="52:54:00:AB:51:AE" +``` + +## Port forwarding Add an additional line to the virtual machine configuration. For example: @@ -206,53 +246,55 @@ In the example above: - Port 8123 on the host is forwarded to port 8123 on the guest. - Port 8888 on the host is forwarded to port 80 on the guest. -**Disable networking** +# Clipboard sharing -To completely disable all network interfaces in a guest VM add this additional line to your virtual machine configuration: +To share the clipboard between the host computer and the guest VM you need to use the SPICE viewer on the host and have the SPICE vdagent installed on the guest. + +## Host + +Start the VM with `--display spice`, for example: ```shell -network="none" +quickemu --vm nixos-23.11-gnome.conf --display spice ``` -**Restricted networking** +## Guest -You can isolate the guest from the host (and broader network) using the restrict option, which will restrict networking to just the guest and any virtual devices. +A growing number of Linux distributions including the SPICE vdagent in their live images. +The SPICE vdagent needs to be installed and running on the guest in order to share the clipboard. -This can be used to prevent software running inside the guest from phoning home while still providing a network inside the guest. Add this additional line to your virtual machine configuration: +### SPICE vdagent on Debian & Ubuntu + +On Debian and Ubuntu this can be installed as follows: ```shell -network="restrict" +sudo apt-get install spice-vdagent ``` -**Bridged networking** +### SPICE vdagent on NixOS -To connect your virtual machine to a preconfigured network bridge, add an additional line to your virtual machine configuration: +If you run NixOS you will need to enable the SPICE vdagent daemon, by adding the following to your configuration: -```shell -network="br0" +```nix +services.spice-vdagentd.enable = true; ``` -If you want to have a persistent MAC address for your bridged network interface in the guest VM you can add `macaddr` to the virtual machine -configuration. QEMU requires that the MAC address is in the range: **52:54:00:AB:00:00 - 52:54:00:AB:FF:FF** +### SPICE vdagent on Windows -So you can specify a MAC addresses with something like this in the VM configuration: - -``` -macaddr="52:54:00:AB:51:AE" -``` +If you created your Windows 10 or Windows 11 virtual machine with `quickget`, the required drivers were automatically installed. # USB redirection Quickemu supports USB redirection via SPICE pass-through and host pass-through. -**SPICE redirection (recommended)** +## SPICE redirection (recommended) Using SPICE for USB pass-through is easiest as it doesn't require any elevated permission: - Start Quickemu with `--display spice` and then - Select `Input` -\> `Select USB Device for redirection` from the menu to choose which device(s) you want to attach to the guest. -**Enabling SPICE redirection on NixOS** +### Enabling SPICE USB redirection on NixOS If you encounter this error when using NixOS as the host: @@ -260,15 +302,15 @@ If you encounter this error when using NixOS as the host: Error setting facl: Operation not permitted ``` -Try setting [the following option](https://search.nixos.org/options?channel=23.11&show=virtualisation.spiceUSBRedirection.enable&from=0&size=50&sort=relevance&type=packages&query=spiceusbredirec): +You need to enable SPICE USB Redirection, by adding the following to your configuration: ```nix virtualisation.spiceUSBRedirection.enable = true; ``` -**Host redirection (*NOT recommended*)** +## Host redirection (*NOT recommended*) -**USB host redirection is not recommended**, it is provided purely for backwards compatibility for older versions of Quickemu. Using SPICE is preferred, see above. +**USB host redirection is not recommended**; it is provided purely for backward compatibility with older versions of Quickemu. Using SPICE is preferred; see above. Add an additional line to your virtual machine configuration. For example: @@ -294,8 +336,7 @@ like this: # TPM Since Quickemu 2.2.0 a software emulated TPM device can be added to guest virtual machines. -Just add `tpm="on"` to your VM configuration. -- **NOTE!** `quickget` will automatically add this line to Windows 11 virtual machines. +Just add `tpm="on"` to your VM configuration; **`quickget` will automatically add this line to Windows 11 virtual machines.** # Desktop shortcuts