I'm using Mikrotik for three years and working for WISP two years now. We have several ADSLs connections(pppoe clients) running and sharing internet threw pptp into the nodes where the clients are connected. The problem with these ADSLs is that during the day (not every day) we have disconnections and the customers still trying to access to the internet from those lines because the pptp is still connected to the gateway router (where the ADSL is). So for that I had to make a script by checking the pppoe status and if the pppoe dropped the script will close the pptp server and when the pppoe is back again will enable the pptp server so the nodes can connect to the gateways. The script i made is separeted in 4 different scripts to avoid problems and confusing of the script.
Part 1: (name of the script DSL CHECK STATUS START )
Code: Select all
/interface pppoe-client monitor ADSL once do={
:if ($status= "connected") do={:log warning "DSL is ok"; :delay 60s; /system script run "DSL CHECK STATUS START";}
else={:log warning "Dsl Is Down!!!, Disabling PPTP Server And Go To Next Step"; /interface pptp-server server set enabled=no; /system script run "DSL CHECK STATUS NEXT"}
}
Part 2: (name of the script DSL CHECK STATUS NEXT )
Code: Select all
/interface pppoe-client monitor ADSL once do={
:if ($status= "connected") do={:log warning "Dsl is Now Up!!! ,running next script"; :delay 20s; /system script run "PPOE";}
else={:log warning "Nothing Yet, Re Check In 30secs"; :delay 30s; /system script run "DSL CHECK STATUS NEXT"; }
}
Part 3: (name of the script PPOE )
Code: Select all
/system script run "pptp server up"; log warning "Pptp Server Just Enabled,script is running, wait 5secs";
:delay 5s;
/interface pppoe-client disable ADSL; log warning "Pppoe Disabled, wait 5secs";
:delay 5s;
/interface pppoe-client enable ADSL; log warning "Pppoe Enabled, wait 2secs";
:delay 2s;
/interface pppoe-client disable ADSL; log warning "Pppoe Disabled, wait 2secs";
:delay 2s
/interface pppoe-client enable ADSL; log warning "Pppoe Enabled, wait 25secs and start from beginning";
:delay 25s;
/system script run "DSL CHECK STATUS START";
Part 4: (Name of the script pptp server up )
Code: Select all
/interface pptp-server server set enabled=yes;
Schedule 1: name: ADSL Check
Start Time: startup
Interval: 00:00:00
Code: Select all
:delay 10s;
/system script run "DSL CHECK STATUS START"
Schedule 2: name ADSL Check cycle
Start Time: startup
Interval: 15:18:00
Code: Select all
/system script run "DSL CHECK STATUS START"
*The script is working on version 6.35.2 and on previous versions.
I hope i will help some people out there as i found solutions in some problems I had before.
Thank you very much Mikrotik.
Greetings from Greece.
Alex