链接sshuttle命令超过两跳

我有以下情况:

  • 主持人:Mi机
  • 主机B:服务器 – 192.168.1.1
  • 主机C:跳跃节点 – 192.168.2.1
  • networkingN:192.168.3.0/24

使用sshuttle转发和能够到达机器A的networkingN(192.168.3.0/24)的机器,通过B和C的最佳方式是什么?

我可以运行:

sshuttle -r [email protected] -v 192.168.3.0/24 & ssh [email protected] sshuttle -r root@$192.168.2.1 -v 192.168.3.0/24 & 

如果我从浏览器打开例如http://192.168.3.5从机器A我正在接收目标节点中的TCP包,但没有得到正确的路由答案。

像其他多跳设置一样使用ProxyCommand 。 创build一个文件~/.ssh/config

 Host B Hostname 192.168.1.1 User root Host C Hostname 192.168.2.1 User root ProxyCommand ssh -W %h:%p B 

然后用sshuttle连接:

 sshuttle -r C -v 192.168.3.0/24 &