Hi All,
Need some advise here. My HexS on 6.45.2 with a pppoe client to vodafone adsl. If the ADSL dies and comes back up, the connection is not restored by the HexS.
Where as on my very old Draytek and RouterX, the connection restores itself, under any actions, such as disconnecting the WAN cable, Power cycling the ADSL modem, disconnecting the incoming ADSL feed etc..
Only way I have been able to restore connection, is to reboot the HexS. Tried, WAN cable being dis & reconnect, disable/enable on the Eth1 and pppoe-1 etc..
When I look at the logs, it tries to connect, then disconnects as per the timeout.
I did once, change the MTU from 1480 to 1490 and it recovered. Wonder if I should flick the MTU to recover, rather than reboot ?
We assume your PPPoE interface is named PPPoE1 and the interface your modem/ONT/GPON is connected to is ether1. Change as needed.
Create script checkpppoe
:local WanName "PPPoE1"
:local WanStat
/interface pppoe-client monitor $WanName once do={ :set WanStat $status}
if ($WanStat = "disconnected") do={/system script run "ResetInterfaces";}
Create script ResetInterfaces
:log info "Disabling ether1 and PPPoE1"
/interface set disabled=yes PPPoE1
/interface set disabled=yes ether1
delay 10
:log info "Enabling ether1 and PPPoE1"
/interface set disabled=no ether1
/interface set disabled=no PPPoE1
delay 10
Edit the profile for your PPPoE client connection
On scripts tab add for both up and down
delay 5
/system script run "checkpppoe"
What this does: when the status of the pppoe client is disconnected, it disables both the physical port and the pppoe interface and then enables them back.
I use it on my home Mikrotik because sometimes after a reboot the pppoe client will just not connect and gets stuck in a loop.
The above scripts fixes the problem for me. Might help you also.
Hi Inteq,
Almost there, the script when kicked off manually, restores the pppoe connection.
The “Edit the profile for your PPPoE client connection
On scripts tab add for both up and down” does not appear to pick up when the link is down. I simulated this by disconnecting the incoming ADSL/PSTN 2 wire into the ADSL modem. Status shown on the pppoe is Terminating not Up or Down.
2 states I witnessed are Connected and Terminating. , I must be missing something.. Anyway good progress…
At lease I can now reconnect without having to reboot
Disconnect the cable again. The one from the phone line to ADSL modem, not the one between ADSL modem and MIkrotik.
On Winbox, open the terminal and paste:
/interface pppoe-client monitor PPPoE1
Change PPPoE1 with your value
What is the Status value when the cable is unplugged?
Strange but welcomed behaviour disconnected the cable twice while leaving a minute before plugging back in, it recovered by itself after about a minute, once the cable was plugged back in.
However,
Before I started..
status: connected
uptime: 6h9m45s
active-links: 1
Once cable disconnected
[admin@MikroTik] > /interface pppoe-client monitor pppoe-out1
;;; 1492 works well on Ubuntu
status: terminating… - peer is not responding
the above remained the same, even for a while after the cable was reconnected. Then it recovered by itself
Changed to terminating.
added comments to the chkppoe to see if it is picking up the correct state being reported WanStat
added $ to WanStat and now so the log now shows the actual state.
/interface pppoe-client monitor $WanName once do={ :set $WanStat $status}
:log info “Checking PPOE”
:log info $WanStat
if ($WanStat = “terminating”) do={system script run “ResetInterfaces”;}
I dont think chkppoe is being triggered in the fist place by the profile up/down tab, below from export
/ppp profile
add interface-list=WAN2 name=ReConnectPPOE on-down=“delay 5\r
\n/system script run "chkpppoe"” on-up=“delay 5\r
\n/system script run "chkpppoe"”
the rest…
/system script
add dont-require-permissions=no name=chkpppoe owner=admin policy=
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=“:local WanName "pppoe-out1"\r
\n:local WanStat\r
\n:log info "Checking PPOE"\r
\n/interface pppoe-client monitor $WanName once do={ :set **$**WanStat $status}\r
\nif ($WanStat = "disconnected") do={system script run "ResetInterfaces";}\r
\n”
add dont-require-permissions=no name=ResetInterfaces owner=admin policy=
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=“:log info "Disabling ether1 and pppoe-out1"\r
\n/interface set disabled=yes pppoe-out1\r
\n/interface set disabled=yes ether1\r
\ndelay 10\r
\n:log info "Enabling ether1 and PPPoE1"\r
\n/interface set disabled=no ether1\r
\n/interface set disabled=no pppoe-out1\r
\ndelay 10”
I may be missing something, but I’ve understood from the OP that the issue to be addressed was the need to reboot the machine as softer methods didn’t lead to re-establishment of the connection?
So unless the script reboots the machine (no matter what way of detecting the issue it uses), it cannot resolve that issue. On the contrary, if taking the /interface pppoe-client down for e.g. 120 seconds does help, I’d recommend not to rely on pppoe state monitoring and up/down scripts.
What I do is that I run the following script every 1m3s:
if ([:len [/ip firewall address-list find list=netwatch-responders]] = 0) do={
/interface pppoe-client disable [find name="pppoe-out-wan"]
:delay 10s
/interface pppoe-client enable [find name="pppoe-out-wan"]
:delay 40s
/tool e-mail send to=me@mail.com subject="pppoe at xxxx has been restarted"
}
I must say that during the past year or more I only remember one case where the script fired and the root cause wasn’t tracked down to a power outage (where the modem starts up much longer than the Tik so the script fires on false positive), but the reason for me to create it was that I came to the site on complaint that it went offline and the only thing necessary was to disable and re-enable the PPPoE interface.
But the reasons for the PPPoE interface getting stuck may be multiple, so I don’t exclude that in your case the disable and re-enable is insufficient. But it would be really beneficial for all Mikrotik PPPoE users if you could sniff the ether1 traffic in such case into a file for, say, 3 minutes, then disabling and re-enabling the interface without stopping the sniff, and after 3 more minutes of sniffing, download the file and reboot, This way, Mikrotik support could see the communication exchange with the PPPoE server in this state and find a treatment for it.
Hi sindy,
I have a Dual Wan setup, one with StaticIP as Primary and the other as pppoe as secondary with load sharing . When I found that not traffic was not flowing across the pppoe link, (not sure for how long), Tried enabling and disabling ether1 and then the pppoe-out1 in varied sequences and waited and waited. Initially my firmware during this was 6.43 and during the activities. Eventually, rebooted the Tik, and pppoe restored itself. Subsequently, updated to 6.45 and and tested again by disconnecting the ADSL entering the modem. Same failure to self recover and started this post.
Strangely, after inserting the self recovery scripts from inteq, testing by disconcerting the cable to the modem and restoring did not trigger the script etc… and so on. However, the Tik is now recovering the pppoe by itself.
Will add the below 1m3 script to alert when the adsl dies, also will put something in place to sniff over the weekend.