bashsshvncvnc-viewer

VNC viewer failing to make connection with "channel 3: open failed: connect failed: No route to host"


I ssh into a server with the following:

ssh -g -L5912:server:5912 user@host

It goes through, and I can access my files on the other server through the command line (meaning I can connect to the server, it is my vnc viewer that is failing!) but when I try to open my vnc viewer (RealVNC) and connect to localhost:12 i get the following error message in the vnc viewer application:

The connection closed unexpectedly.

Additionally in the original command line shell i get:

channel 3: open failed: connect failed: No route to host

I've tried switching to different ports and even checked out other posts on the same error message but the problem is i don't really understand them... ssh tunnels are still relatively new to me so i don't really know what im doing. Any help would be greatly appreciated. Thanks!


Solution

  • You're trying to setup a port forwarding, this may fail because of many reasons:

    Check SSH server in the host if AllowTcpForwarding is enabled:

    $ grep AllowTcpForwarding /etc/ssh/sshd_config
    AllowTcpForwarding yes
    

    Typically, it's commented out. Uncomment and restart the sshd.

    SSH to the host and try:

    $ telnet server 5912
    Connected to server.
    Escape character is '^]'.
    

    Similarly, as above, but from the server - go there and try telnet server 5912.

    Best regards, Jarek