MikroTik RouterBoard and USB 3G/HSPA/LTE Modems

Does that mean it won't work or Mikrotik has to add support for it?
It means it is going to take Mikrotik longer to add support for it than it did for the Huawei E372/Vodafone K4605 mentioned at the beginning of this thread.
 
attachment.php


Had this happen earlier this morning with the ZTE-MF190 on wan1.

Modem showed registered on network, but would not dial and connect PPP.
Found that the modem had mysteriously disappeared from the list of usb devices and the port usb1 (wan1) is seen as inactive (I) by the router.

Under this condition, the router cannot communicate with an inactive port and modem that suddenly does not "exist". So no PPP session can be established.

The burning question is, why does this happen all of a sudden out of the blue?
Result of some state the modem got into?

Script to the rescue again. This time, the script checks to see if the usb port is inactive and reboots the router. This seems to solve the problem as the modem is found again, the usb port becomes active and the PPP session is able to connect.

The usb port should not be inactive when the modem is plugged in, so this must be some error condition. The port Inactive state can be seen by intentionally unplugging the modem and checking the port status.

This script can be scheduled to check at regular intervals or combined with an existing script, which I will probably do later and update accordingly. Take care if you do use this on a dual 3G wan setup, as unplugging one of the modems will result in a router reboot from this script when its runs.
(assuming you are still checking that specific modems usb port inactive status)

Code:
# Modem serial port is usb1 in this example #

:local usbPortName "usb1"

:log info "Starting USB port $usbPortName Inactive Check";

:if ([/port get [find name=$usbPortName] inactive]) do={

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

/system reboot;

} else={

:log info "USB Port $usbPortName is Active";

}
 
:log info "USB port $usbPortName Inactive Check complete";

***Edit:
Previously posted 3G modem reset script updated to include this usb port inactive check with router reboot.
 
Last edited:
Here is a script for forwarding an SMS received by the GSM modem plugged into the RB751U, to an Email address.

This is useful for those warning SMS's from your service provider, that you are about to run out of data or generally have an encounter with the OOB shark! :D

The script can be scheduled to run at whatever interval you need.

SMS Settings:
attachment.php


Code:
# Script to forward SMS from GSM Modem Inbox to Email #
# Note: The SMS is removed from the inbox after being sent to Email, #
# even if the Email fails to be sent #
# Remember to set up /Tools/SMS with the USB port of your #
# Modem and the info channel. Put anything in secret and #
# make sure Receive Enabled is ticked #
# Tested on Rb751U RouterOS v5.12 with Huawei E367 #
# Peter James 2012-04-04 #


:local EmailAddress "your_email_address";
:local smsPhone;
:local smsTimeStamp;
:local smsMessage;
:local smsContent;

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

:log info "SMS to Email script started";

# Set Receive Enabled, in case it was cleared by a router reboot #
/tool sms set receive-enabled=yes;

delay 2;

# loop through all the messages in the inbox #
:foreach i in=[/tool sms inbox find] do={

:set smsPhone [/tool sms inbox get $i phone];
:set smsTimeStamp [/tool sms inbox get $i timestamp];
:set smsMessage [/tool sms inbox get $i message];

:set smsContent "Router ID: $SystemID\nSMS Received from: $smsPhone\nDate&Time: $smsTimeStamp\nMessage: $smsMessage";

:log info $smsContent;

/tool e-mail send tls=yes subject="$SystemID GSM Modem SMS Received" to=$EmailAddress body="$smsContent";

# Now remove the SMS from the inbox #
/tool sms inbox remove $i;

delay 10;

}

# clear Receive Enabled, so info channel can be used by other scripts #
/tool sms set receive-enabled=no;

:log info "SMS to Email script complete";

***Edit:
Small problem.
SMS Receive Enabled is cleared after a reboot for some reason.
I have added a line into the script to enable it each time the script runs to fix this.

***Edit 2012-04-04:
Another small issue here.
The modem info channel is used by the SMS tool as well as the Info tool.
Both cannot use the info channel at the same time. If the SMS tool Receive-Enabled is left set, my previously posted PPPInfo script is blocked from getting the required modem info.

I have added a line to clear the Receive-Enabled at the end of this script, so that other scripts making use of the info channel can work correctly.

Just a word of advice....
If you are using this SMS to email script and the pppInfoUptime script, make sure the two are not scheduled to run at the same time as there will be a conflict for use of the modem info channel.
 
Last edited:
Was looking at a way of scripting USSD commands from the MikroTik RB751U for checking the data balance via the plugged in modem and then emailing that on a scheduled basis. The serial terminal method is not practical in this case.

Doesn't seem possible to send AT commands to the modem with a script unfortunately and the other crude method of using the modem initialization string to do this might work, but the problem would be to read the USSD balance request response.

Refer: http://forum.mikrotik.com/viewtopic.php?t=52136&p=287273
 
.....Just because..... the triple 3G wan... :D

attachment.php


attachment.php


...and then I ran out of USB 2.0 modems...or else quad wan.... :whistle:

Odd that the E173 does not show its connect speed for some reason.
But this setup definitely works.
CCTV system accessible via three different host names.
 
Last edited:
attachment.php


Pity that MikroTik did not include this feature on the RB751u.
Would have helped a whole lot to solve some of these random router-modem serial communication lock-ups.

Had a situation where the router-modem data channel serial communications stopped for some reason and not even a router reboot could fix it. Seems like the modem data channel has locked up on the modem itself. Serial communications on the info channel was still working fortunately and I could issue a manual AT+CFUN=4, AT+CFUN=6 modem reset sequence with the serial terminal.

Busy working on a solution which would automatically be able to force a modem reset sequence over both the data and info channels, in case one or the other had locked up.
 
Last edited:
Busy working on a solution which would automatically be able to force a modem reset sequence over both the data and info channels, in case one or the other had locked up.

My solution to this modem data channel serial communications problem, is to disable the problem wan interface, then create two temporary wan interfaces for the same modem usb port, with temp interface1 data channel, set to the modem normal data channel and temp interface2 data channel, set to the modem info channel.

I then use the modem Init strings to once again force the AT reset sequences over both the modem data and info channels, using these two temporary interfaces, with a delay between each operation.

Effectively, this is kind of a double reset that is sent to the modem, in the hope that one of the two will at least be able to reset the modem and recover from this locked up state.

The temporary interfaces are then removed once the full reset operation is complete and the normal wan interface is enabled again allowing it to dial and connect.

I initially tried manipulating the existing wan interface data channel and Init settings, but during this locked up data channel condition, the router had problems trying to change parameters and gave many timeouts, simply refusing to do as commanded. It refused to even enable or disable the wan interface at one point.

The two temporary interfaces were a way around this. This seems a bit of a complex approach, but in the absence of a USB power reset option, this appears to resolve the problem. Hopefully this is the last I will see of this annoying problem condition, which was not restricted to any particular modem or network operator.

The three script approach was necessary, to prevent a possible problem with either the data or info channel reset sequence from "hanging" the whole process. This could happen if either the modem data or info serial channels are in an unresponsive state for some reason.

Just busy with some final testing and tweaking on the scripts and will post them here once satisfied.
 
Last edited:
Scripts as per previous post:

Script1: Wan1 Down Modem Reset (Scheduled)
- Checks wan USB port inactive and reboots router if needed.
- Pings a known good host and starts scripts 2 and 3 if no reply.
Code:
########################################################
## 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.4.4 is used  ##
## in this example, but you can use any known good host to ping.  ##
## take note of your wan interface name! ##
#
### NB NB!! This script runs two other scripts which perform the ###
### actual modem reset sequences: ###
### "Wan1 Modem Reset DataChan" ###
### "Wan1 Modem Reset InfoChan" ###
#
## Schedule this script at whatever checking interval you require. ##
## Remember to set up Tools - Email settings ##
## Peter James 2012-04-20 ##
########################################################

# Delay for first time run after boot #
:delay 15;

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

# get the usb port for this interface #
:local usbPortName [/interface ppp-client get [/interface ppp-client find name=$WanName] port];

: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_here"

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

## 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 ##
#:log info "Checking USB Port: $usbPortName Status";#
: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];

# Disable the interface to stop dial attempts #
/interface ppp-client disable $WanID;

# Run the reset scripts #
execute "/system script run \"Wan1 Modem Reset DataChan\"";
execute "/system script run \"Wan1 Modem Reset InfoChan\"";


# Wait for all reset sequences to complete #
delay 60;

# Enable the interface once 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";

Script2: Wan1 Modem Reset DataChan (Started by Script1)
(This script can also be called independently at any time to issue a modem reset over the data channel)
Code:
# Reset the PPP Interface 3G Modem using Data Channel #

###################################################################
## 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 ##
### Peter James 2012-04-20 ###
###################################################################

:local pppName "wan1";
:log info "$pppName Modem Data Channel Reset Started";

delay 20;

:local ModemPort [/interface ppp-client get [/interface ppp-client find name=$pppName] port];
:local DataChan [/interface ppp-client get [/interface ppp-client find name=$pppName] data-channel];


:if ([:len [/interface find name="ResetData1"]] = 0 ) do={

:log info "creating temporary reset ppp interface DataChan";
# Create temporary ppp interface for the specified USB port # 
/interface ppp-client add add-default-route=no comment="ResetData1" dial-on-demand=no disabled=yes data-channel=$DataChan name=ResetData1 port=$ModemPort; 

}


# Set Interface ID number #
:local ResetData1id [/interface ppp-client find name="ResetData1"];

## Send modem reset sequence ##

# Send first part of reset sequence #
/interface ppp-client set modem-init="AT+CFUN=4" $ResetData1id;
#/interface ppp-client set modem-init="AT+ZRST" $ResetData1id;#


/interface ppp-client enable $ResetData1id;
# Allow time for Init command to be sent #
delay 5;
# disable again to stop any possible dial attempts #
/interface ppp-client disable $ResetData1id;

# 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" $ResetData1id;
/interface ppp-client enable $ResetData1id;

delay 5;

/interface ppp-client set modem-init="" $ResetData1id;
/interface ppp-client disable $ResetData1id;

delay 2;
# Remove temporary interface #
/interface ppp-client remove $ResetData1id;

:log info "$pppName Modem Data Channel Reset Completed";

Script3: Wan1 Modem Reset InfoChan (Started by Script1)
(This script can also be called independently at any time to issue a modem reset over the info channel)
Code:
# Reset the PPP Interface 3G Modem using Info Channel #

###################################################################
## 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 ##
## Peter James 2012-04-20 ##
###################################################################

:local pppName "wan1";
:log info "$pppName Modem Info Channel Reset Started";

#delay 20;#

:local ModemPort [/interface ppp-client get [/interface ppp-client find name=$pppName] port];
:local InfoChan [/interface ppp-client get [/interface ppp-client find name=$pppName] info-channel];

:if ([:len [/interface find name="ResetInfo1"]] = 0 ) do={

:log info "creating temporary reset ppp interface InfoChan";
# Create temporary ppp interface for the specified USB port # 
/interface ppp-client add add-default-route=no comment="ResetInfo1" dial-on-demand=no disabled=yes data-channel=$InfoChan name=ResetInfo1 port=$ModemPort;

}

# Set Interface ID number #
:local ResetInfo1id [/interface ppp-client find name="ResetInfo1"];

## Send modem reset sequence ##

# Send first part of reset sequence #
/interface ppp-client set modem-init="AT+CFUN=4" $ResetInfo1id;
#/interface ppp-client set modem-init="AT+ZRST" $ResetInfo1id;#

/interface ppp-client enable $ResetInfo1id;
# Allow time for Init command to be sent #
delay 5;
# disable again to stop any possible dial attempts #
/interface ppp-client disable $ResetInfo1id;

# 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" $ResetInfo1id;
/interface ppp-client enable $ResetInfo1id;

delay 5;

/interface ppp-client set modem-init="" $ResetInfo1id;
/interface ppp-client disable $ResetInfo1id;

delay 2;
# Remove temporary interface #
/interface ppp-client remove $ResetInfo1id;


:log info "$pppName Modem Info Channel Reset Completed";
 
Last edited:
RouterOS v5.15 was released on April 20.
From the change log:
*) added support for usb forwarding over tcp;

I haven't been able to find any details about this feature, but it sounds intriguing.
 
Isn't it a similar feature to some ASUS routers? USB port on the router appears on remote PC like a local port.

Edit: Not sure Asus, but found a relevant note about AVM FRITZ!Box Fon 7390 (long name and v. expensive).

Also look here: http://www.incentivespro.com/crossplatform-solution.html
 
Last edited:
RouterOS v5.15 was released on April 20.
From the change log:

*) added support for usb forwarding over tcp;

I haven't been able to find any details about this feature, but it sounds intriguing.

Not so after all..... V6.x only. ;)

NAB, jandafields, you can attach USB device to RouterBOARD USB port and operate it by Windows computer.
However, this option is added to v6.x only, changelog entry was added by mistake, this option applies for v6.x

http://forum.mikrotik.com/viewtopic.php?f=2&t=61279#p313396
 
Last edited:
Just a note regarding RouterOS on the RB751U:

I had endless trouble with the RB751U not wanting to boot up properly on V5.13 and V5.14 with my configuration.

I pretty much stuck to V5.12 because of this.

This erratic RB751U boot failure issue has come up in a few threads on the MikroTik forum.
Seems that MikroTik have identified it as some compatibility issue with RouterOS and the RB751U.

This seems to now have been resolved in V5.15

I have tried this on two of my RB751U's and done many reboots now without any trouble so far.

I would recommend skipping V5.13 and V5.14 on the RB751U due to this issue.
 
Discovered a strange power issue with the RB751U and the powered USB hub in this setup:

attachment.php


I pulled the RB751U +12V power plug and was quite surprised to see the green lights on the router remain on, but dimmer than usual and then start flickering. Took a while to work out that the router was still being powered by the USB hub +5V power via the router USB connector. The router did not function correctly under this condition, as it would not respond to ping or winbox.

Now this cannot be a good thing, as +5V is below the minimum RB751U voltage range specification of 8-30V. Fortunately no harm was done to the router and it worked fine after plugging in the normal +12V power again.

Seems odd that MikroTik did not at least put in a protection diode on the router USB port, to prevent external +5V power from entering the unit. There doesn't seem to be any practical reason for having allowed this. I'm sure the intention was never to allow the router to be powered by +5V on its USB port.

I suppose this voltage could occur on a battery powered site anyway, where the battery charger has failed and the battery has run near flat. Hopefully such an installation would have a load disconnect mechanism at a certain minimum voltage anyway to prevent any equipment damage due to under voltage.

Just something to be aware of.
 
Last edited:
It is not router's fault, but USB hub. Hub should not allow internal voltage to appear on upstream port. I have a cheapo hub, it does similar things. I discovered when PC refused to boot if hub was powered and connected to USB port. A good hub has a MOSFET on each output port controlled by voltage comparator. In my hub power supply voltage +5V is wired to all ports, including upstream port. The same will be in your hub.

Blocking by diodes is not a good solution, due to the voltage drop on diodes and losing stabilisation parameters.
 
Last edited:
Then again there is probably a proximity question between a modem possibly on 2100mhz and the router's own built-in radio on 2400mhz, applicable to most 3G routers.

You could lose receiver sensitivity due to PIM (passive intermodulation). Dirty interconnects, dissimilar metals, etc could behave in a non-linear fashion acting as a mixer causing spurious signals out of band. Usually not a problem if you’re not trying to receive weak signals, but PIM is e.g. a big problem in satellite receiver applications.
 
RouterOS v5.16 was released a short while back.

I have upgraded all my MikroTik RB751U's and they seem quite stable on this version with my particular configuration.
 
Top
Sign up to the MyBroadband newsletter
X