script to auto restart pptp interface

Hi All,

I need some help. I have some pptp interfaces that lock up at random times.

How can I monitor the interface and have it restart when it locks up.

I think I need to run netwatch to trigger a script but do not know where to start with the syntax.

CCR 10 16 Ver 6-10

you could check if your pptp interfaces running with this script

:if ([/interface pptp-client get pptp-out1 running]=true) do={} else={:log warning "pptp-out1 NOT running"; :interface pptp-client disable pptp-out; :delay 1; :interface pptp-client enable pptp-out;};

and run it with scheduler in the time you want. But you should do that to all your ppptp interfaces one by one or your could add a for loop to this script.

thanks that’s really helpful.
I will try that today

Hi,

Script works great but need to modify it slightly. When the interface locks i get an error to do with protocol unrecognised in the log. However the interface still appears to be running ie: has an R flag. but no traffic is flowing

Is it possible to ping an external host via the interface and trigger the restart when it times out after say 5 pings for example?

Many thanks for your attention

you could do something like:

:if ([/ping 8.8.8.8 count=5]=0) do={} else {};

but you ping goes out via your default gateway !!! if that is your pptp, then it’s ok…

hi i need the ping to go out the pptp interface i am monitoring is that possible?

You can use something like this... its from another script I wrote... but you can modify it accordingly... Just run it every n minutes or whatever you want.
:local WANInterface ether1

:local pingTarget 8.8.8.8

:local failureThreshold 3

:local pingResult

Script

:global pingFailuresWAN

:if ([:typeof $pingFailuresWAN] = "nothing") do={:set pingFailuresWAN 0}

:set pingResult [ping $pingTarget count=1 interface=$WANInterface]

:if ($pingResult = 0) do={
:if ($pingFailuresWAN < ($failureThreshold+2)) do={
:set pingFailuresWAN ($pingFailuresWAN + 1)

	:if ($pingFailuresWAN = $failureThreshold) do={
		:set WState1 0
	}
}

}
:if ($pingResult = 1) do={
:if ($pingFailuresWAN > 0) do={
:set pingFailuresWAN ($pingFailuresWAN - 1)

	:if ($pingFailuresWAN = ($failureThreshold -1)) do={
		:set WState1 1
	}
}

}

thanks for your answers. this forum is fantastic

Remove MRRU from pptp server and client, or wait 6.11


Later I post another simply solution, but just one questions:

you use pptp static interfaces or are all dynamics?

They are all Dynamic ip Clients if that is what you mean

Not, I mean “pptp static interfaces” on /ppp
but if you answer so, I think you do not use static interface [best practice!]

Later , I answer again with a simple script for check that.
I must write the script, but simply you must ping the other side of pptp to check if pptp are working.

Remove MRRU from pptp server and client, or wait 6.11

Thank you rextended,

I look forward to the script.

many many thanks

I think many people will make use of this. Well done and thank you so much.