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:
First, we should have an ssh connection -- named tunnel.
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.
-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 RemoteHostthis cmd build a tunnel from LocalHost to RemoteHost.
>$ ssh -L localPort:TargetHost:TargetPort RemoteHostthis 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 RemoteHost2. dynamic port forwarding (can send to any target)
-D options can be used in this way. ssh -D port yourhost
Comments
Post a Comment