Community discussions

MikroTik App
 
Halfeez92
newbie
Topic Author
Posts: 38
Joined: Tue Oct 30, 2012 12:58 pm
Contact:

Script for interface LTE to restart

Sun Feb 04, 2018 1:00 pm

Hi,

I have an SXT LTE modem, now the problem is sometimes the LTE connection will drop and I have to manually log in into the GUI and disable and re-enable back the interface. So I wish someone can help me with the scripting that can:

- ping check at 8.8.8.8 and if there any drop more than 20 packet,
- it will auto disable it and logged then re-enable the interface back.
- else it will run for every 1 minute on the scheduler with 'Connection OK' logged.

Thank you.
 
Grickos
newbie
Posts: 32
Joined: Thu Aug 06, 2015 2:57 am

Re: Script for interface LTE to restart  [SOLVED]

Sun Feb 04, 2018 1:19 pm

:if ( [/ping 8.8.8.8 count=10 size=64 interval=2s ] =0) do={
:log error "-----No ping";
/system routerboard usb power-reset duration=10;
:log error "----Reset USB Power";
} else={
#:log info "-----LTE OK-----";
}
 
Grickos
newbie
Posts: 32
Joined: Thu Aug 06, 2015 2:57 am

Re: Script for interface LTE to restart

Sun Feb 04, 2018 1:25 pm

You can change what you want. but time 1min is too short. If something really is not good with lte, it will loop in, restart every minute. Or add script restart lte pauses 1.min restart then pauses 5.min ....15.min
 
klaus007
just joined
Posts: 19
Joined: Thu Aug 17, 2017 1:11 pm

Re: Script for interface LTE to restart

Sun Feb 04, 2018 1:30 pm

Hello!

I have the same problems with two NetMetals and Huawei ME909s-120 since 6.41.
At the moment I make a restart of the LTE1-interface every 24hours an I would be also interested in such script.

regards
 
Halfeez92
newbie
Topic Author
Posts: 38
Joined: Tue Oct 30, 2012 12:58 pm
Contact:

Re: Script for interface LTE to restart

Sun Feb 04, 2018 2:51 pm

You can change what you want. but time 1min is too short. If something really is not good with lte, it will loop in, restart every minute. Or add script restart lte pauses 1.min restart then pauses 5.min ....15.min
yea i was thinking the same but i just want to give a sample situation. Because sometimes my lte interface will drop when there is no activity or in idle state
 
User avatar
eworm
Long time Member
Long time Member
Posts: 613
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Script for interface LTE to restart

Sun Feb 04, 2018 10:35 pm

Just use "/ tool netwatch" for that...
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
Halfeez92
newbie
Topic Author
Posts: 38
Joined: Tue Oct 30, 2012 12:58 pm
Contact:

Re: Script for interface LTE to restart

Sun Feb 11, 2018 8:20 pm

:if ( [/ping 8.8.8.8 count=10 size=64 interval=2s ] =0) do={
:log error "-----No ping";
/system routerboard usb power-reset duration=10;
:log error "----Reset USB Power";
} else={
#:log info "-----LTE OK-----";
}
Speaking of which, does LTE interface built in SXT LTE can be power reset on the system USB?
 
zivtal
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Sun Feb 05, 2017 6:22 pm

Re: Script for interface LTE to restart

Sun Feb 11, 2018 10:08 pm

enable/disable to lte interface not help? if you need restart, just reboot the device it's only stadalone lte device...
:if ([/ping 8.8.8.8 count=10 size=64 interval=2s]=0) do={
	:log error "LTE DOWN";
	/system reboot;
} else={
	:log info "LTE FINE";
}
Last edited by zivtal on Sun Feb 11, 2018 10:14 pm, edited 1 time in total.
CCR1009-8G-S+S+PC | RB962UiGS-5HacT2HnT | RBOmniTikPG-5HacD | RB750Gr3 | RBwAPG-5HacT2HnD
 
zivtal
Frequent Visitor
Frequent Visitor
Posts: 57
Joined: Sun Feb 05, 2017 6:22 pm

Re: Script for interface LTE to restart

Sun Feb 11, 2018 10:13 pm

I don't really know the SXT LTE, but you can try (disable and enable lte interface):
:if ([/ping 8.8.8.8 count=10 size=64 interval=2s]=0) do={
	:log error "LTE DOWN";
	/interface disable <interface>
	/delay 1s
	/interface enable <interface>
} else={
	:log info "LTE FINE";
}
CCR1009-8G-S+S+PC | RB962UiGS-5HacT2HnT | RBOmniTikPG-5HacD | RB750Gr3 | RBwAPG-5HacT2HnD
 
owenilc
just joined
Posts: 2
Joined: Mon Feb 12, 2018 11:46 pm

Re: Script for interface LTE to restart

Tue Feb 13, 2018 12:01 am

Thanks, the following scripts works for me! I add this scripts to Tools ==> Netwatch ==> Host, when Host 8.8.8.8 is down, run script.
My 4G/LTE USB Dongle is Huawei E8372h-607.
I don't really know the SXT LTE, but you can try (disable and enable lte interface):
:if ([/ping 8.8.8.8 count=10 size=64 interval=2s]=0) do={
	:log error "LTE DOWN";
	/interface disable <interface>
	/delay 1s
	/interface enable <interface>
} else={
	:log info "LTE FINE";
}
 
canvcol
just joined
Posts: 6
Joined: Fri Oct 11, 2019 11:59 am

Re: Script for interface LTE to restart

Thu Nov 21, 2019 1:33 pm

Hello, hoping someone might have some ideas on this.

I have a wAP LTE kit in a remote location with mediocre signal. Currently I am using the system watchdog with 8.8.8.8 set to ensure things are kept alive. It is activating probably every one or two hours.

My questions:

1. Is it a bad idea to use the system watchdog in this case? (e.g. doing so many "harsh" reboots?)
(the device is now in a very remote location and I would rather not play around too much in case I lose my ability to connect remotely!)

2. If I should use one of the scripts here - would it be better to use the "/interface disable/enable" method or the "usb power-reset" method? For wAP LTE kit

3. Is there any reason not to use Tools Netwatch to implement this script? (e.g. vs scheduler)

Who is online

Users browsing this forum: Lifz, Voisanats and 128 guests