博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SSH 端口转发
阅读量:6865 次
发布时间:2019-06-26

本文共 846 字,大约阅读时间需要 2 分钟。

  hot3.png

ssh 功能

  • 远程登陆
  • 本地定向转发
  • 远程定向转发
  • 动态转发

ssh 设置

  • 编辑 /etc/ssh/sshd_config,开启端口转发功能
    AllowTcpForwarding yesGatewayPorts yesX11Forwarding yesTCPKeepAlive yesClientAliveInterval 60ClientAliveCountMax 3

ssh 参数

  • -f 后台运行
  • -N 仅作端口转发,不执行任何命令
  • -g 绑定端口到全部网卡

本地定向转发

  • ssh-client 不可达 remote-host, ssh-server 可达 remote-host, ssh 隧道映射 ssh-client 指定端口到 remote-host 指定端口
  • 在 ssh-client 执行
    ssh -f -N -g \    -L 
    :
    :
    \ username@

远程定向转发

  • ssh-client 可达 remote-host, ssh-server 不可达 remote-host, ssh 隧道映射 ssh-server 指定端口到 remote-host 指定端口
  • 在 ssh-client 执行
    ssh -f -N -g \    -R 
    :
    :
    \ username@

动态转发

  • SOCKS5 代理
  • 在 ssh-client 执行
    ssh -f -N -g \    -D 
    \ username@

转载于:https://my.oschina.net/colben/blog/1584908

你可能感兴趣的文章