Created
September 26, 2017 03:51
-
-
Save trydofor/831b9665dfcd173b3e0f69265d3111cd to your computer and use it in GitHub Desktop.
ssh隧道,做代理或转发
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ssh隧道有3种类型: | |
#动态端口转发(Socks 代理)-D | |
ssh -D 9090 ssh-host | |
产生一个本地sock5代理,端口是9090 | |
#本地端口转发(正向代理)-L | |
ssh -L 3306:mysql-server:3306 ssh-host | |
开启本地3306端口监听,等于访问mysql-server的3306端口 | |
#远端端口转发(反向代理)-R | |
ssh -R 8080:local-jetty:8080 ssh-host | |
开启远程8080端口监听,等于访问本地 local-jetty的8080端口 | |
#常用参数 | |
-f ssh将在后台运行 | |
-N 不执行命令,仅转发端口 | |
-C 压缩传送的数据 | |
-i 使用指定的密钥登录 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment