zoukankan      html  css  js  c++  java
  • 使用SSH远程端口转发

     -->2017-11-16更新:稳定+1

    ssh -Nf -R 80:10.1.199.1:80 23.228.103.6
    服务器端配置vim /etc/ssh/sshd_config
    修改参数:备份!备份!备份!
    TCPKeepAlive yes 要保持TCP连接
    ClientAliveInterval 60 每分钟发送1次请求
    ClientAliveCountMax 表示服务器发出请求后客户端没有响应的次数达到一定值,就自动断开,设成10000或更大,保证不断开。
    重启sshd生效: /etc/init.d/sshd restart

    1.将发往本机的80端口访问转发到174.139.9.66的8080端口
    ssh -C -f -N -g -L 80:174.139.9.66:8080 master@174.139.9.66

    2.将发往174.139.9.66的8080访问转发到本机的80端口
    ssh -C -f -N -g -R 80:174.139.9.66:8080 master@174.139.9.66

    linux虚拟机为:CentOS-7-x86_64-Everything-1708

    下载并安装autossh:http://www.harding.motd.ca/autossh/

    下载并安装expect依赖tcl:http://www.tcl.tk/software/tcltk/download.html

    下载并安装expect:http://expect.sourceforge.net/

    命令大致如下():

    $ sudo yum install wget gcc make

    $ wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz

    $ tar -xf autossh-1.4e.tgz

    $ cd autossh-1.4e

    $ ./configure

    $ make

    $ sudo make install

    编写sh脚本:

        待补充...

    TryEverything
  • 相关阅读:
    基础DP背包
    哲学思絮01
    Vue使用ElementUI
    Vue-Mock数据
    Vue生命周期
    Vue实战之CURD
    读《间客》有感
    ASP.Net Core网站发布
    Cycling之 标签化
    Vue环境搭建
  • 原文地址:https://www.cnblogs.com/LiTry/p/7587462.html
Copyright © 2011-2022 走看看