Community discussions

MikroTik App
 
User avatar
Halfeez92
Member Candidate
Member Candidate
Topic Author
Posts: 101
Joined: Tue Oct 30, 2012 12:58 pm
Location: 127.0.0.1
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: 35
Joined: Thu Aug 06, 2015 2:57 am
Location: Croatia

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: 35
Joined: Thu Aug 06, 2015 2:57 am
Location: Croatia

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
 
User avatar
Halfeez92
Member Candidate
Member Candidate
Topic Author
Posts: 101
Joined: Tue Oct 30, 2012 12:58 pm
Location: 127.0.0.1
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
Forum Guru
Forum Guru
Posts: 1070
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...
 
User avatar
Halfeez92
Member Candidate
Member Candidate
Topic Author
Posts: 101
Joined: Tue Oct 30, 2012 12:58 pm
Location: 127.0.0.1
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.
 
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";
}
 
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: 12
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: Ahrefs [Bot], anav, GoogleOther [Bot], Majestic-12 [Bot], muona, simonefil, TheCat12 and 90 guests