tx rx fp rx dropped pppoe account

Znevna

Stop traffic on pppoe-out1 who stuck on be running but not transfer any traffic. Similar situation is at l2tp tunnels, after reboot the one direction is not work and tunnel must be re-enabled and this can be happend with low probably but I see this in few mth again for years.
.

The FP Tx = 0 ?

It’s symptom. Autor of post cannot write other difference on working and stuck connection without this Rx=0.
.

That’s normal.

On links who have small traffic yes but not if you have got constancy traffic. You mean main optic links in ocean have got sometimes Rx=0 ?
.

While connected to a router which is mostly idle, from outside.:
And after being connected also to a device behind it so the firewall has to forward a few packets:
No issue.
ppp-wan wasn’t reconnected since boot. (link downs = 0).

Congratulation. Not every ROS and RB works well, I hope your luck will be permanent.

Weird. I have not seen something like this with PPPoE and we mostly have PPPoE around here, almost all ISPs offer PPPoE connections.
A config export wouldn’t hurt, before digging more. As for the FP counter you’d have to be sure your fastracking rules are properly set and you don’t have your traffic bypassing it
So, yeah, not very reliable to script against it.
Also, your joke about the optical ocean link, RX no, it might not be 0. But he was talking I think of FP Rx (actually I’ve seen it’s FP Tx) which is not the same thing.
But, he didn’t give many details. And in the ones he gave I have not seen RX 0, or TX 0, only FP Tx 0 which as i’ve tested above, can happen in a normal use case.

Znevna

YES, I agree.
Question please ask to Topic author about export, version his ROS and RB, I try do at all I could.
Topic autor not provide properly data to create right script then I give him my “better Netwatch solution” because he have only one wan interface and this is good way to solve his problem.

P.S. Maybe problem will be solve by upgrade and he have got mAP as main router but all this are “maybe”.

@Sib tested the code over three days. Please check attached screen. even with netwatch setting, the internet down and back with manual disable and enable the pppoe client account
Sib1.png
Sib.png

Also i refer back to first suggestion by you @Sib
I add below hope it will disable and enable pppoe account once traffic went to 0

/interface set pppoe-out1 disabled=yes
:delay 25
/interface set pppoe-out1 disabled=no

What you think?

First, If you have both netwatch with the same

  • host to check
  • comment

then this stops works because a down-script read and search a proper status since from only one netwatch with upper condition. Now he not work properly.
Please stay only one netwatch with this comment.
Netwatch haven’t created a schedulers after DOWN happend and not do a future fix work.
or change the DOWN-sctipt to this one who check additional the ENABLE netwatch:

log error "start Netwatch DOWN-script...";

# ################ MAIN PROGRAM BELOW, NOT HERE ##############
# ################ DEFINE FUNCTION SOLVING Crossing Midnight ###########################

# Fix Crossing 24:00:00=00:00:00
/local SiBFixDateTime do={
/local SiBTimeToChange "23:45:00";
/local SiBTimeToChange $2;
/local SiBTimeDiffToAdd "60m2s"; # diff time < 24h
/local SiBTimeDiffToAdd $3; # diff time < 24h
#/local SiBDate "dec/31/2020"
/local SiBDate $1
/local SiBDateCorrected;

#log warning ("Source: ".$SiBDate." ".$SiBTimeToChange." + ".$SiBTimeDiffToAdd);
#put ("Source: ".$SiBDate." ".$SiBTimeToChange." + ".$SiBTimeDiffToAdd);

# Add diff time <=24h
/local SiBTimeAndDiffTime ($SiBTimeToChange + $SiBTimeDiffToAdd );
/if ([/len $SiBTimeAndDiffTime]=8) do={/set $SiBDateCorrected ($SiBDate." ".$SiBTimeAndDiffTime); };
/if ([/len $SiBTimeAndDiffTime]>8) do={
  /set $SiBTimeAndDiffTime ($SiBTimeAndDiffTime-1d);

  ## Add 24h to date, copy time if exist.
  set $SiBDateCorrected ($SiBDate." ".$SiBTimeAndDiffTime);

  # Days: 01-27
  local SiBDayToChange [/pick $SiBDateCorrected 4 6;];
  if ($SiBDayToChange<=27) do={
      set $SiBDayToChange ($SiBDayToChange+1);
      if ([/len $SiBDayToChange]=1) do={set $SiBDayToChange ("0".$SiBDayToChange)}
      set $SiBDateCorrected ( [/pick $SiBDateCorrected 0 4].$SiBDayToChange.[/pick $SiBDateCorrected 6 20] );
    } else={
      if ($SiBDayToChange!=31) do={

          # Days: 28..30; Main magic do internal scheduler.
          /system scheduler remove [find name=SiBTempScheduler2qw34er5v78bn90m];
          /system scheduler add name=SiBTempScheduler2qw34er5v78bn90m on-event={nothing } start-time=00:00:01 start-date=( [/pick $SiBDateCorrected 0 4].($SiBDayToChange+1).[/pick $SiBDateCorrected 6 11 ] );
          set $SiBDateCorrected ([system scheduler get [find name=SiBTempScheduler2qw34er5v78bn90m] start-date].[/pick $SiBDateCorrected 11 20 ]);
          /system scheduler remove [find name=SiBTempScheduler2qw34er5v78bn90m];
        } else={

          # Day 31 for Jan..Nov
          /local SiBMonths ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
          /local SiBMounthToChange [/pick $SiBDateCorrected 0 3];
          for x from=0 to=10 do={if ([/pick $SiBMonths $x]=$SiBMounthToChange) do={ set $SiBDateCorrected ([pick $SiBMonths ($x+1)]."/01".[/pick $SiBDateCorrected 6 20 ]) }}

          # Day 31 for Dec
          if ($SiBMounthToChange="dec") do={ set $SiBDateCorrected ("jan/01/".([/pick $SiBDateCorrected 7 11]+1).[/pick $SiBDateCorrected 11 20] )}
      };
    };
};

#log warning ("New date time: ".$SiBDateCorrected);
#put ("New date time: ".$SiBDateCorrected);
:return $SiBDateCorrected
};

# ################ MAIN PROGRAM ###########################

# Select a proper Netwatch who is ENABLE and have:
local LocNetWatchHost 1.1.1.1;
local LocNetWatchHostComment "InternetWatchDog";

# Still is status down?
local LocStatus [/tool netwatch get [find host=$LocNetWatchHost comment=$LocNetWatchHostComment disabled=no] status];
if ($LocStatus != "down") do={/quit;}

# Convert the Netwatch SINCE to separate date and time of current down-time.
local LocSince  [/tool netwatch get [find host=$LocNetWatchHost comment=$LocNetWatchHostComment status=down disabled=no] since];
local LocSinceDate ([/pick $LocSince 0 11]);
local LocSinceTime ([/pick $LocSince 12 20]);

# Add action to future via scheduler
/system scheduler remove [find where name~"SiBexInternetWatchDog_v"];

# Try MAIN ACTION 1 - PPPoE ReEnable after 20s

local SiBCrossMid [$SiBFixDateTime $LocSinceDate $LocSinceTime 20s ];
local SiBStartDate [pick $SiBCrossMid 0 11];
local SiBStartTime [pick $SiBCrossMid 12 20];
/system scheduler add name=SiBexInternetWatchDog_v1 on-event={/interface pppoe-client disable pppoe-out1; /interface pppoe-client enable pppoe-out1;} start-date=$SiBStartDate start-time=$SiBStartTime;

log error "stop Netwatch DOWN-script, Future action are scheduled";

About Rx=0 and action re-enable.
It was a first try but a “Traffic Monitor” detect you a “Rx=0 per 1 second” even when pppoe is working fine. This means this is not good way.
If TM have got option like… 20x happend = 20s with Rx=0 then run script - this will be your solution but TM not have build that counter.


If you fix comment in not active netwatch then you receive one of the best watchdog base on ping in this forum and realy you not must cheat with TM who cannot give you a state UP to reset or dec() external counter.

I have notice when script initiated, there is so many disconnect until authenticated and connected. Is it normal?
Sib3.png
Sib2.png

I am not using a PPPoE but with other VPN-s it’s common/often.

I think the Traffic Monitor Tool can do it

sopyan0807

TM run’s every seconds and it not check past results like NetWatch.
This means your scripts with delay command can be run multiple times. I hope now you know that TM cannot have a any delay in his script. This should be commands who run finish before 1s time.

I’m trying to use Sib’s script to monitor and then action disabling/enabling the LTE interface on a LHG LTE6 unit.

I’m not experienced with scripting but I simply copied and pasted his scripts. How can I post my config so you can check it?

OK I’ve posted my config below. If someone could have a look to see if the UP-script and Down-script is correct that would be appreciated.

[admin@MikroTik] > /export
# oct/11/2020 14:07:32 by RouterOS 6.45.9
# software id = RMT0-MA7S
#
# model = RBLHGR
# serial number = *************
/interface lte
set [ find ] mac-address=AC:50:43:1A:EE:FD name=lte1 network-mode=lte pin=1111
/interface ethernet
set [ find default-name=ether1 ] mac-address=48:8F:5A:34:AE:B0
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface lte apn
set [ find default=yes ] apn=everywhere name=EE
add apn=3internet default-route-distance=1 name=Three
add apn=payandgo.o2.co.uk default-route-distance=1 name=O2
add apn=wap.vodafone.co.uk authentication=pap default-route-distance=1 name=\
    "Vodafone (Pay Monthly)" password=wap user=wap
add apn=pp.vodafone.co.uk authentication=pap default-route-distance=1 name=\
    "Vodafone PAYG" password=wap user=wap
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=dhcp disabled=no interface=ether1 lease-time=23h name=defconf
/system logging action
set 1 disk-lines-per-file=2000
add email-to=***@*** name=email target=email
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add comment=defconf interface=ether1 list=LAN
add comment=defconf interface=lte1 list=WAN
add list=LAN
/ip address
add address=192.168.88.1/24 comment=defconf interface=ether1 network=\
    192.168.88.0
/ip dhcp-server network
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
/ip firewall filter
add action=accept chain=input comment=\
    "defconf: accept established,related,untracked" connection-state=\
    established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
    invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
    "defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
    in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
    ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
    ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
    connection-state=established,related
add action=accept chain=forward comment=\
    "defconf: accept established,related, untracked" connection-state=\
    established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=\
    invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" \
    connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=\
    out,none out-interface-list=WAN
/system clock
set time-zone-name=Europe/London
/system logging
set 0 action=disk
add action=disk topics=lte
add action=disk topics=gsm
/system script
add dont-require-permissions=no name=UP-script owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/sy\
    stem scheduler remove [find where name~\"SiBexInternetWatchDog_\"];\r\r\
    \n/log warning \"RESET Netwatch scheduled DOWN-script... ISP WORKS\";\r"
add dont-require-permissions=no name=Down-script owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="# F\
    ix Crossing 24:00:00=00:00:00\r\r\
    \n/local SiBFixDateTime do={\r\r\
    \n/local SiBTimeToChange \"23:45:00\";\r\r\
    \n/local SiBTimeToChange \$2;\r\r\
    \n/local SiBTimeDiffToAdd \"60m2s\"; # diff time < 24h\r\r\
    \n/local SiBTimeDiffToAdd \$3; # diff time < 24h\r\r\
    \n#/local SiBDate \"dec/31/2020\"\r\r\
    \n/local SiBDate \$1\r\r\
    \n/local SiBDateCorrected;\r\r\r\
    \n#log warning (\"Source: \".\$SiBDate.\" \".\$SiBTimeToChange.\" + \".\$SiB\
    TimeDiffToAdd);\r\r\
    \n#put (\"Source: \".\$SiBDate.\" \".\$SiBTimeToChange.\" + \".\$SiBTimeDiff\
    ToAdd);\r\r\r\
    \n# Add diff time <=24h\r\r\
    \n/local SiBTimeAndDiffTime (\$SiBTimeToChange + \$SiBTimeDiffToAdd );\r\r\
    \n/if ([/len \$SiBTimeAndDiffTime]=8) do={/set \$SiBDateCorrected (\$SiBDate\
    .\" \".\$SiBTimeAndDiffTime); };\r\r\
    \n/if ([/len \$SiBTimeAndDiffTime]>8) do={\r  \r\
    \n/set \$SiBTimeAndDiffTime (\$SiBTimeAndDiffTime-1d);\r\r  \r\
    \n## Add 24h to date, copy time if exist.\r  \r\
    \nset \$SiBDateCorrected (\$SiBDate.\" \".\$SiBTimeAndDiffTime);\r\r  \r\
    \n# Days: 01-27\r  \r\
    \nlocal SiBDayToChange [/pick \$SiBDateCorrected 4 6;];\r \r\
    \nif (\$SiBDayToChange<=27) do={\r      \r\
    \nset \$SiBDayToChange (\$SiBDayToChange+1);\r      \r\
    \nif ([/len \$SiBDayToChange]=1) do={set \$SiBDayToChange (\"0\".\$SiBDayToC\
    hange)}\r      \r\
    \nset \$SiBDateCorrected ( [/pick \$SiBDateCorrected 0 4].\$SiBDayToChange.[\
    /pick \$SiBDateCorrected 6 20] );\r    } else={\r      \r\
    \nif (\$SiBDayToChange!=31) do={\r\r          \r\
    \n# Days: 28..30; Main magic do internal scheduler.\r          \r\
    \n/system scheduler remove [find name=SiBTempScheduler2qw34er5v78bn90m];\r  \
    \_      \r\
    \n/system scheduler add name=SiBTempScheduler2qw34er5v78bn90m on-event={noth\
    ing } start-time=00:00:01 start-date=( [/pick \$SiBDateCorrected 0 4].(\$SiB\
    DayToChange+1).[/pick \$SiBDateCorrected 6 11 ] );\r          \r\
    \nset \$SiBDateCorrected ([system scheduler get [find name=SiBTempScheduler2\
    qw34er5v78bn90m] start-date].[/pick \$SiBDateCorrected 11 20 ]);\r         \
    \r\
    \n/system scheduler remove [find name=SiBTempScheduler2qw34er5v78bn90m];\r  \
    \_     } else={\r\r          \r\
    \n# Day 31 for Jan..Nov\r          \r\
    \n/local SiBMonths (\"jan\",\"feb\",\"mar\",\"apr\",\"may\",\"jun\",\"jul\",\
    \"aug\",\"sep\",\"oct\",\"nov\",\"dec\");\r          \r\
    \n/local SiBMounthToChange [/pick \$SiBDateCorrected 0 3];\r          for x \
    from=0 to=10 do={if ([/pick \$SiBMonths \$x]=\$SiBMounthToChange) do={ set \
    \$SiBDateCorrected ([pick \$SiBMonths (\$x+1)].\"/01\".[/pick \$SiBDateCorre\
    cted 6 20 ]) }}\r\r          \r\
    \n# Day 31 for Dec\r         \r\
    \nif (\$SiBMounthToChange=\"dec\") do={ set \$SiBDateCorrected (\"jan/01/\".\
    ([/pick \$SiBDateCorrected 7 11]+1).[/pick \$SiBDateCorrected 11 20] )}\r   \
    \_  };\r    };\r};\r\r\r\
    \n#log warning (\"New date time: \".\$SiBDateCorrected);\r\r\
    \n#put (\"New date time: \".\$SiBDateCorrected);\r\r\
    \n:return \$SiBDateCorrected\r\r\
    \n};\r\r\
    \n\r\
    \n# Select a proper Netwatch who is ENABLE and have:\r\r\
    \nlocal LocNetWatchHost 1.1.1.1;\r\r\
    \nlocal LocNetWatchHostComment \"InternetWatchDog\";\r\r\r\
    \n# Still is status down\?\r\r\
    \nlocal LocStatus [/tool netwatch get [find host=\$LocNetWatchHost comment=\
    \$LocNetWatchHostComment disabled=no] status];\rif (\$LocStatus != \"down\")\
    \_do={/quit;}\r\r\r\
    \n# Convert the Netwatch SINCE to separate date and time of current down-tim\
    e.\r\r\
    \nlocal LocSince  [/tool netwatch get [find host=\$LocNetWatchHost \r\
    \ncomment=\$LocNetWatchHostComment status=down disabled=no] since];\r\r\
    \nlocal LocSinceDate ([/pick \$LocSince 0 11]);\r\r\
    \nlocal LocSinceTime ([/pick \$LocSince 12 20]);\r\r\r\
    \n# Add action to future via scheduler\r\r\
    \n/system scheduler remove [find where name~\"SiBexInternetWatchDog_v\"];\r\
    \r\r\
    \n# Try MAIN ACTION 1 - LTE ReEnable after 20s\r\r\r\
    \nlocal SiBCrossMid [\$SiBFixDateTime \$LocSinceDate \$LocSinceTime 20s ];\r\
    \r\
    \nlocal SiBStartDate [pick \$SiBCrossMid 0 11];\r\r\
    \nlocal SiBStartTime [pick \$SiBCrossMid 12 20];\r\r\
    \n/system scheduler add name=SiBexInternetWatchDog_v1 on-event={/interface l\
    te disable lte1; /interface lte enable lte1;} start-date=\$SiBStartDate star\
    t-time=\$SiBStartTime;\r\rlog error \"stop Netwatch DOWN-script, Future acti\
    on are scheduled\";\r"
/tool e-mail
set address=smtp.gmail.com from=andydhanson@gmail.com password=aslvhsneuerswrwv \
    port=587 start-tls=yes user=andydhanson@gmail.com
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool netwatch
add comment=InternetWatchDog down-script="/system script run DOWN-script  \r\
    \nlog error \"start Netwatch DOWN-script...\";" host=1.1.1.1 interval=5s \
    timeout=500ms up-script="/system script run UP-script "
/tool sms
set allowed-number=,,,,, port=lte1 receive-enabled=yes
[admin@MikroTik] >

I was getting script run errors with the log showing not enough permissions. I ticked the box not requiring permissions and the scripts are now running when the LTE connection goes down. Just need to fully test now on a live setup.

Thanks SiB for posting the scripts and all the work you’ve done on it.