Because of this thread I decided to get a Mikrotik RB951G-2hnD router. I was having hassles with my TP-Link 3420 losing connection with the 3G 8ta network and then decided to try the Mikrotik. There is another thread I started dealing with the setup issues I experienced with the 951. I am going to ask the mods to merge that thread into this one for convenience. After setting up the router I experienced a similar issue with the Mikrotik. I suspect it is due to the way that the networks drop the connection to the modem that causes the modem to go into an unresponsive state. All that would help is a reboot or removing and re-inserting the modem. Base122 then drew my attention to the fact that with RouterOS 6 there is a function on the 951 to reset the power of the USB port under the menu items "System - Routerboard".
I decided to upgrade to V6 and did the upgrade. The upgrade somehow failed and I had to go through quite an exercise to get it going again. More of which (and the lessons learnt later). After getting the router operative again Base122 wrote the following script for me. I have tried it and it works like a charm. For those who do not know how to do this (like me) I am also going to include the instructions provided with his blessing.
In winbox,
Go to System-Scripts.
Click on + to add new script.
Give it a name. (Remember for scheduler for later)
Paste the contents below into the source window.
Click apply and then the "Run script" button to test.
(You can open the log window to see what is happening)
To test the actual USB Power Reset, change the test host to an IP that won't respond to a ping. This time the script should drop the modem power and reset.
Code:
## Modem reset script for 3G PPP Wan link using USB Power Reset ##
## based on ping reply to a known good host. ##.
## Take note of your wan interface name! ##
## Only works on hardware supporting USB Power Reset feature ##
## Schedule this script at whatever checking interval you require. ##
# Set the 3G PPP wan name #
:local WanName "ppp-out1";
:log info "Starting $WanName 3G Down Check";
:local i 0;
:local result 0;
## Set host to check ###
:local testhost "196.25.1.200";
## Define number of pings to check ##
:local PingCount 10;
## Skip the ping check if the wan interface is not running ##
:if ([/interface get [find name="$WanName"] running]=true) do={
:log info "Checking Host $testhost";
: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 "Host check Failed - Starting $WanName 3G Modem Reset Sequence";
# get its ID number #
:local WanID [/interface ppp-client find name=$WanName];
# Disable the interface to stop dial attempts #
/interface ppp-client disable $WanID;
:log info "Resetting USB Port Power";
/system routerboard usb power-reset duration=5s
# Wait for modem to connect to network again#
delay 30;
# Enable the interface once again #
/interface ppp-client enable $WanID;
# Modem should now redial and connect #
delay 10;
# Check if interface is now running #
:if ([/interface get [find name="$WanName"] running]=true) do={
: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";
To schedule the script at regular intervals:
Go to system-Scheduler
Click on + to add new schedule
Give it a name.
Set Start Time to startup
Set interval to 00:03:00 for every 3mins for example.
Put your script name in the On event box.
I did this exactly and it works like an absolute charm. I set the intervals to 10 minutes as this is probably more than adequate for me. Thank you to Base122 for all your help. It is guys like you that make this forum great!
