Answer the question
In order to leave comments, you need to log in
How to create a Mikrotik pppoe-client reconnect script based on parsing the first IP octet?
I know the question has already been raised. Based on this script, I fixed it to reconnect pppoe-client in order to get away from an IP address that is not accessible from the outside:
:delay 10
:local "currentIP" [:pick [/ip address get [find interface =pppoe-out1] address ] 0 2]
:while ($currentIP = 82) do={
/interface pppoe-client enable pppoe-out1
}
:delay 10
:local "currentIP" [:pick [/ip address get [find interface =pppoe-out1] address ] 0 2]
:while ($currentIP = 82) do={
/interface pppoe-client enable pppoe-out1
:delay 2
:local "currentIP" [:pick [/ip address get [find interface =pppoe-out1] address ] 0 2]
}
:while ($currentIP = 82 | 83)
?
Answer the question
In order to leave comments, you need to log in
Read carefully the answer to the script that you took as a basis. There is a simple and very beautiful solution (not mine). Easily customizable to your needs:
:global newIP [/ip address get [find interface="PPPoE"] address];
:if (($newIP in 82.0.0.0/8)||($newIP in 83.0.0.0/8)) do={
/interface pppoe-client disable PPPoE
:delay 30
/interface pppoe-client enable PPPoE
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question