Community discussions

MikroTik App
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 10:22 am

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
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 11:25 am

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.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 11:31 am

do you have the script for me :-) ?
thx, richard
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 12:11 pm

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
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 12:21 pm

looks perfect....
but where is the query if the internet is down or not ?
richard
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 12:36 pm

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.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 12:44 pm

great idea :-)
you put the "swap code" in the "DOWN" tab ?
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 12:49 pm

/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.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 1:14 pm

thx !!!!!
Richard
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 2:08 pm

Glad to help.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 5:17 pm

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
 
solar77
Long time Member
Long time Member
Posts: 586
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

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

Thu Jun 04, 2020 5:41 pm

human, you want them all do you? 8)
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.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

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

Thu Jun 04, 2020 5:44 pm

ok, i will try this way :-)
thx !!!!

Who is online

Users browsing this forum: No registered users and 40 guests