Skip to content

Instantly share code, notes, and snippets.

@wannadrunk
Last active September 14, 2023 14:32
Show Gist options
  • Save wannadrunk/c4e37baf5be8f98e1509bac2afa9f14c to your computer and use it in GitHub Desktop.
Save wannadrunk/c4e37baf5be8f98e1509bac2afa9f14c to your computer and use it in GitHub Desktop.
Mikrotik Script to reconnect the pppoe that get the NAT IP. Some ISP provide both public and NAT IP to subscriber. Create a ppp profile and put this script in On Up section. Update the wanInterface according to yours.
:global reconnectCount;
:local wanInterface "pppoe-out1";
:while ( $"local-address" in 100.64.0.0/10 ) do={
:log warning ("$wanInterface: Got Private IP ".$"local-address"." Reconnecting the interface...");
/interface pppoe-client disable $wanInterface;
:delay 10s;
/interface pppoe-client enable $wanInterface;
};
:log info ("$wanInterface: Got IP ".$"local-address");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment