Tuesday, 23 April 2013

vnc for virtual machines over the network

I have recently been playing around with Virtual machines quite a lot using ubuntu + libvirt + KVM etc. I keep coming across a problem which takes me ages to figure out but which should be simple.

Once I have started my vm and connected it to a VNC port I can never get to it over the network from a machine with a graphical interface. You are "supposed" to use ssh to create a secure tunnel to the vm host and connect VNC via that, this seems a bit of overkill however for a fairly secure LAN or if you are connecting via a management vlan that only admin's have access to.

It is probably worth noting that this could be a security risk, do some more research if you are not happy. I suspect that changing "0.0.0.0" in the following lines to "192.168.1.0" or "192.168.1.153" for example would restrict it to your local subnet or a specific machine (assuming the address range is right for your network) but I have not tested this so please don't quote me...

Anyhow, the file we need to edit is;

/etc/libvirt/qemu.conf

the line we need is;

# vnc_listen = "0.0.0.0"

remove the hash, save the file and restart qemu;

service qemu-kvm restart

That should do the job

No comments:

Post a Comment