Community discussions

MUM Europe 2020
User avatar
Topic Author
Posts: 312
Joined: Mon Jul 09, 2012 9:26 am

Restart PPPoE on ping fail

Wed Jan 02, 2013 9:01 pm


I'm using MikroTik for a year now, and until now I din't need to use "special" scripts. All these, which is available in the net was satisfying, but this time I can't find anything apropriate. Let's start from the beginning.

From 2 weeks I am facing issues with my ISP. It disconnects my ADSL modem and doesn't want to reconnect. Well, it looks like it is still connected (all the LEDs are on, modem web interface says "CONNECTED"), the only problem is, that there is no route to the Internet. There are only 2 things that can help:
1) modem restart,
2) PPPoE client restart on MikroTik (disable then enable the PPPoE connection).
I have already applied a claim to ISP, but of course it will take time when they will start doing anything. There was no problem when I was at home all the time, but now it will change. I need the MikroTik to check ping, and whenever it fails (ususaly after every 24-27 hours), disable and enable PPPoE interface. Here is configuration of my Interfaces:
 interface print 
Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME                                         TYPE               MTU L2MTU  MAX-L2MTU
 0  R  ;;; WAN
       ether1                                       ether             1500  1526       1526
 1  R  ;;; LAN
       wlan1                                        wlan              1500  2290
 2     ;;; VPN
       PPTP VPN                                     pptp-in         
 3  X  ;;; WAN
       Multimedia                                   pppoe-out       
 4     ;;; HotSpot
       wlan2                                        wlan              1500  2290
I need interface "Multimedia" to disable/enable if needed. It is switched off now, as I am using original modem, which doesn't work in bridge mode.
I have something in the net in the meantime, but I think it needs a bit of correcting.
:local int3 "Multimedia"; :local ip1 "";
# watchdog
:if ([/ping $ip1 count=3] = 0) do={
/interface disable $int3;
delay delay-time=3;
/interface enable $int3;
Is this more or less correct? What should I change here?
How to add this (coreected) script to scheduler, to make it work all the time, so it react immediately, when the connection is lost?

Thanks in advance.

Seems this one will be easier:
:if ([/ping count=3] = 0) do={
/interface disable Multimedia;
delay delay-time=2;
/interface enable Multimedia
Should that do the job?
Long time Member
Long time Member
Posts: 545
Joined: Sat Jul 05, 2008 11:50 am

Re: Restart PPPoE on ping fail

Wed Jan 02, 2013 10:27 pm

you dont need to schedule a script: use netwacth instead
on down of you can disable/pause/reenable pppoe interface
User avatar
Topic Author
Posts: 312
Joined: Mon Jul 09, 2012 9:26 am

Re: Restart PPPoE on ping fail

Wed Jan 02, 2013 11:11 pm

Thank you.
That did the job.
/tool netwatch ex    
# jan/02/2013 22:01:26 by RouterOS 5.22
# software id = B5KE-0Y4H
/tool netwatch
add disabled=no down-script="/interface disable Multimedia\r\
    \ndelay delay-time=2\r\
    \n/interface enable Multimedia" host= interval=3s timeout=1s up-script=""
just joined
Posts: 9
Joined: Fri Mar 08, 2013 9:03 am

Re: Restart PPPoE on ping fail

Wed Feb 25, 2015 6:14 am

I have this exact same problem currently. Did you ever end up getting a better solution or understanding?

Who is online

Users browsing this forum: No registered users and 21 guests