Citrix Xen: How to connect to VM's VNC console without XenCenter

root's picture

In this example, the VM name is "debian".

Get the DOM ID of your VM:

[root@xengz ~]# xe vm-list params=dom-id,resident-on name-label=debian
resident-on ( RO)    : 3664c511-cd7b-4705-8fcb-31f8b82d46d5
         dom-id ( RO): 3

If you have multiple XEN servers, you will have to identify which one is running your VM along with the ip address:

[root@xengz ~]# xe host-list uuid=3664c511-cd7b-4705-8fcb-31f8b82d46d5
uuid ( RO)                : 3664c511-cd7b-4705-8fcb-31f8b82d46d5
          name-label ( RW):
    name-description ( RW): Default install of XenServer
[root@xengz ~]# xe pif-list management=true params=IP host-uuid=3664c511-cd7b-4705-8fcb-31f8b82d46d5
IP ( RO)    :

With the "dom-id" from the first command, execute the following command to get the VNC port:

[root@xengz ~]# xenstore-read /local/domain/3/console/vnc-port

Now, if you are in the same network, just fire up your desired VNC client against
However, if you are located in different network, you can create a ssh tunneling:
ssh -L 7777:localhost:5904 root@xen_ip

...and connect with your VNC client to localhost:7777


Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself!
Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.