Submitted by 熊茂祥 on 2012, September 14, 11:51 AM
DDNS脚本自动绑定到默认路由的接口更新IP
:global ddnsuser "用户名"
:global ddnspass "密码"
:global ddnshost "域名"
:global gate [/ip route get [/ip route find static=yes active=yes dynamic=yes distance=1] gateway]
:global ddnsinterface {:put [/ip add get [find network=$gate] interface]}
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass
» 阅读全文
Tags: ros, adsl, 多线, ddns, 脚本
ROS | 评论:0
| 阅读:41280
Submitted by 熊茂祥 on 2012, September 14, 11:45 AM
映射脚本自动绑定到默认路由的接口更新IP
--------------对NAT规则备注名进行查找-----------------
:global adcmname "3389"
:global adgw [/ip route get [/ip route find static=yes active=yes dynamic=yes distance=1] gateway]
:global ip [/ip add get [find network=$adgw] address]
:global newip [:pick $ip 0 [:find $ip "/"]]
:global oldip [/ip fi nat get [/ip fi nat find comment=$adcmname] dst-address]
:if ($newip != $oldip) do={
:log info [/ip fi nat set [/ip firewall nat find comment=$adcmname] dst-address=$newip]
}
» 阅读全文
Tags: ros, adsl, 多线, 映射, 脚本
ROS | 评论:0
| 阅读:42555
Submitted by 熊茂祥 on 2012, August 4, 10:45 PM
#内网地址段改为自己的
/ip firewall address-list add address=192.168.1.0/24 disabled=no list=lan
/ip firewall mangle add action=add-src-to-address-list address-list=Online address-list-timeout=1m chain=prerouting comment=tongji disabled=no src-address-list=lan
/system scheduler
add comment=tongji disabled=no interval=3m name="\CD\B3\BC\C6" on-event="#\D7\EE\B4\F3\D1\AD\BB\B7\B4\CE\CA\FD\r\
\n:global rmaxlimit 5000\r\
\n:global r 0\r\
\n:global rn\r\
\n:global rs\r\
\n:global ravg\r\
\n:global rmax\r\
\n:if ([:len \$ravg] = 0) do={\r\
\n:set ravg 0\r\
\n:global rn 0\r\
\n:global rs 0\r\
\n:global rmax 0}\r\
\n:if (\$rs = \$rmaxlimit) do={\r\
\n:global rn \$ravg\r\
\n:global rs 1}\r\
\n:foreach b in=[/ip firewall add find list=\"Online\"] do={:set r (\$r+1)}\r\
\n:if (\$rmax < \$r) do={:set rmax \$r}\r\
\n:set rs (\$rs+1)\r\
\n:set rn (\$rn+\$r)\r\
\n:global ravg (\$rn / \$rs)\r\
\n:log warning (\"\B5\B1\C7\B0\D4\DA\CF\DF\BF\CD\BB\A7\BB\FA\" . \$r . \"\CC\A8,\C6\BD\BE\F9\D4\DA\CF\DF\BF\CD\BB\A7\BB\FA\"\
\_. \$ravg . \",\D7\EE\B8\DF\D4\DA\CF\DF\C0\FA\CA\B7\" . \$rmax . \"\CC\A8,\B5\B1\C7\B0\CD\B3\BC\C6\B4\CE\CA\FD\" . \$rs . \
\"\A1\A3\")" policy=reboot,read,write,policy,test,password,sniff,sensitive start-date=jan/01/1970 start-time=00:00:00
» 阅读全文
Tags: 统计, 在线, 人数, ros, 脚本
ROS | 评论:1
| 阅读:49410
Submitted by 熊茂祥 on 2012, July 2, 12:00 AM
在nginx.conf的http{}添加
limit_zone one $binary_remote_addr 10m;
然后在 虚拟机里写
location / {
limit_conn one 1; 线程
limit_rate 100k; 速度
表示限速100K 每个客户端只允许一个线程
最终速度=rate * conn
-----------------------------------------------------------------
limit_zone one $binary_remote_addr 32k;
server {
listen 80;
server_name 192.168.1.222;
location / {
root /var/www/html;
index index.html index.htm index.php;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
limit_conn one 2;
limit_rate 10k;
}
说明:
limit_zone,针对每个IP定义一个存储session状态的容器。要求大于等于32K。
limit_conn,限制每个IP发起的连接数,比如本实例设了2个,当我用IE进行单线程下载的时候还可以打开该站点的一个网页。而用迅雷下载时,迅雷会启用2个线程下载,所以当再去打开网页的时候,服务器端会返回错误请求。该值建议设置得高一些,比如15左右。
limit_rate,限制每个连接速度为10K,此限制是针对单个线程,比如这个例子,我用IE下载是10K,当用迅雷时它会占用2个线程,所以迅雷下载速度为20K,此实例也很好的解释了迅雷下载速度快的原因。
» 阅读全文
Tags: nginx, 限速, 连接数, 限制, 并发
技术文档 | 评论:0
| 阅读:43714
Submitted by 熊茂祥 on 2012, May 27, 8:29 AM
程序说明:RSYNC是很优秀的同步软件,功能也很有特色,带限速,用户认证,压缩等功能。由于RSYNC是全命令行控制,不太方便。所以本人特此制作了本图形控制端,贡献给对RSYNC的命令行操作不太熟的用户。
该程序免费发布,当然如果要本程序发展的更好,也接受本程序的捐赠,呵呵。
点此进入捐赠页面
更新历史: 版本号1.1
时间:2015.10.27
更新内容:不记得内容了,公开下目前最新版本。
更新历史: 版本号0.6
时间:2012.5.24
更新内容:修正启动服务端弹出消息框的BUG。修正客户端使用定时同步因为参数错误而失败的BUG。
更新历史: 版本号0.5
时间:2012.5.17
更新内容:服务端和客户端全面支持配置文件,可记录上次运行过的设置参数,并于下次开启时载入。若程序目录内没有发现配置文件则以默认参数运行。
更新历史: 版本号0.3
时间:2011.7.12
更新内容:支持程序和RSYNC组件存放在任意目录下运行。(包含中文目录)支持RSYNC设置为中文目录并提供同步服务。添加客户端定时同步功能。添加缩小到托盘功能。
更新历史: 版本号0.2
时间:2011.7.12
更新内容:支持程序和RSYNC组件存放在任意非中文目录下运行。
已知问题:
1.若客户端在内网通过路由连接外网服务端,开启用户认证则无法正常完成认证。不开启用户认证则可以正常同步。暂时无法解决。



» 阅读全文
Tags: rsync, 图形, gui, 服务端, 客户端
技术文档 | 评论:15
| 阅读:60038