So you have a server to which you can’t connect directly because it’s behind a firewall? Or even two firewalls/computers ?
In my example, I wanted to set up port forwarding of port 80 from server via pc1 and gateway to pc2.
First thing is to connect from pc2 to gateway
ssh user@gateway
Then when logged into gateway, map port 80 of server via pc1
ssh -N -L8888:server:80 user@pc1
Last step is to forward port from gateway to cp2
ssh -N -L8888:localhost:8888 user@gateway
Note that port number 8888 is random, you can use any open port. You can also fork any of the above commands to the background using “-f” option, e.g:
ssh -f -N -L8888:localhost:8888 user@gateway