• ssh 设置反向代理


    远程主机上
    /etc/ssh/sshd_config中,开启
    GatewayPorts yes

    systemctl reload sshd

    本地:

    ssh -CqTnN -R 0.0.0.0:9000:localhost:7070 root@109.105.4.65

    109.105.4.65 9000端口的流量会发送到 localhost的7070端口


    SecureSRT设置: 选项->会话选项->远程/x11



    ssh -CqTnN -R 0.0.0.0:9999:54.209.106.26:22 root@109.105.4.65
    将109.105.4.65的9999端口流量发送到54.209.106.26的22端口
    所以ssh 109.105.4.65 -p9999,可以连接54.209.106.26

    ssh -CqTnN -R 0.0.0.0:9999:54.209.106.26:22 localhost

    ========================================================
    安装nc
     yum install nmap-ncat.x86_64

    # cat config
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    host gitlab.gcloud.srcb.com
        hostname gitlab.gcloud.srcb.com
        port 29675
    host aws
        hostname 54.209.106.26
        port 22
        IdentityFile /root/.ssh/FARM-1634-5b25a9a4.us-east-1-1.pem
        user root

    ============
    # vi config

    Host aws
      HostName 54.209.106.26
      ProxyCommand  /bin/nc --proxy 109.105.4.65:7070 %h %p
      User root
      IdentityFile /root/.ssh/FARM-1634-5b25a9a4.us-east-1-1.pem
    =================
    Host 54.211.46.*
      HostName %h
      ProxyCommand  /bin/nc --proxy 109.105.4.17:7081 %h %p
      User ubuntu
      IdentityFile /root/.ssh/FARM-1634-5b25a9a4.us-east-1-1.pem
    ================
     ssh -oProxyCommand="nc --proxy 109.105.4.65:7070 %h %p" -i .ssh/FARM-1634-5b25a9a4.us-east-1.pem root@54.209.106.26



    ssh -N -g -f -L 8060:172.31.0.51:6443 localhost



    -L是本地端口转发,即代理
    -R是远程端口转发, 即反向代理

    https://www.cnblogs.com/-chaos/archive/2013/10/19/3378564.html

  • 相关阅读:
    day32-python阶段性复习六
    golang 项目中坑
    golang crawler
    router
    golang in ubuntu
    go channel 案例分析
    go channel learning
    bee go + mgo
    URL escape and unescape
    [转]good sample of Go
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/9260525.html
Copyright © 2020-2023  润新知