Thu, March 29, 2018 ยท 1 min read

Enabling VNC access to KVM hosts on node

Enabling VNC access to KVM hosts on node

By default VNC listens only on localhost or its own IP address, to make libvirt VNC listen on all interfaces edit the file /etc/libvirt/qemu.conf and set vnc_listen = "0.0.0.0".

$ grep ^vnc_listen /etc/libvirt/qemu.conf
vnc_listen = "0.0.0.0"

To enable VNC on the VM edit the XML file and append the below line before <devices> tag:

<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'>
  <listen type='address'/>
</graphics>

Check where VNC is running

$ virsh vncdisplay linux1
:0

VNC port starts from range 5900, here :0 indicates port 5900.

Accessing the VM from any VNC viewer