在openwrt上使用autossh(已放弃)
用了一天后发现,这东西真不靠谱,还不如自已写的SHELL检测重连来的精准和方便,放弃中
参考文章:
https://my.oschina.net/umu618/blog/849345
https://segmentfault.com/a/1190000000636636
官风的使用说明(英文):https://www.harding.motd.ca/autossh/README.txt
过程 :
首先安装autossh:
opkg update
opkg install autossh
修改配置: /etc/config/autossh,这里要注意是config autossh 名称,最好加上‘名称’,特别是同时连多个SSH情况时
config autossh 1
option ssh '-i /etc/dropbear/my_key_1 -N -T -L localhost:1234:192.168.1.1:4567 who@remote.com -p remoteport'
option enabled '1'
option monitorport '20001'
option gatetime '0'
option poll '60'
config autossh 2
option ssh '-i /etc/dropbear/my_key_2 -N -T -R 0.0.0.0:5678:localhost:2222 who2@remote2.com -p remoteport_2'
option enabled '1'
option monitorport '20002'
修改启动文件:/etc/init.d/autossh ,作用是可以同时连接多台SSH
给 start_instance() 函数增加两行:
export SERVICE_MATCH_NAME=1
export SERVICE_NAME="$section"
最终 start_instance() 函数看起来是这样:
start_instance() {
local section="$1"
config_get ssh "$section" 'ssh'
config_get gatetime "$section" 'gatetime'
config_get monitorport "$section" 'monitorport'
config_get poll "$section" 'poll'
export AUTOSSH_GATETIME="${gatetime:-30}"
export AUTOSSH_POLL="${poll:-600}"
export SERVICE_MATCH_NAME=1
export SERVICE_NAME="$section"
#export SERVICE_DEBUG=1
service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh}
}
启动autossh
/etc/init.d/autossh start
在openwrt上使用autossh(已放弃)的更多相关文章
- WCF 遇到 由于线程退出或应用程序请求,已放弃 I/O 操作 ListenerContextInputStream
异常类型:IOException 异常消息:An exception has been thrown when reading the stream. 异常信息: at System.ServiceM ...
- weex 开发 (已放弃了)
关于weex 开发 本菜已放弃使用了,当初选择使用weex 是为了同时支持h5 和 android / ios 三端:想法很不错,深入之后 突然发现,开发起来并没有很轻松,因为weex 中有些方法, ...
- openwrt上wifi探针的实现
openwrt上wifi探针的实现 探针是通过wifi搜集经过这个AP范围的手机的mac地址,没有什么深刻的东西,知乎上关于这个东西讨论的很多,有人觉得很有用,可以做很多增值的应用,有人觉得没啥用,不 ...
- 在OpenWrt上编写自己的硬件操作程序
上一篇文章中有写到如何使用OPENWRT的SDK,这里继续,写怎么在上面开发自己的应用程序. 我欲在OpenWrt上编写一个软件,它能够去读取某个AD芯片的多通道采样值. 在看这篇文章之前请看这官方的 ...
- Openwrt上使用dnsmasq和ipset实现域名分流
目标 部署一台自动代理路由器,实现根据域名来自动设定直连或者代理,而我要做的只是设置PC的默认网关为主路由器(192.168.0.1)还是自动代理路由器(192.168.0.254). 创建Openw ...
- 【学习总结】【Java】Git学习-上传本地已有代码到GitHub
< Git学成归来后的第一次实战 > 上传本地已有代码到GitHub 以之前学了一小半的Java基础教程代码为例 <深坑预警:在GitHub新建仓库那一步,不要勾选readme,不然 ...
- OpenWrt上搭建纯L2TP服务器[ZT]
转自:http://www.openwrt.pro/post-389.html 纯L2TP(l2tp + ppp,无IPSec) 首先安装xl2tpd软件包 opkg update opkg inst ...
- 读写分离,读写分离死锁解决方案,事务发布死锁解决方案,发布订阅死锁解决方案|事务(进程 ID *)与另一个进程被死锁在 锁 资源上,并且已被选作死锁牺牲品。请重新运行该事务
前言: 由于网站访问压力的问题,综合分析各种因素后结合实际情况,采用数据库读写分离模式来解决当前问题.实际方案中采用“事务发布”模式实现主数据库和只读数据库的同步,其中: 发布服务器1 ...
- 事务(进程 ID 64)与另一个进程被死锁在 锁 资源上,并且已被选作死锁牺牲品。
访问频率比较高的app接口,在后台写的异常日志会偶尔出现以下错误. 事务(进程 ID 64)与另一个进程被死锁在 锁 资源上,并且已被选作死锁牺牲品.请重新运行该事务 实所有的死锁最深层的原因就是一个 ...
随机推荐
- java.io.IOException: Input is binary and unsupported
十一月 16, 2019 11:49:47 上午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() f ...
- python之psutil模块
简述 psutil是一个跨平台库(http://code.google.com/p/psutil/) ,能够轻松实现获取系统运行的进程和系统利用率(包括CPU.内存.磁盘.网络等)信息.它主要应用于系 ...
- 利用Entity Framework修改指定字段中的值
利用Entity Framework修改指定字段中的值一般我们编辑某些模型的时候会用到类似这样的代码: [HttpPost] public ActionResult Edit(Article mode ...
- git bush 无法使用箭头进行选择
1 找到git bash 的安装目录,找到bash.bashrc文件, 2 在文件的尾部加上:alias vue='winpty vue.cmd', 3 重启git bash 即可 来自:https: ...
- [LeetCode] 67. Add Binary 二进制数相加
Given two binary strings, return their sum (also a binary string). The input strings are both non-em ...
- [LeetCode] 122. Best Time to Buy and Sell Stock II 买卖股票的最佳时间 II
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- [LeetCode] 712. Minimum ASCII Delete Sum for Two Strings 两个字符串的最小ASCII删除和
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. ...
- sqlyog 社区版
https://github.com/webyog/sqlyog-community/wiki/Downloads
- nginx+consul-template+consul实现自动负载均衡
所需工具:工具 下载地址 本文使用版本consul https://www.consul.io/downloads.html consul_1.0.7_linux_amd64.zipconsul-te ...
- K8S+GitLab+.net core-自动化分布式部署-1
K8S+GitLab-自动化分布式部署ASP.NET Core(一) 部署环境 一.部署流程介绍 开发人员通过Git上传asp.net core 项目到Gilab,并编写好.gitlab-ci.yml ...