Port Forwarding - Multiple Hop Server - Channel error

Oct 8, 2014 at 7:13 PM
Edited Oct 8, 2014 at 7:14 PM
I can create a Local Port forward directly to the device and launch the browser on local host, but when I try to go through a multi-hop jump server I can get the SSH connection to the end device, but as soon as i try to launch the web browser on the bound port, i get the following error "The channel has not been opened, or the open has not yet been confirmed."

I am trying to use Local Port Forwarding connecting my Desktop to a Windows Jump server. Once connected, i am trying to continue the Port forwarding to an end device. This device is connected to a router ie. ANDA . It has a web interface I want to browse it on my Desktop.

Of course, i can do this with Putty successfully.
  1. First connecting my desktop to the first server by creating a forwarded port.
    L9998 127.0.0.1:9997.
  2. Once SSH session is connecting on Windows server i run the SSH Command.
ssh -L - <[listenaddress:]listenport:remotehost:remoteport>
ssh -L 9997:192.168.1.10:443 admin@99.99.99.00
  1. Once logged in to end device, i launch a browser on localhost and success!
    https://127.0.0.1:9998
Trying to do this multi-hop with the port forwarding is unsuccessful. I create a standard local port forwarding to the Windows jump server with the SSH.NET library and then try and execute the SSL -L command. This gets me into the ssh connection to the end device, but i seem to lose the SSH tunnel or socket and get a channel error when i try and launch the browser on the bound port.

I then tried the following forum example, where you Use Portforwarding. LocalForward the SSH-Port of Server2 via Server1 to your desktop machine. But i cannot seem to get the bound ports working and launching the web browser on local host, it will just hang until timeout. Any help is appreciated.

https://sshnet.codeplex.com/discussions/466337
 void SshTunnel()
  {
         using (var client = new SshClient(Constants._JUMP_SERVER_, 9998,     Constants._LDAP_USERNAME, Constants._LDAP_PASSWORD))
            {
                client.Connect();

                // Forward the SSH-Port of Device via Server1 on the Desktop-Machine
                var port1 = new ForwardedPortLocal("127.0.0.1", 9997, Constants.DeviceIpAddress, 9998);
                port1.Exception += delegate(object sender, ExceptionEventArgs e)
                {
                    Console.WriteLine(e.Exception.ToString());
                };
                port1.RequestReceived += delegate(object sender, PortForwardEventArgs e)
                {
                    Console.WriteLine(string.Format("Port request recieved from {0} : {1}", e.OriginatorHost, e.OriginatorPort));
                };
                client.AddForwardedPort(port1);


                port1.Start();

                // create ssh forwarded client on Server2
                var client2 = new SshClient("127.0.0.1", 9997, Constants._DEVICE_USER, Constants._DEVICE_PASSWORD);
                client2.ErrorOccurred += _sshclient_ErrorOccurred;
                client2.HostKeyReceived += _sshclient_HostKeyReceived;

                client2.Connect();



            }
}