Commit 05f737
2024-06-08 16:19:15 Qwas: 新增 ssh反向代理| /dev/null .. \344\273\243\347\220\206/ssh\345\217\215\345\220\221\344\273\243\347\220\206.md | |
| @@ 0,0 1,31 @@ | |
| + | # ssh反向代理 |
| + | |
| + | 通过下面方法,可以让不联网的主机,访问外部网络 |
| + | |
| + | 将本地访问 `192.168.6.1:7890` 映射到远程主机的 `127.0.0.1:7890` |
| + | |
| + | ```sh |
| + | ssh -R 服务端:本地地址 用户名@服务端地址 |
| + | ``` |
| + | |
| + | ```sh |
| + | ssh -R 127.0.0.1:7890:192.168.6.1:7890 root@xx.xx.xx.xx |
| + | ``` |
| + | |
| + | 验证代理转发成功 |
| + | |
| + | ```sh |
| + | export http_proxy=127.0.0.1:7890 |
| + | export https_proxy=127.0.0.1:7890 |
| + | curl "https://ip.oxylabs.io/" |
| + | ``` |
| + | |
| + | 或 |
| + | |
| + | ```sh |
| + | curl --proxy "http://127.0.0.1:7890" "https://ip.oxylabs.io/" |
| + | ``` |
| + | |
| + | 看到返回的ip是本机出口ip,而不是远程主机的出口ip,即可说明转发成功 |
| + | |
| + | > ssh 果然是个强大的工具,哈哈哈~ |