From: Andre Charbonneau <andre.charbonneau@nr...> - 2007-11-20 16:19:34
I'm currently trying to tunnel some VNC traffic through SSH.
When I only have 2 systems, hostA and hostB, then I use the following
port forwarding method:
session = jsch.getSession("username", "hostB", 22);
assigned_port = session.setPortForwardingL(localPort, "127.0.0.1",
Then I can tunnel the VNC traffic without any problem. (In my scenario
the VNC server is listenening on 'localhost' only, hence why I put
"127.0.0.1" in the setPortForwardingL method call above. If I put
"hostB" instead, then the VNC server simply refuses the tunneled VNC
connections because it sees it as if it is comming from the IP of hostB
instead of '127.0.0.1'.)
Now let's suppose that, because of firewall issues, the traffic has to
go through a middle system, hostM. If I create the tunnel using the
session = jsch.getSession("username", "hostM", 22);
assigned_port = session.setPortForwardingL(localPort, "hostB", remotePort);
then the tunnel seem to be successfully created, but my VNC server on
hostB will refuse connections because it thinks it is not comming from
'localhost', but from 'hostM' instead.
Anyone knows if there is there a way around this problem?
Maybe I'm doing something wrong in the way I call setPortForwardingL?