SSH Tunnelling

Creating a tunnel via a gateway or 'jump off' server to a target server:

ssh -f -N -L 10022:target-host:22 user-on-gateway@gateway

-L sets up the tunnel from local port 10021 to remote port 21
-N no command, simply tunnel
-f run in the background

gateway and target are both server hostnames.

Then sign in the the taget server:

ssh -p 10022 user-on-target@localhost

Creating a SOCKS proxy via a gateway

ssh -D8888 user-on-gateway@gateway

Then you can use localhost:8888 as the proxy for any application that supports SOCKS, e.g. a browser.

0 comments: