我有一个客户端(Windows )和4个VPS (Linux操作系统)。
我希望用ssh隧道创建Socks v5代理,以便将客户端连接到VPS-4。
客户端-> VPS-1 -> VPS-2 -> VPS-3 -> VPS-4 -> internet
在使用CMD的客户端中,我使用命令连接到VPS-1:
ssh -L9999:localhost:9999 root@VPS-1-IPaddress在VPS-1 ssh窗口中:要将VPS-1连接到VPS-2,请使用命令。
ssh -Dlocalhost:9999 root@VPS-2-IPaddress在VPS-2 ssh窗口中:要将VPS-2连接到VPS-3,请使用命令。
ssh -Dlocalhost:9999 root@VPS-3-IPaddress在VPS-3 ssh窗口中:要将VPS-3连接到VPS-4,请使用命令。
ssh -Dlocalhost:9999 root@VPS-4-IPaddress当我在浏览器代理设置中设置"localhost“和端口"9999”并打开网站whatismyipaddress时,我会看到VPS-2 IP地址。
我必须看到VPS-4 IP地址。我不知道是什么问题。
有人能给我建议吗?
发布于 2021-08-30 09:25:19
体力活太多了。
使用~/..ssh/config文件时
HOST VPS-4-IPaddress
user root
ProxyJump VPS-3-IPaddress
HOST VPS-3-IPaddress
user root
ProxyJump VPS-2-IPaddress
HOST VPS-2-IPaddress
user root
ProxyJump VPS-1-IPaddress
HOST VPS-1-IPaddress
user root
ProxyJump VPS-2-IPaddress还可以将代理链在一行中
HOST VPS-4-IPaddress
user root
ProxyJump VPS-1-IPaddress,VPS-2-IPaddress,VPS-3-IPaddress然后你可以用
ssh -D9999 root@VPS-4-IPaddress或者没有. .ssh/config文件,直接在命令行上(-J等于-o ProxyJump=)
ssh -D9999 VPS-4-IPaddress -J VPS-1-IPaddress,VPS-2-IPaddress,VPS-3-IPaddress手动方式
您需要从一台机器到另一台机器构建本地转发。
socks代理将只在最后一个上定义。
Client:> ssh -L9999:localhost:9999 root@VPS-1-VPS地址
VPS-1:> ssh -L9999:localhost:9999 root@VPS-2-VPS地址
VPS-2:> ssh -L9999:localhost:9999 root@VPS-3-VPS地址
VPS-3:> ssh -D9999 root@VPS-4-VPS地址
但隧道与自动变体大致相同。
https://stackoverflow.com/questions/68980282
复制相似问题