Port Forwarding an SSH Connection on macOS

Solution 1:

If I understand the setup properly, you're using the wrong option to control what port it makes the connection over. If the router is forwarding port 70 to port 22 of the internal ssh server you want to connect to, then from the outside you'd connect with something like:

ssh -p 70 username@router_external_ip

Note that I'm using -p 70 to control what port it connects to on the "server" (which is actually the router, but since the connection comes in on port 70 it should be forwarded to port 22 on the internal server).

This is very different from what the -L option does. What -L does is tell ssh to make a (tunneled) port forward of its own after connecting to the SSH server. Adding -L 22:someip:70 tells the ssh program to listen on port 22 of your local computer (by default, it also listens only in the local loopback interface), and if it receives any connections on that port it should forward them over the SSH connection to the remote computer, with instructions that the remote computer should forward them on to port 70 on someip.

You could use sort of port forward, for example, to tunnel filesharing connections to your storage server so you wouldn't have to have to expose the storage server directly on the open Internet (which is probably not very safe). There's an example of using it to tunnel VNC (screen sharing) in this stackoverflow question.