How to connect a kvm guest via spice protocol

In this blog, I will show you how to connect a kvm guest by spice.

As you know first of all we have to edit the guest configuration file for “graphics” to be spice as shown below.

Hypervisor side modifications:

It may look like below in your system,

This can be changed as shown below:

The detailed description of above attributes can be found under

How-ever some mention about these attributes:

Port: This can be used to restrict the port range for the connection, if we dont want we could mention “autoport=yes” for assigning the ports automatically

listen: You can treat this as an acl for the connection

passwd: This would be the password for the spice session and NOT the password of the guest system.

Note that firewall rules to control connection to the VM would need to be done
on the hypervisor instead of on the guest VM. If you want to use SPICE without a password on the connection you need the “spice_password=” config line commented out in /etc/libvirt/qemu.conf config file.

Change video section of the xml as follows (default video hardware is “cirrus”)

Guest side modifications:
You have to use ‘qxl’ drivers inside the guest:

If you are using windows guest, the qxl drivers for the windows guest need to be installed. You may download a zip
file of a set of libraries and extract them. Then, you have to download the spicec binary and put it in the lib directory from the first zip extraction. For 64 bit windows installs, the 32 bit libraries had to be used because there only seemed to be a 32 bit spicec binary.

If you have RHEV ( Red Hat Enterprise Virtualization) subscription you can download ‘guest tools’ ISO which contains qxl drivers for the windows guest.

If you are with RHEL guest :

*)Red Hat Enterprise Linux 6: No modification required here.

*)On Red Hat Enterprise Linux 5.4 or higher : Modify “/etc/X11/xorg.conf” to use the qxl driver.

Section “Device”
Identifier “Videocard0”
Driver “qxl”

*) <=Red Hat Enterprise Linux 5.3 or Red Hat Enterprise Linux 4 : Do not have the “xorg-x11-drv-qxl” driver.

Spice Client modifications

Install spice-client

After performing above steps, now to connect guest using spice client, run following command

spicec -h -p5910&

To release the courser you can use Shift+F12.

Thats it 🙂