SSH port forwarding

I always forgetting it, and spend alot of time to find the solution in google and browsers history. Now i write it here to simplify my life and speedup the progress.

To make SSH as socks proxy
$ ssh -D 5000 -N theservername

Example :

$ ssh -D 5000 -N

now, configure your global OS proxy or browser proxy to localhost port 5000 and check your public IP from it shall return your ssh machine public IP.

Only forward some port to your local port
$ ssh -L user@proxy

Example :

$ ssh -L user@

Now, we can reach from localhost:3000. Those command will also logging you in there. Use parameter -N after ssh to only tunneling without logging in.

I got this from Security stackexchange and Ubuntu documentation