What have you found for these years?

2011-06-09

ssh tunneling tcp/port forwarding

It's so hard to remember all those commands :(
note: [bind host] is usually localhost, and could be omitted

SOCKS proxy (dynamic):
ssh -D [bind host:]{bind port} {remote host}
e.g. ssh -D 1234 my-server.com
SOCKS proxy is at localhost:1234

port forwarding (local):
ssh -L [bind host:]{bind port}:{target host}:{target port} {remote host}
e.g. ssh -L 1234:ptt.cc:22 my-server.com
connect to ptt with ssh://bbs@localhost:1234

reverse tunneling (revere, needs GatewayPorts):
ssh -R [bind host:]{remote port}:{target host}:{target port} {remote host}
note: target host is usually localhost
e.g. ssh -R 41829:localhost:8080 my-server.com
now my-server.com:41829 is acting as localhost:8080
(set sshd_config GatewayPorts yes)

0 retries:

Post a Comment

All texts are licensed under CC Attribution 3.0