I need a script to determine if the pppoe-out1 state is connected
If not, retest every three seconds
Run if connected
Time delay: 3S
/Int PPPoE client set pppoe-out2 disabled = no
I need a script to determine if the pppoe-out1 state is connected
If not, retest every three seconds
Run if connected
Time delay: 3S
/Int PPPoE client set pppoe-out2 disabled = no
:if ([/interface get [/interface find name=pppoe-out1] running]=yes) do={
delay 3000
/interface pppoe-client set pppoe-out2 disabled=no}
The script is written according to your ideas,
However, there is a big problem with your logic:
If pppoe-out1 is in the connected state, then pppoe-out2 will keep repeating the connection and disconnection actions.
Maybe the following is right for you:
:if ([/interface get [/interface find name=pppoe-out2] disabled]=yes) do={
:if ([/interface get [/interface find name=pppoe-out1] running]=yes) do={
delay 3000
/interface pppoe-client set pppoe-out2 disabled=no}}
Tested and working to determine if the connection is active:
:if (([/interface pppoe-client monitor pppoe-out1 as-value once]->"status") = "connected") do={:put "connected"}
{
:local limiter
while (([/interface pppoe-client monitor pppoe-out1 as-value once]->"status") != "connected") do={
/interface set pppout-out1 disable=yes
:set $limiter ($limiter + 1)
:if (($limiter % 5) = 0) do={delay 5m} else={delay 3s}
/interface set pppout-out1 disable=no
}
}
After 5 retries it waits 5 minutes before enabling an try again 5 times. This because ISP do tend to block new connects if you tried a few times and give you a 5 minute cool-down period. After that you can try again a few times.
Explanation of the % :
modulo operation :put (5 % 3);
Hello,
I have 10 PPPoE clients, I need a script check all PPPoE client IP address and disable the ones that has IP address from range ( 192.168.5.x) , can please help me .
Regards,