PPP Keepalive ping

From MikroTik Wiki
Jump to: navigation, search

The goal

I recently ran into an issue where PPTP connections would drop packets after idle time of 00:01:00 (1 min). I wrote this little script to run within this time, which resets idle time to 00:00:00, effectively solving this issue.

The script

# Script: PPTP-KeepAlive
:local addr
/ppp active {
   :foreach i in=[find] do={
      :if ([get $i service] = "pptp") do={
         :set addr [get $i address]
         /ping ($addr) count=1

The schedule

/system scheduler
add comment="" disabled=no interval=45s name=PPTP-KeepAlive on-event=\
    PPTP-KeepAlive policy=read,test start-time=startup