MikroTik RouterBoard and USB 3G/HSPA/LTE Modems

ginggs

༼ つ ◕_◕ ༽つ
Super Moderator
Joined
Jun 26, 2006
Messages
12,088
RB751U-2HnD, RouterOS 5.12

Huawei E1820: working perfectly - data channel 0, info channel 3.

Vodafone K4605: detected as a USB device, but nothing appears under ports.
Code:
[admin@MikroTik] > /system resource usb print
 # DEVICE VENDOR                    NAME                                SPEED
 0 1:1                              RB400 EHCI                          480 Mbps
 1 1:3    Vodafone Group (Huawei)   Vodafone MobileBroadband (Huawei)   480 Mbps

[admin@MikroTik] > /port print
Flags: I - inactive
 #   NAME                                    CHANNELS           USED-BY                BAUD-RATE
My guess is this modem needs a usb-modeswitch to enable the ports. I have sent supout.rif to MikroTik support, hopefully it can be supported soon.
 
Last edited:

ginggs

༼ つ ◕_◕ ༽つ
Super Moderator
Joined
Jun 26, 2006
Messages
12,088
MikroTik support responded with a new version of RouterOS for me to test.

RB751U-2HnD, RouterOS 5.13RC1

Vodafone K4605: working perfectly - data channel 0, info channel 3.



USSD works too:
Code:
[admin@MikroTik] > /system serial-terminal usb1 channel=3

[Ctrl-A is the prefix key]



^MODE:5,6

^DSFLOWRPT:00000002,00000224,00000000,0000000000000448,0000000000000000,000AFC80,00501BD0

^DSFLOWRPT:00000004,000003BF,00000000,0000000000000BC7,0000000000000000,000AFC80,00501BD0

^DSFLOWRPT:00000006,000000DE,00000000,0000000000000D84,0000000000000000,000AFC80,00501BD0
AT+CUSD=1,"*111*500#",15
OK

^DSFLOWRPT:00000008,00000152,00000000,0000000000001028,0000000000000000,000AFC80,00501BD0

+CUSD: 0,"Account: R7.70.
Data Bundle: 12133.24 MB
29/2/2012 ",15

^DSFLOWRPT:0000000A,00000076,00000000,0000000000001115,0000000000000000,000AFC80,00501BD0

[Q - quit connection]      [B - send break]
[A - send Ctrl-A prefix]   [R - autoconfigure rate]



^DSFLOWRPT:0000000C,00000069,00000000,00000000000011E7,0000000000000000,000AFC80,00501BD0

Welcome back!
[admin@MikroTik] >

First redirect the terminal to the info channel of the USB modem:
Code:
/system serial-terminal usb1 channel=3
Then type in the AT command to send the USSD request:
Code:
AT+CUSD=1,"*111*500#",15
(in this case *111*500# for Vodacom's data bundle balance check)

Then disconnect from the modem's serial port by pressing Ctrl-A followed by Q.
 
Last edited:

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
For those interested in using the Cell C "White Stick" ZTE MF190 in the MikroTik RB751U...
The PPP connection Data and Info channels have to be set to 2.

attachment.php
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
My dual 3G wan, RB751 setup:

attachment.php


Even though this is a powered type hub, I have not had to plug in external power to help drive these two modems yet. What I am wondering about though is the close proximity of the one modem to the other.

I am going to do some tests to determine if the one affects the other from an RF point of view, with regard to throughput.

I'm thinking if they both happen to be operating in the same frequency band, can the transmitter of the one modem maybe "swamp" the receiver of the other, or degrade the signal somehow and affect the throughput?

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.

This is probably one for the RF gurus out there......
 

ginggs

༼ つ ◕_◕ ༽つ
Super Moderator
Joined
Jun 26, 2006
Messages
12,088
For those interested in using the Cell C "White Stick" ZTE MF190 in the MikroTik RB751U...
The PPP connection Data and Info channels have to be set to 2.
I thought they need to be different so you can check signal strength, send USSD, etc. on the info channel while your PPP connection is on the data channel.
 

ginggs

༼ つ ◕_◕ ༽つ
Super Moderator
Joined
Jun 26, 2006
Messages
12,088
I'm thinking if they both happen to be operating in the same frequency band, can the transmitter of the one modem maybe "swamp" the receiver of the other, or degrade the signal somehow and affect the throughput?
I shouldn't think so, the 2100MHz UMTS band is divided into many channels which are shared amongst the 4 network operators. Vodacom will have their own channels, MTN have their own, etc. Neighbouring base stations from the same operator will be on different channels as well.
This is probably one for the RF gurus out there......
Where's ununoctium?
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
The reason for my dual 3G wan setup, was move away from Telkom ADSL and at the same time allow for two fully redundant routes into my CCTV camera system. At the moment I have one modem on 8ta (wan1) and the other on Vodacom(wan2).

Each wan connection registers its own unique DDNS host name and I use a script to keep that updated.
I use a script for setting the default route for outbound traffic by changing the distance setting for wan1, based on whether a known host (I use the google 8.8.8.8 dns server) can be pinged or not.

I'll share these scripts later.
My scripts also include email reporting of default wan gateway changes and DDNS updates.

There is also a whole lot of NAT and Mangle settings with connection and route marking in order to ensure that whatever reply to traffic that comes in from wan1 for example, will be sent back out of the same wan gateway.

I've been running this setup for about two weeks now and it seems quite stable.

I am able to manage the RB751 remotely from the internet via both wan gateways, which is pretty useful, if one of them happens to go down for some reason.

The primary objective was to be able to connect to the CCTV system via both wan gateways simultaneously, which is working quite well.

As you can see these MikroTik units are in a rather different class to most of the other 3G routers out there in the same price class and in fact would probably outshine far more expensive options.

However, there is that learning curve.....:D
 
Last edited:

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
I thought they need to be different so you can check signal strength, send USSD, etc. on the info channel while your PPP connection is on the data channel.

For some reason, I couldn't seem to get it to work without both being on 2 for some reason.
This ZTE MF190 is a quirky little gadget. It will not work with the Tenda range of 3G routers, unless you downgrade the firmware of the Tenda router.

I'll take a look at this again after I finish some more testing with the two modems currently plugged in.
 

sajunky

Honorary Master
Joined
Nov 1, 2010
Messages
13,124
I shouldn't think so, the 2100MHz UMTS band is divided into many channels which are shared amongst the 4 network operators. Vodacom will have their own channels, MTN have their own, etc. Neighbouring base stations from the same operator will be on different channels as well.
Where's ununoctium?
Hehe...
If they use different Cell ID, they are separated by a cell frequency (usually different).
If they are logged to the same CellID, transmission time is determined by assigned code and time slot so no problem, but both modems have to share the same 5MHz channel, hehe... :)

@Base122: If you position modems to pickup different CellID, your combined bandwith can be better.
 
Last edited:

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
For some reason, I couldn't seem to get it to work without both being on 2 for some reason.
This ZTE MF190 is a quirky little gadget. It will not work with the Tenda range of 3G routers, unless you downgrade the firmware of the Tenda router.

I'll take a look at this again after I finish some more testing with the two modems currently plugged in.

attachment.php


A bit more fiddling and this works fine.
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
My dual wan 3G setup routes:

attachment.php


Script to switch default wan gateway, based on ping response:

Code:
## Dual wan default route distance switching script, 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 and comment! ##
## This script assumes wan1 0.0.0.0/0 distance initially set to 1 and  ## 
## wan2 0.0.0.0/0 distance set to 2. This script simply switches the wan1 route ##
## distance setting between 1 and 3. The router will route its outbound traffic ##
## to the lowest distance setting, unless other rules are configured. ##
## Schedule this script at whatever checking interval you require. ##
### Remember to set up Tools - Email settings ###
## Comment out the email lines if you don't need ##
## Check the MikroTik Wiki for more. ##  
## Share and tweak as you need. ##
## Peter James 2012-03-01 ##

:log info "wan1 UpOrDown Check Started";

:local i 0;
:local result 0;

### Define the email address to receive the route update result ###
:local emailAddressToNotify "your_email_address"

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

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

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


{

:do {

:set i ($i + 1);

:if ([/ping $testhost interface="wan1" interval=3 count=1]=1) do={
:set result ($result+1)
}

} while=($i < $PingCount)

# ping ok PingCount times #
:if ($result=$PingCount && [/ip route get [find comment="Wan1 Default Route"] distance]=3) do={

:log info "wan1 UP";

/ip route set [find comment="Wan1 Default Route"] distance=1;
#wait for route change before sending email
delay 2

/tool e-mail send tls=yes subject="$SystemID Default Route Changed to wan1" to=$emailAddressToNotify body="wan1 is UP. Default Route Changed to wan1"
:log info "Email wan1 UP"
} else={

# ping failed PingCount times #
:if ($result=0 && [/ip route get [find comment="Wan1 Default Route"] distance]=1) do={

:log info "wan1 DOWN";

/ip route set [find comment="Wan1 Default Route"] distance=3;
#wait for route change before sending email
delay 2

/tool e-mail send tls=yes subject="$SystemID Default Route Changed to wan2" to=$emailAddressToNotify body="wan1 is DOWN. Default Route Changed to wan2"
:log info "Email wan1 DOWN"

}
}
}

:log info "wan1 UpOrDown Check completed";
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
The following script actually goes out to the internet each time it is scheduled to run, to resolve your host name. It then compares the IP obtained with the current IP and if there is a difference, it will perform an update.

The result of this update is then emailed to the address specified.
I use gmail for this with server: smtp.gmail.com
and port set to: 587 (TLS)

Multi DDNS updater script:
Code:
### DDNS script for www.no-ip.com, www.dnsdynamic.org,www.changeip.com and dyn.com based on DIPU - Dynamic IP Updater V1.5 ###
### Thanks to the original poster ###
### Peter James 2012-03-01 ###
### Remember to set up Tools - Email settings ###


###########################################################
################## START OF DEFINITIONS ##################

### Define name of interface you want this DDNS script to update ###
:local ddnsinterface "your_wan_interface_name"

### Define DDNS credentials ###
:local userDDNS "your_DDNS_user_name"
:local passDDNS "your_DDNS_password"

### hostDDNS is the host or group name
:local hostDDNS "your_DDNS_host_name"

####################################################################################################
### Choose the DDNS provider. Do not change address, as this will determine the update url later ###
## Use this for www.no-ip.com ##
:local providerAddress "dynupdate.no-ip.com"

## or this for changeip.com
#:local providerAddress "nic.changeip.com"

## or this for www.dnsdynamic.org ##
#:local providerAddress "www.dnsdynamic.org"

## or this for dyn.com ##
#:local providerAddress "members.dyndns.org"

# simply comment out the ones you do not need above #
####################################################################################################

### Define the email address to receive the DDNS update results ###
:local emailAddressToNotify "your_email_address"

### Define name of system scheduler that will call this script ###
:local SchedName "your_scheduler_name"


################## END OF DEFINITIONS ##################
########################################################

:local ddnsURL


### Check if defined interface exists ###
:if ([:len [/interface find name=$ddnsinterface]] > 0 ) do={


:local ddnsIntStat [/interface get [find name=$ddnsinterface] disabled];
### Check if interface is disabled ###
if (!$ddnsIntStat) do={

:log info "$ddnsinterface DDNS: Starting"

### Get the address of the specified wan interface ###
:local currentIP [/ip address get [find interface=$ddnsinterface] address];
:set currentIP [:pick $currentIP 0 [:find $currentIP "/"]]
:log info "$ddnsinterface DDNS: Current gateway IP is $currentIP"

### Now build the DDNS update url based on the selected provider ###
## for www.no-ip.com ##
if ($providerAddress="dynupdate.no-ip.com") do={:set ddnsURL ("/nic/update?hostname=$hostDDNS&myip=$currentIP")}

## for www.changeip.com ##
if ($providerAddress="nic.changeip.com") do={:set ddnsURL ("/nic/update?hostname=$hostDDNS&myip=$currentIP")}

## for www.dnsdynamic.org
if ($providerAddress="www.dnsdynamic.org") do={:set ddnsURL ("/api/?hostname=$hostDDNS&myip=$currentIP")}

## for members.dyndns.org ##
if ($providerAddress="members.dyndns.org") do={:set ddnsURL ("/nic/update?hostname=$hostDDNS&myip=$currentIP")}


### Do nothing if address is empty ###
:if ($currentIP != "") do={
#

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

### get the current IP address from the internet (in case of double-nat)
#:log info "$ddnsinterface DDNS: Resolving Host $hostDDNS IP"
:local lastIP [:resolve $hostDDNS]
:log info "$ddnsinterface DDNS: Resolved Host $hostDDNS IP to $lastIP"
#

### Compare current IP with last, if changes detected perform update ###
:if ( $currentIP != $lastIP ) do={
:log info "$ddnsinterface DDNS: WAN IP change detected from $lastIP to $currentIP"
#

### Perform DDNS update ###
:log info "$ddnsinterface DDNS: DDNS built url: $ddnsURL"
:log info "$ddnsinterface DDNS: DDNS update being attempted"
/tool fetch address=$providerAddress dst-path="$ddnsinterface-DDNS.txt" src-path=$ddnsURL mode=http user=$userDDNS password=$passDDNS
:delay 2
:local ddnsOUT [/file get "$ddnsinterface-DDNS.txt" contents]
/tool e-mail send tls=yes subject="$SystemID $hostDDNS DNS update result" to=$emailAddressToNotify body="$SystemID $hostDDNS IP Address Change from $lastIP to $currentIP update result was '$ddnsOUT'"
:log info "$ddnsinterface DDNS: $SystemID $hostDDNS DDNS update result was '$ddnsOUT'"


### Note: Results do not apply to changeip.com, rather see the result in the log or email ###
:local resultString "'$ddnsOUT'"

### Email/Stop scheduler depending on the result from no-ip
:if ([find $resultString "good" -1] != "") do={
/tool e-mail send tls=yes subject="$SystemID $hostDDNS DNS hostname update successful" to=$emailAddressToNotify body="$SystemID $hostDDNS IP Address Changed from $lastIP to $currentIP DNS update result was $resultString"
} else={
:if ([find $resultString "nochg" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS IP address is current, no update performed" to=$emailAddressToNotify body="$hostDDNS IP remains $currentIP DNS update result was $resultString"
} else={
:if ([find $resultString "nohost" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error: Hostname supplied does not exist under specified account" to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
} else={
:if ([find $resultString "badauth" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error: Invalid username password combination" to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
} else={
:if ([find $resultString "badagent" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error: Client disabled. Client should exit and not perform any more updates without user intervention." to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
} else={
:if ([find $resultString "donator" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error: An update request was sent including a feature that is not available to that particular user such as offline options." to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
} else={
:if ([find $resultString "abuse" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error: Username is blocked due to abuse. Either for not following our update specifications or disabled due to violation of terms of service. Client should stop sending updates." to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
} else={
:if ([find $resultString "911" -1] != "") do={
/tool e-mail send tls=yes subject="$hostDDNS Error:A fatal error on our side such as a database outage. Retry the update no sooner 30 minutes." to=$emailAddressToNotify body="$hostDDNS Scheduler stopped, DNS update result was $resultString"
:local scheduleId [/system scheduler find $SchedName]
/system scheduler disable $scheduleId
}
}
}
}
}
}
}
}
#


###
:log info "$ddnsinterface DDNS: Update complete"
#
} else={
:log info "$ddnsinterface DDNS: No update required"
}
} 
} else={
:log info "DDNS: $ddnsinterface is disabled. Please check configuration"
}
} else={
:log info "DDNS: No interface named $ddnsinterface, Please check configuration."
}

### End of script ##
 
Last edited:

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
Dual wan Mangle setup:
attachment.php


Code:
/ip firewall mangle
add action=mark-connection chain=input comment=\
    "in wan1,out wan1 Connection Mark" in-interface=wan1 new-connection-mark=\
    wan1_conn
add action=mark-connection chain=input comment=\
    "in wan2,out wan2 Connection Mark" in-interface=wan2 new-connection-mark=\
    wan2_conn
add action=mark-routing chain=output comment="in wan1,out wan1 Routing Mark" \
    connection-mark=wan1_conn new-routing-mark=wan1_traffic passthrough=no
add action=mark-routing chain=output comment="in wan2,out wan2 Routing Mark" \
    connection-mark=wan2_conn new-routing-mark=wan2_traffic passthrough=no
add action=mark-connection chain=forward comment=\
    "pfw wan1, out wan1 Connection Mark" connection-state=new in-interface=\
    wan1 new-connection-mark=wan1_pfw passthrough=no
add action=mark-connection chain=forward comment=\
    "pfw wan2, out wan2 Connection Mark" connection-state=new in-interface=\
    wan2 new-connection-mark=wan2_pfw passthrough=no
add action=mark-routing chain=prerouting comment=\
    "pfw wan1, out wan1 Routing Mark" connection-mark=wan1_pfw in-interface=\
    bridge-local new-routing-mark=wan1_traffic passthrough=no
add action=mark-routing chain=prerouting comment=\
    "pfw wan2, out wan2 Routing Mark" connection-mark=wan2_pfw in-interface=\
    bridge-local new-routing-mark=wan2_traffic passthrough=no
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
Dual wan NAT example:
attachment.php


Port 80 NAT example:
(Note that NAT has to be done for both wan in-interfaces)

Code:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=wan1
add action=masquerade chain=srcnat out-interface=wan2
add action=dst-nat chain=dstnat comment="Forward port 80 to DVR" dst-port=80 \
    in-interface=wan1 protocol=tcp to-addresses=192.168.1.63 to-ports=80
add action=dst-nat chain=dstnat comment="Forward port 80 to DVR" dst-port=80 \
    in-interface=wan2 protocol=tcp to-addresses=192.168.1.63 to-ports=80
 

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
Bit of an odd error from a Huawei E272, on a RB751U single wan gateway setup.

Indicator flashing green twice, every 3 seconds or so.

attachment.php


Problem went away after unplugging the modem and plugging it in again.

Interesting to see the "tx and rx RF circuits disabl" message in the Functionality box of the left screen.
Wonder what could have caused this?
 
Last edited:

Base122

Well-Known Member
Joined
Aug 2, 2011
Messages
477
Dual 3G wan USB issue:

For those who may try this type of setup, I have not been able to mix a USB2.0 (ZTE MF190) and USB1.1(Huawei E220) modem together on the RB751U (v5.12)

The RB751U works ok with the USB2.0 modem, but will not communicate with the serial port of the USB1.1 modem, even from the terminal.

attachment.php


It is quite happy with two USB2.0 modems:

attachment.php


However, it also works ok with a single USB1.1 modem only, but then not with two USB1.1 modems together.

I did try different modems and three different USB Hubs.

I'd recommend sticking with two USB2.0 modems if you decide to try this setup.
Will try newer RB751U firmware (v5.14) later to see if that makes any difference.
 
Top