SSH Port forwarding

http://staff.washington.edu/corey/fw/ssh-port-forwarding.html

I used ssh to fuck notorious GFW(made by china government), some of it's options related to port forwarding:
-L : Local port forward
-R : Remote port forward
-D : Dynamic port forward
-g  : Let another host in the same LAN to use this tunnel.
what is port forwarding?
First, we should have an ssh connection -- named tunnel.
>$ ssh RemoteHost
this cmd build a tunnel from LocalHost to RemoteHost.

>$ ssh -L localPort:TargetHost:TargetPort RemoteHost
this cmd build a tunnel ofcouse. And it also Forwarding any traffic from
LocalHost:LocalPort through the tunnel to the RemoteHost, then the RemoteHost forwarding the traffic to the TargetHost:TargetPort.

In conclusion, First we have to buid a tunnel, second, ssh collect the traffic from one side of the tunnel and send to another side of tunnel, then In another side, the traffic can be send to the target host.

There are two ways of port forwarding in ssh.
1. static port forwarding (port to port)
both -L -R option can be used in this way.
ssh -L LocalPort:TARGETHOST:targetPort RemoteHost
ssh -R RemotPort:TARGETHOST:targetPort RemoteHost
2. dynamic port forwarding (can send to any target)
-D options can be used in this way.
ssh -D port yourhost

Comments

Popular posts from this blog

Bluedroid stack in android

How to setup a NAT server?

Network programming in elisp