I have set up Xen + Ubuntu per the instructions at https://help.ubuntu.com/community/XenProposed. I am now ready to install a HVM guest OS (Ubuntu Desktop 12.04). After I start my HVM guest OS

xen create ubuntu-hvm.cfg

I need to now connect to it. I am connecting to the HVM guest OS on a Windows box using VNC Viewer. However, I can't connect:

unable to connect to host: Connection refused (10061)

On the Xen+Ubuntu box, Dom0, the LAN IP is Just as a sanity test, I pinged the following addresses while on the Dom0 console

ping localhost

All pings were successful. Then I tried to telnet via port 5900.

telnet localhost 5900
telnet 5900
telnet 5900

The last telnet to the LAN IP does not work:

telnet: Unable to connect to remote host: Connection refused

I also checked to make sure port 5900 was opened.

sudo netstat -tcp --listening --programs

I got the following information.

Proto Recv-Q Send-Q Local_Address        Foreign_Address State  PID/Program_name
tcp   0      0      localhost:5900       *:*             LISTEN 2097/qemu-dm
tcp   0      0 *:*             LISTEN 5653/dnsmasq
tcp   0      0      *:ssh                *:*             LISTEN 1198/sshd
tcp   0      0      [::]:ssh             [::]:*          LISTEN 1198/sshd

On my Windows box, a ping to works, but a telnet 5900 does not work.

Any help is appreciated.

  • Why HVM? You are loosing the biggest advantage of Xen: PV.
    – Nils
    Commented May 29, 2012 at 20:29

2 Answers 2


The problem is that the vnc server is listening (per default) on localhost and not on your external IP address. It is important to understand that a service can listen on a specific IP address and is only reachable via this address. In your case the VNC service is only listening on and can only be reached via localhost. As VNC is not encrypted it is a bad idea to allow VNC from remote without any kind of encryption.

You can tunnel VNC via ssh. Just use putty and forward the ports from your local machine e.g. add following parameters under SSH - Tunnels:

Local port: 5900

Don't forget to click add. Connect afterwards to your Ubuntu system via ssh and try to connect on your windows machine to localhost. This will forward all packets to port 5900 on your local machine via ssh to your ubuntu box.

If you don't want to setup ssh you can modify the cfg file that the vnc process listens on all interfaces.

According to https://help.ubuntu.com/community/Xen you can edit /etc/xen/xend-config.sxp and change the (vnc-listen '') line to (vnc-listen ''). Please be aware that all vnc connections which are not configured otherwise will be reachable via all ip addresses.

You can also just edit ubuntu-hvm.cfg and add vnclisten '' to the config file - according to http://docs.oracle.com/cd/E11081_01/doc/doc.21/e10898/troubleshoot.htm#insertedID3

  • thank you! right now i am not concerned about security because i am just learning but that issue will have to be addressed. i simply modified ubuntu-hvm.cfg to have vnclisten = '' and now i can connect via vncviewer.
    – Jane Wayne
    Commented May 29, 2012 at 4:19
  • Just a minor question, let's say I have 2 HVM guest OS running and ready to be installed, will each of them be listening on different ports?
    – Jane Wayne
    Commented May 29, 2012 at 4:21
  • nevermind, just in case anyone is wondering, empirically observed, when you add/install new HVM guest OSs, new ports are opened (5900, 5901, ...).
    – Jane Wayne
    Commented May 29, 2012 at 6:07

You could also just connect to the console, kill the vnc process on dom0 and do this:

xl console <domid>

this works under xcp-xapi toolstack as well with the full path to the correct exec. (in 12.04 ubuntu /usr/lib/xen-4.1/bin/xl console )

you don't have to use vnc unless you go graphic install.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .