|
马上注册成为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
|
|