localport <========ssh============>remoteport
Requirement:
- Need to access remote service in remotehost (on remoteport) from localport in localhost (this quite be a database service to anhttp proxy service -- not much difference here)
- Both links A and B allow only SSH traffic (other ports are blocked)
Solution 1:
A simple
$ ssh -L localport:remotehost:remortport -N -f remoteuser@remotehost
would create an ssh tunnel on link A but not on link B . As both links allow only ssh traffic this will not work.
One solution is to use the ssh proxycommand option like this:
$ ssh -oproxycommand="ssh -qaxT gwuser@gatewayhost nc %h %p" -L 3128:localhost:9998 -p9999 remoteuser@remotehost -N -f