Facebook   Twitter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    
Subscribe to Newsletter



Page 3 of 8 FirstFirst 123 4567 ... LastLast
Results 31 to 45 of 107

Thread: MikroTik RouterBoard and USB 3G Modems

  1. #31
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    8,950

    Default

    Quote Originally Posted by Base122 View Post
    The problem was, even though the modem reported state 4, it would not respond to AT+CFUN=6, but returned ERROR.
    Yeah, that is weird. I have never come across that before, but I'll modify MDMA to deal with that situation.

    The +CFUN=4, CFUN=6 sequence is for Huawei modems only. I'll dig through the MDMA source code and post the reset commands for other modems tonight.

  2. #32
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    Quote Originally Posted by ginggs View Post
    Yeah, that is weird. I have never come across that before, but I'll modify MDMA to deal with that situation.

    The +CFUN=4, CFUN=6 sequence is for Huawei modems only. I'll dig through the MDMA source code and post the reset commands for other modems tonight.
    Is a bit odd.
    Just checked again, and in its normal state the E272 is quite happy with the 4,6 reset sequence.
    But, whatever condition it was in this morning, even though it reported state 4, it simply would not accept AT+CFUN=6.
    Only after I forced a AT+CFUN=4, would it respond to that command.

    That only happened once and then it was "normal" again.
    That's why I figured I would just force the 4,6 sequence in my script anyway.

  3. #33
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    8,950

    Default AT commands to reset modems

    The logic in MDMA is currently as follows:

    ZTE:
    AT+ZRST

    Sierra Wireless:
    AT!RESET

    Huawei and all others:
    AT+CFUN=4
    AT+CFUN=6

    Novatel don't like AT commands, but will reset when sent the following binary sequence:
    0x29, 0x01, 0x00, 0x31, 0x40, 0x7E
    0x29, 0x02, 0x00, 0x59, 0x6A, 0x7E

  4. #34
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    AT+ZRST works fine with my ZTE MF190
    Indicator cycles from solid green, to red and then green again.


    ZTE MF190 also works with this:

    Code:
    [admin@Base122] /system> serial-terminal usb1 channel=2
    
    [Ctrl-A is the prefix key]
    
    (Indicator solid green)
    AT+CFUN=4
    OK
    
    AT+CFUN?
    +CFUN: 4
    OK
    (indicator now solid red and remains so)
    
    AT+CFUN=1
    OK
    
    AT+CFUN?
    +CFUN: 1
    OK
    (indicator solid green again)
    Modem then able to connect PPP session as normal.

    ZTE MF190 will not work with AT+CFUN=6:

    Code:
    AT
    OK
    
    AT+CFUN=4
    OK
    
    AT+CFUN?
    +CFUN: 4
    
    OK
    
    AT+CFUN=6
    ERROR
    
    AT+CFUN?
    +CFUN: 4
    
    OK
    
    AT+CFUN=1
    OK
    
    AT+CFUN?
    +CFUN: 1
    
    OK
    Last edited by Base122; 12-03-2012 at 08:46 PM.

  5. #35
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    This script can be scheduled to run at regular intervals to ping a known good host on your 3G wan link.

    If the ping fails, a 3G modem reset sequence is attempted.
    So far this seems to work fine with my ZTE MF190, Huawei E367,272

    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.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 2012-03-15:
    Script modified to add skipping of the ping check if the wan interface is not running.
    Some timings adjusted.
    Added a data channel toggle sequence to help with a problem clearing the E272 problem condition.
    Added interface running check 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.
    Last edited by Base122; 23-03-2012 at 03:38 PM. Reason: Script modified

  6. #36
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    Thanks for those modem reset commands and sequences ginggs.

    I've posted this reset script over at the MikroTik forum as well.

    Hopefully some folks will make use of it and give some feedback.

  7. #37
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    Some more scripting, this time to write the GSM modem info to a file and email this info to an email address.

    A bit tricky to get the ppp-client info and monitor commands to behave inside a script.
    Once fired, they continue to run, hence the loop counters to control this.

    I have created two scripts.
    One named pppUptime, which uses the ppp-client monitor command to get the interface Uptime.

    The other is named pppInfoUPtime, which uses ppp-client info, but starts the pppUptime script as well, to allow me to get the Uptime to add to the information file and for email.

    I hope these scripts are useful.
    I have spent many hours on this and have learned a great deal.

    Enjoy!

    pppUptimeOnly:

    Code:
    ## All this script does is set the pppUptime global variable for "wan2" in this example##
    ## This script name is pppUptime in this example ##
    ## Used in conjunction with my other pppInfo script ##
    ## Share, modify, improve and use as you wish ##
    ## Tested on RouterOS v5.12 using Huawei E367 modem #
    ## Peter James 2012-03-17 ##
    
    ## Set the PPP interface name for which Uptime value is required ##
    :local pppName "wan2";
    
    # loop counter #
    :local k 0;
    
    # Defined as global, so that other script can use #
    :global pppUptime;
    
    :local pppID [/interface ppp-client find name=$pppName];
    :log info "PPP Uptime $pppName Script Starting";
    
    
    # Start of monitor command #
    /interface ppp-client monitor $pppName do={
    
    :set k ($k+1);
    
    # run loop twice to be sure #
    :if ($k=2) do={
    
    :set pppUptime $"uptime";
    
    ## Must now stop this script, or Monitor will run forever ##
    :log info "PPP Uptime $pppName Script completed";
    /system script job remove [find script=pppUptime ];
    
    }
    }
    pppInfoUptime (starts the above pppUptimeOnly script):

    Code:
    ## Script to write PPP-info to a file and send to Email ##
    ## For this example, my PPP name is "wan2" ##
    ## and my script name is "wan2PPPinfoUptime" ##
    ## This script makes use of the ppp-client info command ##
    ## with a loop counter to stop the command once the ##
    ## information has been acquired. ##
    ## Can be used in conjunction with my other pppUptime ##
    ## script if the Uptime is required as well. ##
    ## You can use the info file to extract information for other purposes ##
    ## Remember to set up Tools-Email ##
    ## Share, modify, improve and use as you wish ##
    ## Tested on RouterOS v5.12 using Huawei E367 modem #
    ## Peter James 2012-03-17 ##
    
    # Set the PPP interface name #
    :local pppName "wan2";
    
    # Define the email address to receive PPP Info report  #
    :local emailAddress "your_email_address"
    
    :local i 0;
    
    global pppUptime;
    
    :local pppID [/interface ppp-client find name=$pppName];
    
    # Variables to hold PPP Info #
    :local String1;
    :local String2;
    :local pppInfoString;
    
    # Variable to hold PPP interface current IP address #
    :local currentIP;
    
    
    # Get System Identity #
    :local SystemID [/system identity get name];
    
    :local pppStatus;
    :if ([/interface get [find name=$pppName ] running ]=true) do={
    
    :set pppStatus "Running";
    
    ### Get the address of the specified wan interface ###
    :set currentIP [/ip address get [find interface=$pppName] address];
    :set currentIP [:pick $currentIP 0 [:find $currentIP "/"]]
    
    } else={
    :set pppStatus "Disabled";
    }
    
    # Start the pppUptime script #
    # Comment out if you do not need #
    /system script run pppUptime;
    
    :log info "PPP Info $pppName Script Starting";
    
    # Create the information File #
    /file print file="$SystemID-$pppName-PPP-info";
    
    :global SysDate [/system clock get date]
    :global SysTime [/system clock get time]
    
    
    # Start of info command #
    /interface ppp-client info $pppID do={
    
    :set i ($i+1);
    
    # for some reason this loop must run at least 3 times to set the system variables #
    # set to run 5 times to be sure #
    :if ($i=5) do={
    
    # non info command stuff #
    :set String1 "Date: $SysDate\nTime: $SysTime\nSystem ID: $SystemID\nPPP Interface: $pppName\nPPP Interface Status: $pppStatus\nIP Address: $currentIP\nUptime: $pppUptime\n";
    
    :set String2 "Modem Status: $"status"\nPin Status: $"pin-status"\nFunctionality: $"functionality"\nManufacturer: $"manufacturer"\nModel: $"model"\nRevision: $"revision"\nSerial Number: $"serial-number"\nCurrent Operator: $"current-operator"\nAccess Technology: $"access-technology"\nSignal Strength: $"signal-strengh"";
    
    :set pppInfoString "$String1$String2";
    
    :log info $pppInfoString;
    
    # Populate file with required information #
    /file set "$SystemID-$pppName-PPP-info" contents=$pppInfoString; 
    
    
    # Do all the other things you need to do here ???#
    
    # Example, send Email #
    :log info "Sending PPP Info email";
    /tool e-mail send tls=yes subject="$SystemID $pppName PPP Info" to=$emailAddress body="$pppInfoString";
    
    :log info "PPP Info $pppName Script Completed";
    
    ## Must now stop this script, or info will run forever ##
    /system script job remove [find script=wan2PPPinfoUptime ];
    
    }
    }
    Last edited by Base122; 17-03-2012 at 10:58 PM.

  8. #38
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    Been having an issue with the RB751U DNS performance for a while.
    Sometimes queries would just not resolve and my browser pages would not load.
    This was very erratic and happened on both my Cell C and 8ta wan links.
    The problem occurred more regularly on the Cell C connection for some reason.

    After some Google assisted "research" a suggestion was to adjust the "max UDP packet size" from the default 512.

    I am now using this setting:



    The problem seems to have "gone away for now"...

    The 8192k cache size is probably overkill for my needs....

  9. #39
    Master
    Join Date
    Apr 2008
    Location
    On a Chicken Farm
    Posts
    744

    Default

    I have been unable to get Vodafone K3805-Z and Vodafone K3772-Z modems to work with the RB751

    I have sent a support file to Mikrotik re for the Vodafone K3805 and waiting for them to get back to me :-/

  10. #40
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    8,950

    Default

    Quote Originally Posted by alt21 View Post
    I have been unable to get Vodafone K3805-Z and Vodafone K3772-Z modems to work with the RB751

    I have sent a support file to Mikrotik re for the Vodafone K3805 and waiting for them to get back to me :-/
    The K3805-Z has an Icera chipset and uses a different AT command set to all the other ZTE modems.
    I don't know anything about the K3772-Z.

  11. #41
    Senior Member CrispinKay's Avatar
    Join Date
    Feb 2011
    Location
    On a Galaxy Tab far, far away.
    Posts
    192

    Default

    Hey people of MyBB. Where can I buy a licence to upgrade a MikroTik board from V2 to V5?

  12. #42
    Master
    Join Date
    Apr 2008
    Location
    On a Chicken Farm
    Posts
    744

    Default

    Quote Originally Posted by ginggs View Post
    The K3805-Z has an Icera chipset and uses a different AT command set to all the other ZTE modems.
    I don't know anything about the K3772-Z.
    Does that mean it won't work or Mikrotik has to add support for it?

  13. #43
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    8,950

    Default

    Quote Originally Posted by alt21 View Post
    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.

  14. #44
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default



    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 by Base122; 23-03-2012 at 03:41 PM.

  15. #45
    Senior Member
    Join Date
    Aug 2011
    Location
    Orbiting a distant star
    Posts
    477
    Blog Entries
    1

    Default

    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!

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

    SMS Settings:


    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 by Base122; 04-04-2012 at 03:48 PM. Reason: Script modified

Page 3 of 8 FirstFirst 123 4567 ... LastLast

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •