Page 1 of 1

Mikrotik 3g watchdog

Posted: Mon Nov 07, 2011 12:45 am
by Ripper
How to write right script to check connection alive?

I've made script witch ping 8.8.8.8 for 5 pockets if he 0 pockets from 5 it will hung down ppp connection then wait for 3 sec and redial....

But now connection is down and mikrotik as I think can't reconnect.... maybe modem are freezes or something with port....

I've check by disabling ppp connection run script it successfully enable that connection ... tried to remove modem and put it again and it's okay ....


Now I 300 km away from that and I cant connect to MT ... which won't try to redial buy 3g ISP info...

How to write it right to prevent that situation.

Re: Mikrotik 3g watchdog

Posted: Mon Nov 07, 2011 3:54 am
by jandafields
How to write right script to check connection alive?

I've made script witch ping 8.8.8.8 for 5 pockets if he 0 pockets from 5 it will hung down ppp connection then wait for 3 sec and redial....

But now connection is down and mikrotik as I think can't reconnect.... maybe modem are freezes or something with port....

I've check by disabling ppp connection run script it successfully enable that connection ... tried to remove modem and put it again and it's okay ....


Now I 300 km away from that and I cant connect to MT ... which won't try to redial buy 3g ISP info...

How to write it right to prevent that situation.
Try having the script reboot the router instead of disable/enable ppp. Your connection should not go down very often, so rebooting shoudn't cause much downtime.

Re: Mikrotik 3g watchdog

Posted: Mon Nov 07, 2011 9:55 am
by janisk
reboot might help, or that script to mange ppp over 3g modem, but sometimes 3G modem hangs by itself. Newer RouterBOARD have feature to turn off power for USB device. That usually helps. If you do not have that feature, you will have to power down the router, since reboot only reboots RouterOS, it does not turn off the power of 3G modem. as result, after reboot, modem will be in same state as before the reboot.

Re: Mikrotik 3g watchdog

Posted: Mon Nov 07, 2011 4:55 pm
by jandafields
reboot might help, or that script to mange ppp over 3g modem, but sometimes 3G modem hangs by itself. Newer RouterBOARD have feature to turn off power for USB device. That usually helps. If you do not have that feature, you will have to power down the router, since reboot only reboots RouterOS, it does not turn off the power of 3G modem. as result, after reboot, modem will be in same state as before the reboot.
How new??? RB751U does not have that feature. It is very new!

Re: Mikrotik 3g watchdog

Posted: Tue Nov 08, 2011 12:51 am
by Ripper
I Have latest 5.8 software on new 751U-2Hnd so how to shutdown usb port ...

Is there way to check first (writed up script and if it fails for 3 times at row run router reboot or shutdown usb port and than turn it on again)

I have no access to MT router its 300 km away from me and it very difficult to drive there each time connection down.

Re: Mikrotik 3g watchdog

Posted: Tue Nov 08, 2011 1:07 am
by jandafields
I Have latest 5.8 software on new 751U-2Hnd so how to shutdown usb port ...

Is there way to check first (writed up script and if it fails for 3 times at row run router reboot or shutdown usb port and than turn it on again)

I have no access to MT router its 300 km away from me and it very difficult to drive there each time connection down.
USB can NOT be turned on/off on 751U.

Re: Mikrotik 3g watchdog

Posted: Sat Nov 19, 2011 8:06 pm
by Ripper
That's router is very bad to work with 3g modem it's randomly fails to connect and even watch dog don't help ...

It randomly disconnect and cant softwarely reconnect we need to turn off them and turn on it again.

Re: Mikrotik 3g watchdog

Posted: Thu Dec 08, 2011 11:46 pm
by mp3turbo
solution for you should be a hardware device that will cut off power for example each night at 04:00am for one minute.

This way your Mikrotik device INCLUDING 3G modem will be rebooted every night.

1) if everything was working correctly before, it will just introduce a approx. two minute downtime (one minute power off, one minute to boot up and start working)

2) if 3g modem or mikrotik was crashed, it will start working correctly.


Yes, I know this makes not so ideal solution - with device like I mention, the MAXIMUM possible downtime would be 23 hours 59 minutes. Not entirely ideal, but for better than driving 300km back and forth and seems like you "can survive some hours" downtime so if 3G crashes at example 11:30am, it is down throughout the day, evening, night and rebooted at 04:00am next morning.

But you don't have to drive there.


In case you need more flexible solution which is unfortunately more expensive, there are GSM controlled devices to cut off power so you will need SECOND SIM card there (second monthly payment) but you could CALL THE SECOND MOBILE NUMBER WHENEVER NECESSARY (OR SEND SMS) AND THAT DEVICE WILL REBOOT POWER INSTANTLY "ON REQUEST".


google "gsm rebooter"...

http://elgato.com.ua/en/smart-home-offi ... h-sms.html
http://elgato.com.ua/en/smart-home-offi ... emote.html

Re: Mikrotik 3g watchdog

Posted: Sat Dec 10, 2011 2:21 pm
by Ripper
I use before Asus WL500gpv2 with custom firmware and it works perfectly to me at our new setup we try to use MT as I see it was big mistake .

Re: Mikrotik 3g watchdog

Posted: Sat Dec 10, 2011 3:02 pm
by ghiooo
Some of my modems are failing to reconnect when the 3g network goes down. If it stays on GPRS for more than 48 hours, there is a chance to freeze and the Mikrotik will become unreacheable. I have Sierra Wireless modems and the ones connected on 3g are not failing (yet). To get back the modem i have to send over the serial terminal a reset command, wich all modems should have. In my case, first i need to connect to the channel used by the modem to receive commands:

/system serial-terminal usb2 channel=3

then i just need to type

AT!GRESET

this will return the modem back to normal. But there is no solution for scripting and i don't understand why, especially these days when mobile is cheap and everywhere. If someone from Mikrotik can find a solution, it will be great. If i was one of the developers for RouterOS i would give at least an answer explaining why not is this possible, or if it will be in the future. It's frustrating when the answer is "you can not do that", we need also the "because".

Thank You!

Re: Mikrotik 3g watchdog

Posted: Sat Dec 10, 2011 3:35 pm
by ghiooo
And i will give myself the answer, why not is possible: because we need another info-channel to be free on the modem itself. If not, then it's in use and we cannot send commands to the modem, being busy with the already ppp connection.

Re: Mikrotik 3g watchdog

Posted: Sun Dec 18, 2011 1:30 am
by Ripper
ok but why it cant reboot to fix it i do watch dog two layer script with to checks it tries to disable and re-ennable connection if it fails it router reboot command but it want work it do scripts with dyndns dynipv6 + watch dog so i don't think that it so goes to GPRS all times i check personal info at web page and it say that its in EVDO REV A mode ...

Second issue after reboot logs is cleared so i cant get any info about fails ...

I'm use UM175 modem it has only one data channel so i cant get even connection info.

Re: Mikrotik 3g watchdog

Posted: Sun Dec 18, 2011 2:05 am
by dasiu
As Normis wrote about usb power-reset:
No. Currently only SXT and Omnitik has this.
(topic: http://forum.mikrotik.com/viewtopic.php?f=3&t=57456) That's bad, that RB751 and even 433UAH don't have the feature...
I am happy to have OmniTik and I'm trying to do a reliable 3g connection :). My operator of free internet in Poland (Aero2) set max. time of connection to 1 hour. After it disconnects, and I try to connect again - I have "NO CARRIER" info from my modem. And the usb power-reset is probably the only way to make it work again :). I also observed, that I need to disable ppp interface for the time the modem associates with a base station (about 30s) - and only then it can dial the *99... I also observed, that /interface ppp-client like to crash after few such reconnections - and it looses all ppp interfaces, showing "timeout" (RouterOS v5.8 ). And then the system doesn't even respond to "/system reboot"... So the only way I found to remotely make it work (or to do it by a script) is to set watched IP address for system watchdog to an "imaginary" (surely not responding) address - and then I will have a reliable reboot.
I'm seriously thinking about doing a short MUM presentation about the experiences in making my 3g work ;).

Re: Mikrotik 3g watchdog

Posted: Sun Dec 18, 2011 2:07 am
by dasiu
Second issue after reboot logs is cleared so i cant get any info about fails ...
Set the target in "/system logging" to "disk" instead of "memory" :).

Re: Mikrotik 3g watchdog

Posted: Sun Dec 18, 2011 2:10 am
by Ripper
sure it set to disk ... but after shutdown it 100% cleared

Re: Mikrotik 3g watchdog

Posted: Sun Dec 18, 2011 3:28 am
by dasiu
sure it set to disk ... but after shutdown it 100% cleared
Sorry, I thought it would be the problem... What is your "disk-file-count" setting for the logging action? Maybe if it is set to 1 - try 2? Maybe the router starts the file "again" after reboot...

Re: Mikrotik 3g watchdog

Posted: Fri Dec 23, 2011 10:31 am
by Ripper
There ara log from routers before shutdown ...
Jan/02/2002 19:15:49 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:15:49 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:15:59 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:15:59 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:16:00 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:16:01 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:16:32 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:16:32 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:16:42 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:16:42 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:16:43 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:16:44 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:17:15 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:17:15 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:17:25 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:17:25 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:17:26 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:17:27 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:17:58 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:17:58 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:18:08 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:18:08 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:18:09 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:18:10 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:18:41 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:18:41 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:18:51 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:18:51 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:18:52 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:18:53 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:19:24 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:19:24 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:19:34 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:19:34 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:19:35 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:19:36 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:20:07 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:20:07 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:20:17 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:20:17 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:20:18 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:20:19 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:20:50 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:20:50 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:21:00 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:21:00 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:21:01 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:21:02 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:21:33 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:21:33 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:21:43 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:21:43 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:21:44 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:21:45 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:22:16 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:22:16 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:22:26 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:22:26 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:22:27 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:22:28 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:22:59 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:22:59 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:23:09 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:23:09 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:23:10 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:23:11 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:23:42 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:23:42 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:23:52 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:23:52 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:23:53 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:23:54 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:24:25 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:24:25 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:24:35 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:24:35 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:24:36 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:24:37 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:25:08 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:25:08 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:25:18 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:25:18 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:25:19 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:25:20 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:25:51 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:25:51 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:26:01 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:26:01 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:26:02 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:26:03 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:26:34 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:26:34 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:26:44 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:26:44 async,ppp,info 3g-intertelecom-1: reseting link...
Jan/02/2002 19:26:45 async,ppp,info 3g-intertelecom-1: initializing modem...
Jan/02/2002 19:26:46 async,ppp,info 3g-intertelecom-1: dialing out...
Jan/02/2002 19:27:17 async,ppp,info 3g-intertelecom-1: terminating... - modem hunged up
Jan/02/2002 19:27:17 async,ppp,info 3g-intertelecom-1: disconnected
Jan/02/2002 19:27:27 async,ppp,info 3g-intertelecom-1: initializing...
Jan/02/2002 19:27:27 async,ppp,info 3g-intertelecom-1: reseting link...
it seem that modem frezes

second part router has been turned off then on again
jan/02/2002 19:25:51 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:25:51 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:26:01 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:26:01 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:26:02 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:26:03 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:26:34 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:26:34 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:26:44 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:26:44 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:26:45 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:26:46 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:27:17 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:27:17 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:27:27 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:27:27 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:27:28 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:27:29 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:28:00 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:28:00 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:28:10 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:28:10 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:28:11 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:28:12 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:28:43 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:28:43 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:28:53 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:28:53 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:28:54 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:28:55 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:29:26 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:29:26 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:29:36 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:29:36 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:29:37 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:29:38 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:30:09 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:30:09 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:30:19 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:30:19 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:30:20 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:30:21 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:30:52 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:30:52 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:31:02 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:31:02 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:31:03 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:31:04 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:31:35 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:31:35 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:31:45 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:31:45 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:31:46 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:31:47 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:32:18 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:32:18 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:32:28 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:32:28 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:32:29 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:32:30 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:33:01 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:33:01 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:33:11 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:33:11 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:33:12 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:33:13 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:33:44 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:33:44 async,ppp 3g-intertelecom-1: disconnected 
jan/02/2002 19:33:54 async,ppp 3g-intertelecom-1: initializing... 
jan/02/2002 19:33:54 async,ppp 3g-intertelecom-1: reseting link... 
jan/02/2002 19:33:55 async,ppp 3g-intertelecom-1: initializing modem... 
jan/02/2002 19:33:56 async,ppp 3g-intertelecom-1: dialing out... 
jan/02/2002 19:34:27 async,ppp 3g-intertelecom-1: terminating... - modem hunged up 
jan/02/2002 19:34:27 async,ppp 3g-intertelecom-1: disconnected 
jan/01/2002 03:00:06 async,ppp,info 3g-intertelecom-1: initializing... 
jan/01/2002 03:00:06 async,ppp,info 3g-intertelecom-1: reseting link... 
jan/01/2002 03:00:08 async,ppp,info 3g-intertelecom-1: initializing modem... 
jan/01/2002 03:00:08 interface,info ether2-master-local link up (speed 100M, full duplex) 
jan/01/2002 03:00:09 async,ppp,info 3g-intertelecom-1: dialing out... 
jan/01/2002 03:00:09 async,ppp,info 3g-intertelecom-1: authenticated 
jan/01/2002 03:00:10 async,ppp,info 3g-intertelecom-1: connected 
jan/01/2002 03:00:10 system,info dns changed 

Re: Mikrotik 3g watchdog

Posted: Thu Dec 29, 2011 12:32 am
by Ripper
Modem works for 5 days then lost connection again and script can't wake up it....

Re: Mikrotik 3g watchdog

Posted: Thu Dec 29, 2011 2:24 am
by jandafields
Modem works for 5 days then lost connection again and script can't wake up it....
If the modem itself is hung, then no script will fix it. It needs a power cycle... not possible with the mikrotik unless you have some 3rd party device to do a power cycle.

Re: Mikrotik 3g watchdog

Posted: Tue Mar 13, 2012 4:54 pm
by Base122
Having had this same problem with my RB751U, where the 3G modem appears to have "hung" and will not respond to normal commands from the routerboard to reconnect the PPP session, I have come up with an idea to reset the modem.

Basically, the PPP connection Modem Init entry is used to send AT commands to the modem in a "blind" fashion, There is no handshake and the result of the command is not read in any way.

These reset sequences seem to be working for me with my Huawei E367 and E272 as well as a ZTE MF190.

Maybe this script will be of use in trying to solve this type of problem issue, where switching on and off of USB port power is not possible.

Parts of the script came from other scripts posted on the forum.
Thanks to those posters.

The script simply pings a known good host and if it fails, assumes the wan PPP link is down and attempts a modem reset sequence. This event is then reported to a specified Email address.

Tested on RouterOS V5.12
## Modem reset script for 3G PPP Wan links with Email reporting  ##
## based on ping reply to a known good host. ##.
## The google dns server at 8.8.8.8 is used  ##
## in this example, but you can use any known good host to ping.  ##
## take note of your wan interface name! ##
#########################################################
## Script uses PPP Modem Init to send AT command to serial port ##
## Commands are simply fired "blind" at the modem ##
## Example sends the AT+CFUN=4, AT+CFUN=6 command sequence ##
## ZTE MF-190 requires AT+CFUN=4, AT+CFUN=1 sequence or AT+ZRST ##
## Sierra Wireless:  AT!RESET ##
## ZTE:  AT+ZRST  ##
## Huawei:  AT+CFUN=4, AT+CFUN=6 sequence ##

## This script can be used with Netwatch or sheduled to run on startup ##
## after a watchdog reboot. ##
## You can adjust the delays and AT commands as needed ##
## Schedule this script at whatever checking interval you require. ##
## Remember to set up Tools - Email settings ##
## Peter James 2012-03-15 ##
## 2012-03-23 Added usb port inactive check with router reboot ##

# Set the 3G wan name #
:local WanName "wan1";

# Define the usb port for this connection #
:local usbPortName "usb1";

:log info "Starting $WanName 3G Down Check";

:local i 0;
:local result 0;

### Define the email address to receive 3G modem reset report  ###
:local emailAddressToNotify "your_email_address"

## Define host to check ###
:local testhost "8.8.8.8";

## Define number of pings to check ##
:local PingCount 10;

### Get System Identity ###
:local SystemID [/system identity get name]

## If the usb port is inactive, reboot the router to attempt to fix this ##
:if ([/port get [find name=$usbPortName] inactive]) do={

:log info "USB Port $usbPortName detected as inactive - System Rebooting";

/system reboot;

}


## Skip the ping check if the wan interface is not running ##
:if ([/interface get [find name="$WanName"] running]=true) do={

:do {

:set i ($i + 1);

:if ([/ping $testhost interface="$WanName" interval=3 count=1]=1) do={

:set result ($result+1);

}

} while=($i < $PingCount)

}

# ping has failed PingCount times or ping check was skipped #
:if ($result=0) do={

:log info "Starting $WanName 3G Modem Reset Sequence";

# get its ID number #
:local WanID [/interface ppp-client find name=$WanName];

#/interface ppp-client disable $WanID;#

# Toggle the data channel setting #
/interface ppp-client set data-channel="1" $WanID;
delay 5
/interface ppp-client set data-channel="0" $WanID;

# Send first part of reset sequence #
/interface ppp-client set modem-init="AT+CFUN=4" $WanID;
/interface ppp-client enable $WanID;
# Allow time for Init command to be sent #
delay 5;
# disable again to stop dial attempts #
/interface ppp-client disable $WanID;


# Wait for tx and rx RF circuits to switch off #
delay 5;

# Send second part of reset sequence #
/interface ppp-client set modem-init="AT+CFUN=6" $WanID;
/interface ppp-client enable $WanID;
# Allow time for Init command to be sent #
delay 5;
# disable again to stop dial attempts #
/interface ppp-client disable $WanID;

:log info "waiting for modem reset 30 seconds";
# wait for modem to reset #
delay 30;

/interface ppp-client set modem-init="" $WanID;
# Allow modem to dial again #
/interface ppp-client enable $WanID;

# Modem should now redial and connect #

:log info "waiting to send email 30 seconds";
## wait before trying to send email ##
delay 30;

# Check if interface is now running #
:if ([/interface get [find name="$WanName"] running]=true) do={

/tool e-mail send tls=yes subject="$SystemID $WanName 3G Modem Was Reset" to=$emailAddressToNotify body="$WanName 3G Modem Was Reset"

:log info "Email sent $WanName 3G Modem Was Reset"

:log info "$WanName Modem Reset Sequence Complete";

} else={

:log info "$WanName Interface Not Running - Modem Reset Sequence Failed";

}

}

:log info "$WanName 3G Down Check Complete";
*Edit: Script changed 2012-03-15
Added Check if interface is running before attempting to send email.

***Edit 2012-03-16
Some modems may take longer to reset than others, it may be necessary to adjust the "delay" values to get this script to work. Unfortunately there is no handshake with the modem and this is a crude "fire command and hope it works" approach.

***Edit 2012-03-23
What I am finding is that sometimes the RouterBoard cannot communicate with the modem, as the usb port has become inactive. This should only normally happen when the modem is unplugged.
Because it happens with the modem still plugged in, it can only be some error condition.
I have modified the script to include a usb port inactive check, which reboots the router to help recover from this problem.

Re: Mikrotik 3g watchdog

Posted: Wed Sep 05, 2012 10:22 pm
by odge
I can confirm the 3g script works great!

Thanks

Re: Mikrotik 3g watchdog

Posted: Thu Sep 06, 2012 1:38 am
by bbj
As Normis wrote about usb power-reset:
No. Currently only SXT and Omnitik has this.
(topic: http://forum.mikrotik.com/viewtopic.php?f=3&t=57456) That's bad, that RB751 and even 433UAH don't have the feature...
- and then I will have a reliable reboot.
I'm seriously thinking about doing a short MUM presentation about the experiences in making my 3g work ;).
how about a video on youtube giving all your ideas/ experiences on 3g...