Last active
September 14, 2023 14:32
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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