Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #LTE APN Change script
- #Written by t.me/moneron
- #Discuss in t.me/mikrotikclub
- #This script requires read, write, test, policy policies
- #flag variable declaration
- :global laststate;
- #local variables set (change values with your apn names)
- :local passthroughAPNname apn-passthrough;
- :local nonpassthroughAPNname default;
- :local currentstate [/interface ethernet get [find default-name=ether1] running];
- #Fill global variables if empty
- if (($laststate != true) and ($laststate != false)) do={
- :set laststate false;
- };
- #Change APN profile if laststate and currentstate are different
- if ($laststate != $currentstate) do={
- if ($currentstate = false) do={
- if ([/interface lte get lte1 apn-profiles] = $passthroughAPNname) do={
- :log warning "Changing LTE to non-passthrough mode, please wait..."
- /interface lte set lte1 apn-profiles=$nonpassthroughAPNname;
- :do {:nothing} while=([/interface lte get lte1 running] = false);
- :log warning "LTE profile changed to default";
- };
- } else={
- :log warning "Changing LTE to passthrough mode, please wait..."
- /interface lte set lte1 apn-profiles=$passthroughAPNname;
- :do {:nothing} while=([/interface lte get lte1 running] = false);
- :log warning "LTE interface changed to passthrough mode";
- };
- set laststate $currentstate;
- };
Add Comment
Please, Sign In to add comment