小编BCC*_*ode的帖子

使用单个端口的多个反向 SSH 隧道

我能够接受来自单个服务器上多个远程系统的反向 SSH 连接,每个连接使用一个端口:

Remote A: ssh -fN -R5000:localhost:22 user@server-ip -p22
Remote B: ssh -fN -R5001:localhost:22 user@server-ip -p22
Remote C: ssh -fN -R5002:localhost:22 user@server-ip -p22
Run Code Online (Sandbox Code Playgroud)

我可以根据需要从本地客户端访问这些系统:

Access Remote A: ssh root@server-ip -p5000
Access Remote B: ssh root@server-ip -p5001
Run Code Online (Sandbox Code Playgroud)

这需要在服务器上为每个远程系统转发一个端口。当 100 多个遥控器连接时,除了在服务器防火墙中打开 100 多个端口并将每个遥控器静态分配给上述端口之外,我还有其他选择吗?我的目标是让多个遥控器按需创建隧道,我可以在其中查询连接的人。

我发现 sslh 是一个多路复用器,可以根据协议区分单个端口上的流量,但这仅适用于不同的协议,例如。ssl/ssh。是否有允许在单个端口上建立多个隧道的解决方案?

例子:

Remote A: ssh -fN -R5000:localhost:22 user@server-ip -p22 -identifier abc123
Remote B: ssh -fN -R5000:localhost:22 user@server-ip -p22 -identifier def456
access Remote A: ssh root@server-ip -p5000 -identifier abc123
access Remote B: ssh root@server-ip -p5000 -identifier def456
Run Code Online (Sandbox Code Playgroud)

linux ssh ssh-tunnel

9
推荐指数
1
解决办法
5828
查看次数

标签 统计

linux ×1

ssh ×1

ssh-tunnel ×1