返回列表 發帖

防止site-to-site連接失敗時,log被洗版

本帖最後由 gfx86674 於 2015-8-19 14:02 編輯

先些個日子 朋友出國散心,把他家的所有電器都關閉了(含網路裝置).
但小弟與他的router有做pptp-site-to-site ,
因pptp-client連不到遠端,導致log被pptp-client洗版...重要的訊息都看不到了.

所以小弟事後編寫了pptp-client驗證,
當pptp-client嘗連接5秒仍無法連接就直接進行休眠,等過30分鐘再進行嘗試連接.

平常有使用site-to-site的用戶,有興趣的可以查看:
  1. :local ghostplayer [/interface pptp-client find name=ghostplayer]

  2. :if (![/interface pptp-client get $ghostplayer running]) \
  3.     do={/system scheduler disable *2c

  4.         :while (![/interface pptp-client get $ghostplayer running]) \
  5.                do={
  6.                    /interface pptp-client disable $ghostplayer ;:delay 29m55s
  7.                    /interface pptp-client enable $ghostplayer ;:delay 5s
  8.                   }
  9.         /system scheduler enable *2c}
複製代碼

借用了一下,用不了不知道為什麼

TOP

本帖最後由 gfx86674 於 2015-8-25 11:11 編輯

回復 2# joyvx
當然用不了啊,
原因1:您的pptp名稱是ghostplayer嗎?
原因2:*2c是排程的array,也要修該成您的號碼才對.

譬如您的排程名稱是abc ,您要在命令視窗輸入:
  1. put [/system scheduler find name="abc"]
複製代碼
顯示出array後,將號碼取代*2c

TOP

谢谢您,PPTP名稱有改過自己的,2C沒設置....

TOP

防止site-to-site連接失敗時,log被洗版

最近要看Log了解為什麼連不上LTE. 但Log比SSTP connection error Overwrite...
我用了以下的方法來減少SSTP error...
1)power on 時:disable SSTP,
2) Netwatch connection, 在中國可以看看Taobao IP, 在香港可以看看8.8.8.8。
3) 如果有Network connection, 便enable SSTP, 沒有disable SSTP
4) Netwatch 不會重複enable sstp/disable SSTP. 是Netwatch status (狀態)變化才有動作。
Netwatch 的Script 有限制 only read, write, reboot, test

------ power on 時 Disable SSTP -- 其實有沒有差別不大。
/system scheduler
add name=pwrondisable on-event=wan-down policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
    start-time=startup

------ netwatch 看看有沒有Connection... x.x.x.x 1.1.1.1 要可以。
/tool netwatch
add down-script=wan-down host=x.x.x.x up-script=wan-up

--- Script wan-down, 當Status 變到沒有Network connection 時,運行一次。
Script wan-down
{      
             :log warning "sstp-bcp NOT running"
             /interface sstp-client disable [find where name="sstp-bcp"]
}
--- Script wan-up, 當Status 變到有Network connection 時,運行一次。
{
:log info message="Link up, Check SSTP"
:if ([/interface sstp-client get sstp-bcp running]=true) do={
       :log info message="sstp running"
     }  else={
        :log warning "sstp-bcp NOT running"
        :delay delay-time=1;
         /interface sstp-client enable [find where name="sstp-bcp"]
      }
}

TOP

返回列表