找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6473|回复: 3

[基础] 分享一下我的三个PPPOE网关不一样的办法

[复制链接]
发表于 2016-4-30 20:54:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
在/system scheduler 建一个,名称为Gate91
#
:local add56
:local add91
:local add93
:global sta56
:global sta91
:global sta93
/interface pppoe-c monitor Adsl56 once do={:global sta56 $status}
/interface pppoe-c monitor Adsl91 once do={:global sta91 $status}
/interface pppoe-c monitor Adsl93 once do={:global sta93 $status}
:if ($sta56="disabled") do={/interface ena Adsl56}
:if ($sta91="disabled") do={/interface ena Adsl91}
:if ($sta93="disabled") do={/interface ena Adsl93}
:delay 9
:set  add56 [/ip address get [/ip address find interface=Adsl56] network]
:set  add91 [/ip address get [/ip address find interface=Adsl91] network]
:set  add93 [/ip address get [/ip address find interface=Adsl93] network]
:if ("$add91" = "$add56") do=[/int dis Adsl91]
:if ("$add91" = "$add93") do=[/int dis Adsl91]
:if ("$add93" = "$add56") do=[/int dis Adsl93]
:if ("$add91" != "$add56" and "$add91" != "$add93") do={/system scheduler dis [/system scheduler find name=Gate91]}

另外,每天5点定时断开一次PPPOE,
#
/int pppoe-c dis Adsl91
:delay 9
/int pppoe-c ena Adsl91
/int pppoe-c dis Adsl93
:delay 9
/int pppoe-c ena Adsl93
/system scheduler ena [/system scheduler find name=Gate91]
/system scheduler ena [/system scheduler find name=Gate93]


routeros
发表于 2016-5-1 11:05:39 | 显示全部楼层
請教一下,就算gateway相同,
gateway不是可以指定interface名稱做區分,如wan1 / wan2
或者用168.95.98.254%wan1 / 168.95.98.254%wan2表示...

為何一定要用script run出兩個相異gateway?
routeros
回复

使用道具 举报

 楼主| 发表于 2016-5-1 13:30:31 | 显示全部楼层
本帖最后由 xuxi3201 于 2016-5-1 13:38 编辑

你说的对,  指定interface,我也是这么做的。

心理作用,我不喜欢同网关, 就弄了这个,网关相同就重新拨号。
route02.png
routeros
回复

使用道具 举报

发表于 2016-5-1 16:40:34 | 显示全部楼层
本帖最后由 cspm333 于 2016-5-2 02:05 编辑
xuxi3201 發表於 2016-5-1 13:30
你說的對,  指定interface,我也是這麼做的。

心理作用,我不喜歡同網關, 就弄了這個,網關相同就重新 ...

若要pppoe重撥無需先disable再enable ,直接enable就重新撥號了.

小弟改編您的script ,可去重複網關 與05:00:00自動重撥.
:foreach i in=[/interface pppoe-client find] \
   do={
          :local inf  [/interface pppoe-client get $i name]
          :local time [/system clock get time]
          :local remote ; :local dial
          /interface pppoe-client monitor $inf once do={:set remote $"remote-address" ; :set dial $uptime}

          :while ([:len [/ip address find network=$remote]]>1 || (([:pick $time 0 2]=05) && $dial>[:totime 1h])) \
              do={
                     /interface pppoe-client enable $inf ; :delay 4s
                     /interface pppoe-client monitor $inf once do={:set remote $"remote-address" ; :set dial $uptime}
                   }
        }


routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-4-26 00:06 , Processed in 0.097163 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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