Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 192.168.0.201. Just as a sanity test, I pinged the following addresses while on the Dom0 console

ping localhost
ping 127.0.0.1
ping 192.168.0.201

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

telnet localhost 5900
telnet 127.0.0.1 5900
telnet 192.168.0.201 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      192.168.122.1:domain *:*             LISTEN 5653/dnsmasq
tcp   0      0      *:ssh                *:*             LISTEN 1198/sshd
tcp   0      0      [::]:ssh             [::]:*          LISTEN 1198/sshd

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

Any help is appreciated.

share|improve this question
    
Why HVM? You are loosing the biggest advantage of Xen: PV. –  Nils May 29 '12 at 20:29
add comment

2 Answers

up vote 4 down vote accepted

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 127.0.0.1 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
Destination: 127.0.0.1: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 '127.0.0.1') line to (vnc-listen '0.0.0.0'). 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 '0.0.0.0' to the config file - according to http://docs.oracle.com/cd/E11081_01/doc/doc.21/e10898/troubleshoot.htm#insertedID3

share|improve this answer
    
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 = '0.0.0.0' and now i can connect via vncviewer. –  Jane Wayne May 29 '12 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 May 29 '12 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 May 29 '12 at 6:07
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.