0

I am trying to use VNC on my KVM guest, following this guide:

http://blog.scottlowe.org/2013/08/21/accessing-vnc-consoles-of-kvm-guests-via-ssh/

This is the ssh command I am using from my host:

ssh -v -v -4 root@192.168.122.123 -L 7000:127.0.0.1:7000

Where 192.168.122.123 is the address of my guest.

I can ssh into my guest using the above command, but when I use remmina from my host and I enter 127.0.0.1:7000 into the server field using VNC Protocol, this message appears on my guest ssh connection:

root@Kali:~# debug1: Connection to port 7000 forwarding to 127.0.0.1 port 7000 requested.
debug2: fd 8 setting TCP_NODELAY
debug2: fd 8 setting O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
channel 2: open failed: connect failed: Connection refused
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 7000 for 127.0.0.1 port 7000, connect from 127.0.0.1 port 59293 to 127.0.0.1 port 7000, nchannels 3

The following output on my host for port 7000 after establishing the ssh connection:

# sudo netstat -tunelp | grep LISTEN
tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      1000       283620      8509/ssh

The following lines are present in my guest's sshd_config:

GatewayPorts yes
AllowTcpForwarding yes
X11Forwarding yes

Any ideas?

1

You do not have a listener on 127.0.0.1:7000 (or 0.0.0.0:7000) on the guest. Check for a listener on the guest using:

netstat -an|grep 7000

See if a line like x.x.x.x:7000 0.0.0.0:* LISTEN exists and on which interface it is bound.

The GatewayPorts directive does not make sense in this configuration since it applies only for remote portforwarding.

  • I have the listener I posted on the host. No output from the command you suggested on the guest. sudo netstat -tunelp | grep LISTEN on the guest shows tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18869 1535/sshd tcp6 0 0 :::22 :::* LISTEN 0 18878 1535/sshd – Proletariat Nov 5 '15 at 13:43
  • You ask the ssh client to forward traffic directed to port 7000 to port 7000 on the guest (the client you are connecting to). If nothing listens on port 7000 on the guest you will receive the error message you've put in your question. – Lambert Nov 5 '15 at 13:47
  • So what do I need to listen on port 7000 on the guest? – Proletariat Nov 5 '15 at 13:49
  • To illustrate and test, start nc -kl 7000 in the guest and try again to connect from the host to localhost:7000 either using remmina or - preferably - using telnet localhost 7000. You won't see the error message to appear but an established session instead. – Lambert Nov 5 '15 at 13:49
  • Where do you got port 7000 from? I assumed that you have your VNC console running/listening on that port because that is what you trying to achieve: connecting to the console of your guest. Is VNC started and running? Is it using the default port 5900? – Lambert Nov 5 '15 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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