Page 1 of 1

Interface Checking Script

Posted: Sun Aug 31, 2014 10:47 pm
by dangucci
Hi guys, I would like to know how to make a script to check if ppp-out1 interfaces's ip falls in an ip range which is, the first octet
must be 10, second octet 43 , third octet greater than 128 .. eg 10.43.129.23

If ip addres of ppp-out1 falls within the range then

script should exit

but if ip addres of ppp-out1 doesnt fall within the range then script should execute the command

interface ppp-client disable ppp-out1
interface ppp-client enable ppp-out1

this would be on a scheduled task to be run every 10 seconds

Thank you so much for all your help!!!!!

Re: Interface Checking Script

Posted: Tue Sep 02, 2014 10:41 am
by cdiedrich
Take a look at this Return IP octet function.
With this you should be able to easily compare the octets you need.
The rest should be pretty easy.
And have a look at this script.
I love the way it is implemented, as it will only trigger on a change of your public IP - no need to be run every 10 seconds.

Cheers
-Chris

Re: Interface Checking Script

Posted: Tue Sep 02, 2014 7:51 pm
by nonac
can you check all interface with script?

Re: Interface Checking Script

Posted: Wed Sep 03, 2014 8:59 pm
by dangucci
Thank for the reply but im a complete noob now learning mikrotik scripting and will be happy if i can be assisted on this please
Thanks once again

Re: Interface Checking Script

Posted: Thu Sep 04, 2014 8:43 am
by dangucci
can you check all interface with script?
just a single interface like ppp-out1 and checks if its ip is in the range 10.43... with the 3rd octet greater than 128
and will execute a command if its in the range or isnt
Thanks