[libvirt-users] VNC ports

Matthias Bolte matthias.bolte at googlemail.com
Sat Aug 13 16:15:56 UTC 2011


2011/8/12 Jeff <jwk1230 at gmail.com>:
> I am needing to explicitly assign VNC ports to my virtual guests so that I can connect to them externally via a VNC client, and not virt-viewer.  Since I will have multiple KVM Hosts with access to the same shared storage (to facilitate migrations) I need to ensure I have unique VNC ports assigned to each guest so that I don't overlap somehow.
>
> I had planned to use a range of ports starting at 51000 for this purpose.  While it works to assign port 51001, for example, to a guest and connect via my VNC client, when I run 'virsh vncdisplay guestname' it gives me back a different number that is specified in the XML file:
>
> #virsh vncdisplay win2k8guest
> :45101
>
> #virsh dumpxml win2k8guest |grep vnc
> <graphics type='vnc' port='51001' autoport='no' />
>
>
> Is there a logical reason for this that I'm not getting?  I know when I have the port set to 5907, for example, it returns something expected:
>
> #virsh vncdisplay win2k8guest
> :7
>
> But since I am likely going to need a good number of ports, I want to use a non-registered port range.  Any insights?

virsh vncdisplay gives you the VNC display number, not the VNC port
number. The common VNC port range starts at port 5900 and this maps to
VNC display 0. virsh vncdisplay gives you :7 for VNC port 5907 because
of this. This this is the expected behavior for virsh vncdisplay.

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvirt-users mailing list