【端口映射】配置ssh端口映射

ssh端口映射

此手段用于在单向连通网络中进行双向网络打穿
适用于未配端口映射的docker容器,不能反向访问的受限网络等

一次反向代理

在封闭网络内服务器/容器执行以下命令,结果可以使目标服务器通过访问封闭网络内服务器/容器的

ssh -fgN -R <port of target machine>:localhost:<port of limited machine> root@<ip of target machine> -p <ssh port>

一次正向代理

在目标服务器执行以下命令,结果可以使目标服务器通过访问封闭网络内服务器/容器的

ssh -fgN -L <port of target machine>:localhost:<port of limited machine> root@<ip of limited machine> -p <ssh port>

跳板代理

  • 封闭网络内服务器/容器向跳板机创建一次反向代理
ssh -fCNR '<port0 of jump machine>:localhost:<port of local machine>' root@<ip of jump machine> -p <ssh port>
  • 跳板机内部创建一次正向代理
ssh -fCNL '*:<port1 of jump machine>:localhost:<port0 of jump machine>' -o ServerAliveInterval=60 root@<ip of jump machine> -p <ssh port>

猜你喜欢

转载自blog.csdn.net/linghu8812/article/details/107951232