ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 5129|回复: 2

[交流] 我也发一个pppoe防假死脚本,我老板的。

[复制链接]
发表于 2014-3-31 16:19:35 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

您需要 登录 才可以下载或查看,没有账号?会员注册

x
ROS刷新PPPOE-Client,防假死,卡死,断线,自动重拨修复

代码如下:




local newaddress

local newnetwork

local assignip

local status

local pppoestatus

local pppoeup

local pppoeupcount

local pppoedown

local pppoedowncount

##################

local x 1                     

#---线路数请更改使用

##################

set x [len [interface find type=pppoe-out]]

set pppoeupcount 0

set pppoedowncount 0

#log info $x

log info



log info                    PPPOE-OUT 检测程序

log info               

log info (pppoe-out      Status    Remote Address        LocalAddress )

for i from=1 to=$x do={

   set status [interface get [interface find  name=(pppoe-out . $i)] running]



   if ($status=true) do={



    set newnetwork [ip address get [ip address find dynamic=yesinterface=(pppoe-out . $i)] network]



    set pppoestatus [ping 58.20.127.238 count=2 interface=(pppoe-out . $i)]

if($pppoestatus=1) do={

     log info (pppoe-out . $i.重启中......)

     beep

     int pppoe-client disable (pppoe-out . $i)

     delay 2

     int pppoe-client enable (pppoe-out . $i)

     delay 5

if($pppoedowncount=0) do={set pppoedown [($pppoedown .pppoe-out . $i)]}

if($pppoedowncount0) do={set pppoedown [($pppoedown .; pppoe-out . $i)]}



set pppoedowncount ($pppoedowncount + 1)

   }

   if($pppoestatus1) do={

          if ($pppoeupcount=0) do={set pppoeup [($pppoeup .pppoe-out . $i)]}

          if ($pppoeupcount0) do={set pppoeup [($pppoeup .; pppoe-out . $i)]}



setpppoeupcount ($pppoeupcount + 1)

     }

    set newaddress [ip address get [ip address find dynamic=yesinterface=(pppoe-out . $i)] address]



     log info (pppoe-out . $i.        .$pppoestatus .        .$newnetwork .                 .$newaddress)



   }

}

loginfo                     

loginfo

loginfo (PPPOE-Client 在线检测程序完毕,线路测试共.$pppoedowncount+$pppoeupcount .线)



  if($pppoeupcount=0) do={log info 没有在线的PPPOE-CLient!}

  if($pppoeupcount0) do={ log info (在线共计 . $pppoeupcount  .条 . $pppoeup)}

  if($pppoedowncount=0) do={log info 所有PPPOE-CLient均在线!}

  if($pppoedowncount0) do={ log info (断线共计 . $pppoedowncount  .条,自动修复如下 . $pppoedown)}

beep length=0.5s

delay 1

beep

发表于 2014-10-25 23:56:55 | 显示全部楼层
这个是不是自动控制检测VRRP,没有流量的线路自动重拔的?
发表于 2015-3-2 23:03:45 | 显示全部楼层
这个5.0版本能用吗?
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-8-7 03:09 , Processed in 0.108185 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表