Skip to content

Instantly share code, notes, and snippets.

@wannadrunk
Last active March 24, 2025 19:29
Show Gist options
  • Select an option

  • Save wannadrunk/d3ea3f4f071a9d31fb1bfa16fd082be8 to your computer and use it in GitHub Desktop.

Select an option

Save wannadrunk/d3ea3f4f071a9d31fb1bfa16fd082be8 to your computer and use it in GitHub Desktop.

Revisions

  1. wannadrunk revised this gist Oct 13, 2023. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions mt-nt-pri-pub
    Original file line number Diff line number Diff line change
    @@ -4,18 +4,18 @@
    :local wanInterface "pppoe-out1";

    :if ($"local-address" in 100.64 .0.0/10) do={
    :if ($reconnectCount < 10) do={
    :set reconnectCount ($reconnectCount+1);
    :log warning ("$wanInterface: Got Private IP ".$"local-address"." Reconnecting the interface...");
    :if ($reconnectCount < 10) do={
    :set reconnectCount ($reconnectCount+1);
    :log warning ("$wanInterface: Got Private IP ".$"local-address"." Reconnecting the interface...");

    /interface pppoe-client disable $wanInterface;
    :delay 5s;
    /interface pppoe-client enable $wanInterface;
    /interface pppoe-client disable $wanInterface;
    :delay 5s;
    /interface pppoe-client enable $wanInterface;

    } else={
    :log error ("$wanInterface: Reconnect count exceeded, currently using ".$"local-address");
    }
    } else={
    :log error ("$wanInterface: Reconnect count exceeded, currently using ".$"local-address");
    }
    } else={
    :set reconnectCount 0;
    :log info ("$wanInterface: Got Public IP ".$"local-address");
    :set reconnectCount 0;
    :log info ("$wanInterface: Got Public IP ".$"local-address");
    }
  2. wannadrunk created this gist Oct 13, 2023.
    21 changes: 21 additions & 0 deletions mt-nt-pri-pub
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # Don't forget to change the "wanInterface" value below to your PPPoE interface

    :global reconnectCount;
    :local wanInterface "pppoe-out1";

    :if ($"local-address" in 100.64 .0.0/10) do={
    :if ($reconnectCount < 10) do={
    :set reconnectCount ($reconnectCount+1);
    :log warning ("$wanInterface: Got Private IP ".$"local-address"." Reconnecting the interface...");

    /interface pppoe-client disable $wanInterface;
    :delay 5s;
    /interface pppoe-client enable $wanInterface;

    } else={
    :log error ("$wanInterface: Reconnect count exceeded, currently using ".$"local-address");
    }
    } else={
    :set reconnectCount 0;
    :log info ("$wanInterface: Got Public IP ".$"local-address");
    }