ltAp .. assign APN to Sim Slot ... howto ?

i have two sim cards in my ltAP and want to change the card in winbox from remote.
They both have different APNs .. how can i assign the correct APN to SIM Slot up and down ?
is this possible ?

Richard

I do this with script . create APN profile for each SIM and the script would swap slot as well as assign correct APN .
otherwise , as soon as you change one of them remotely, you have no Internet.

do you have the script for me :slight_smile: ?
thx, richard

this is the script I use to swap SIM when the internet is down, sort of fail-over.

#get SIM info and swap
:local sim

set $sim [/system routerboard modem get sim-slot];


:if ($sim = "a") do={

:log warning "SIM A is active, now switching to B";
/interface set lte1 disabled=no;
:delay 1;
/interface lte set apn-profiles=Vodafone numbers=0;
/system routerboard modem set sim-slot=b;


} else={

:log warning "SIM B is active, now switching to A";
/interface set lte1 disabled=no;
:delay 1;
/interface lte set apn-profiles=default numbers=0;
/system routerboard modem set sim-slot=a;

}

as you can see I already set up two APN profile

looks perfect…
but where is the query if the internet is down or not ?
richard

i use netwatch, so if a ping to external IP address, say 8.8.8.8, is more than 100ms, I swap SIM.
I set the interval to 30 minutes but you can set it how you like it, just remember the swap itself would take few minutes, depending how quickly the other SIM can register on the network,
so you don’t want to keep swapping when the LTE is actually trying to register to the network.

great idea :slight_smile:
you put the “swap code” in the “DOWN” tab ?

/tool netwatch
add down-script=":log warning \" Internet Down swapSIM\";\r\
    \n/system script run swapSIM;\r\
    \n" host=8.8.8.8 interval=30m timeout=2s up-script=":log warning \" Internet Up \";"

where swapSIM is the name of the script
I find it more manageable this way, instead of dump all the script into netwatch.

thx !!!
Richard

Glad to help.

one final question …
my main sim card disconnects and connects every 12 hours (due to billing information) … how can i prevent the SWAP to the other sim card in this case ?
Richard

human, you want them all do you? :sunglasses:
unless you know exactly when it will be disconnected, there is always a chance the swap will be triggered by this disconnection.

you can add another script, check which slot is active and force the system to use your main SIM, run this every 12 hours.
again, plan the timing right so this action does not happen when the swapSIM is checking your connection.

ok, i will try this way :slight_smile:
thx !!!