# jan/17/2019 00:06:14 by RouterOS 6.44beta54
#
# model = RBSXTR
set [ find ] mac-address=AC:FF:FF:00:00:00 name=lte1 network-mode=lte
/interface bridge
add admin-mac=B8:69:F4:05:D6:15 auto-mac=no comment=defconf name=bridge
/interface ethernet
set [ find default-name=ether2 ] advertise=\
10M-half,10M-full,100M-half,100M-full,1000M-half,1000M-full
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface lte apn
add apn=jionet ip-type=ipv4-ipv6 ipv6-interface=lte1 name="Jio 4G"
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=flash/hotspot
/ip pool
add name=dhcp ranges=192.168.86.100-192.168.86.254
/ip dhcp-server
add add-arp=yes address-pool=dhcp bootp-support=dynamic disabled=no \
interface=bridge name=defconf
/queue type
add kind=pcq name=PCQ_download pcq-burst-rate=1200k pcq-burst-threshold=650k \
pcq-classifier=dst-address pcq-limit=100KiB pcq-rate=700k \
pcq-total-limit=4000KiB
add kind=pcq name=PCQ_upload pcq-burst-rate=1200k pcq-burst-threshold=650k \
pcq-classifier=src-address pcq-limit=100KiB pcq-rate=700k \
pcq-total-limit=4000KiB
add kind=pcq name=PCQ_upOLD1500kb pcq-classifier=src-address pcq-limit=384KiB \
pcq-rate=1500k pcq-total-limit=4000KiB
add kind=pcq name=PCQ_downOLD1500kb pcq-classifier=dst-address pcq-limit=\
384KiB pcq-rate=1500k pcq-total-limit=6000KiB
/queue simple
add max-limit=4M/4M name=PCQ-Queue queue=PCQ_download/PCQ_upload target=\
192.168.86.0/24
/interface bridge port
add bridge=bridge comment=defconf interface=ether1
add bridge=bridge comment=defconf interface=ether2
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface detect-internet
set detect-interface-list=all
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=lte1 list=WAN
/ip accounting web-access
set address=192.168.84.210/32
/ip address
add address=192.168.86.1/24 comment=defconf interface=ether1 network=\
192.168.86.0
/ip cloud
set ddns-enabled=yes
/ip dhcp-server alert
add disabled=no interface=ether1 valid-server=B8:69:F4:05:D6:15
/ip dhcp-server network
add address=192.168.86.0/24 comment=defconf dns-server=192.168.86.1,1.1.1.1 \
gateway=192.168.86.1 netmask=24
/ip dns
set allow-remote-requests=yes servers=9.9.9.9,8.8.8.8
/ip dns static
add address=192.168.86.1 name=router.lan
/ip firewall filter
add action=accept chain=input comment="Accept Winbox" disabled=yes dst-port=\
8291 in-interface=lte1 protocol=tcp
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=drop chain=input comment="defconf: drop all not coming from LAN" \
in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related disabled=yes
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" \
connection-state=invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface-list=WAN
/ip firewall mangle
add action=change-ttl chain=postrouting disabled=yes new-ttl=set:64 \
out-interface=!all-ethernet passthrough=yes
add action=change-ttl chain=postrouting new-ttl=set:64 out-interface=lte1 \
passthrough=yes
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
/ip ssh
set strong-crypto=yes
/system clock
set time-zone-name=Asia/Kolkata
/system identity
set name="SXT LTE"
/system leds
# using RSRP, modem-signal-treshold ignored
set 0 interface=lte1
/system logging
add topics=lte,!raw,!info,!async
add action=disk topics=critical
add action=disk topics=error
add action=disk topics=warning
/system package update
set channel=testing
/system scheduler
add comment="StartUp with SIM B - Lower Slot" name="Start with SIM2B" \
on-event=StartUpSimB policy=reboot,read,write,policy,test,romon \
start-time=startup
add comment="Switch SIM 2 B LowerSlot at 12.30am" disabled=yes interval=1d \
name=SwitchSIM2B-LowerSlot on-event=SwitchSIM2-B-Script policy=\
reboot,read,write,policy,test,romon start-date=nov/12/2018 start-time=\
00:30:00
add comment="Switch to SIMA by Schedule at 16:30" interval=1d name=\
Switch2SIMA on-event=Switch2SIMA policy=reboot,read,write,policy,test \
start-date=dec/28/2018 start-time=16:30:00
add comment="Reboot at 12.30am" interval=1d name=Reboot on-event=Reboot \
policy=ftp,reboot,read,write,test,romon start-date=nov/12/2018 \
start-time=00:30:00
add interval=1d name="Reset Modem" on-event="Reset Modem" policy=\
reboot,read,write,test,romon start-date=jan/14/2019 start-time=12:00:00
/system script
add comment="NetWatch if SIM is down Switch to Other SIM" \
dont-require-permissions=yes name=NetWatchSwitch2OtherSIMSlot owner=Bucky \
policy=reboot,read,write,policy,test,romon source="#Needs dont-require-per\
missions=yes since otherwise it iinherits lower permissions from NetWatch\
\r\
\n:global NWTries\r\
\n:global Startup\r\
\n:global ProvSIMA\r\
\n:global ProvSIMB\r\
\n:if (\$Startup=\"Finished\") do={\r\
\n# Script checks first which SIM Slot is active, then\r\
\n# switches from active to inactive SIM Slot\r\
\n# Then log descriptive warning\r\
\n:global simSlot [/system routerboard sim get sim-slot]\r\
\n# Check which SIM slot is used\r\
\n:set \$NWTries (\$NWTries+1)\r\
\n:log warning message=\"NETWATCH CANNOT PING 9999 ON SIM \$simSlot RUN N\
R. \$NWTries\"\r\
\n:local time [/system clock get time];\r\
\n{\r\
\nif (\$NWTries < 4) do={\r\
\n:if (\$simSlot=\"a\") do={\r\
\n# If \"a\" UpperSlot, switch to \"b\"\r\
\n/system routerboard sim set sim-slot=b\r\
\n:log warning \"SWITCHED TO SIM B - \$ProvSIMB BY SCRIPT AT \$time\"\r\
\n} else={\r\
\n# If \"b\" LowerSlot, switch to \"a\" UpperSlot\r\
\n/system routerboard sim set sim-slot=a\r\
\n:log warning \"SWITCHED TO SIM A - \$ProvSIMA BY NETWATCH SCRIPT at \$ti\
me\"\r\
\n}\r\
\n} else={:log warning \"NETWATCH LOOP >3x - MODEM RESET SIM \$simSlot - N\
O SWITCH!!!\";\r\
\n/interface lte at-chat lte1 input=\"AT+reset\"\r\
\n}\r\
\n}\r\
\n}"
add dont-require-permissions=yes name=BackupCfg owner=Bucky policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="/\
system backup save\r\
\n/export compact file=([/system identity get value-name=name].\"-backup-c\
mp-prv.rsc\")\r\
\n/export verbose file=([/system identity get value-name=name].\"-backup-v\
rb-prv.rsc\")\r\
\n/export compact hide-sensitive file=([/system identity get value-name=na\
me].\"-backup-cmp-pub.rsc\")\r\
\n/export verbose hide-sensitive file=([/system identity get value-name=na\
me].\"-backup-vrb-pub.rsc\")\r\
\n\r\
\n\r\
\n"
add comment="Switch to Other SIM" dont-require-permissions=yes name=\
Switch2OtherSIM owner=Bucky policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Script checks first which SIM Slot is active, then\r\
\n# switches from active to inactive SIM Slot\r\
\n# Then log descriptive warning\r\
\n:global simSlot [/system routerboard sim get sim-slot]\r\
\n:local time [/system clock get time];\r\
\n# Check which SIM slot is used\r\
\n{\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch disable \$i }\
;\r\
\n:if (\$simSlot=\"a\") do={\r\
\n# If \"a\" UpperSlot, switch to \"b\" LowerSlot\r\
\n/system routerboard sim set sim-slot=b\r\
\n:log warning \"SWITCHED TO SIM B - \$ProvSIMB BY SCRIPT at \$time\";\r\
\n:delay 90s;\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch enable \$i };\
\r\
\n} else={\r\
\n# If \"b\" LowerSlot, switch to \"a\" UpperSlot\r\
\n/system routerboard sim set sim-slot=a\r\
\n:log warning \"SWITCHED TO SIM A - \$ProvSIMA BY SCRIPT at :\$time\";\r\
\n:delay 90s;\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch enable \$i };\
\r\
\n}\r\
\n}\r\
\n"
add comment="Reboot at 00:30" dont-require-permissions=no name=Reboot owner=\
Bucky policy=reboot,read,write,romon source=":local datum [/system clock g\
et date];\r\
\n:local time [/system clock get time];\r\
\n:log warning message=\"REBOOT BY REBOOT SCRIPT ON \$datum AT \$time\";\r\
\n/system reboot;"
add comment="Send/Receive USSD codes for Data Balance on Airtel" \
dont-require-permissions=no name=AirtelBalance owner=Bucky policy=read \
source="# Run this script in Terminal like this (copy/paste next line with\
out #:\r\
\n# /system script run AirtelBalance\r\
\n# Copy text from last +CUSD: 1,\" results without quotes to:\r\
\n# http://www.unit-conversion.info/texttools/hexadecimal/#data\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch disable \$i }\
;\r\
\n/interface lte at-chat lte1 input=\"AT+CUSD=1,\\\"*121*2#\\\",15\"\r\
\n:put \"Waiting 15 Seconds... \"\r\
\n:delay 15s\r\
\n/log print where message~\"CUSD:\"\r\
\n:put \"INSTRUCTIONS: Copy text after last entry: +CUSD: 1,\" \r\
\n:put \"Then paste the text inside the quotes to: \"\r\
\n:put \"http://www.unit-conversion.info/texttools/hexadecimal/#data\"\r\
\n:put \"The number after Data: is still available, f.e. Data:266.5MB\"\r\
\n:put \"No Data line shown means no Data left.\"\r\
\n:delay 65s\r\
\n:execute {:foreach i in= [ /tool netwatch find ] do={ :tool netwatch ena\
ble \$i };}"
add comment="MUST run in New Terminal: /sys scr run IdeaData" \
dont-require-permissions=no name=IdeaData owner=Bucky policy=read source="\
#Disabling Netwatch so it won't disturb\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch disable \$i }\
;\r\
\n# Clearing SMS Inbox\r\
\n/tool sms inbox remove [/tool sms inbox find]\r\
\n# Sending USSD code *191*1#\r\
\n/interface lte at-chat lte1 input=\"AT+CUSD=1,\\\"*191*1#\\\",15\"\r\
\n:put \"Waiting 70 Sec for 3 SMS to arrive...\"\r\
\n:delay 70s\r\
\n/tool sms inbox print without-paging\r\
\n:put \"INSTRUCTIONS: Idea has several data packages on the same SIM - Da\
ta numbers after \\\"Bal:\\\" for all must be added up!\";\r\
\n#Resetting to lte and then back to 3g,lte to connect as LTE again\r\
\n/interface lte set lte1 network-mode=lte\r\
\n:delay 15s\r\
\n/interface lte set lte1 network-mode=3g,lte\r\
\n:delay 20s\r\
\n#Reenabling Netwatch\r\
\n:execute {:foreach i in= [ /tool netwatch find ] do={ :tool netwatch ena\
ble \$i };}\r\
\n"
add comment="Startup Script" dont-require-permissions=no name=StartUpSimB \
owner=Bucky policy=reboot,read,write,policy,test source=":global ProvSIMA \
Jio\r\
\n:global ProvSIMB Airtel\r\
\n:global Startup 0\r\
\n# Script checks first which SIM Slot is active, if it is\r\
\n# \"a\" UpperSlot it will switch to \"b\" LowerSlot\r\
\n# Then log descriptive warning\r\
\n#At the end it will force time update and show corrected time\r\
\n:global simSlot [/system routerboard sim get sim-slot]\r\
\n:local datum [/system clock get date];\r\
\n:local time [/system clock get time];\r\
\n:log warning \"RUNNING STARTUP SCRIPT - ACTIVE SIM \$simSlot at \$time \
\$datum\"\r\
\n# Check which SIM slot is used\r\
\n:if (\$simSlot=\"a\") do={\r\
\n# If \"a\" UpperSlot, switch to \"b\" LowerSlot\r\
\n/system routerboard sim set sim-slot=b\r\
\n:global simSlot [/system routerboard sim get sim-slot]\r\
\n:local BOOTtime [/system clock get time];\r\
\n:local BOOTdatum [/system clock get date]\r\
\n:delay 70s\r\
\n/ip cloud force-update\r\
\n:delay 5s\r\
\n:global Startup Finished\r\
\n:local time [/system clock get time];\r\
\n:local datum [/system clock get date];\r\
\n:global TimeUpdate (\$BOOTtime.\" > \".\$time)\r\
\n:global DateUpdate (\$BOOTdatum.\">\".\$datum)\r\
\n:log warning \"SWITCHED TO SIM B - \$ProvSIMB LowerSlot BY STARTUP SCRIP\
T at \$time \$datum\"\r\
\n:log warning \"IP-CLOUD UPDATED \$BOOTtime +75sec TO \$time + \$BOOTdatu\
m TO \$datum\"\r\
\n} else={\r\
\n:log warning \"STARTUP SCRIPT FINISHED AT \$time ON \$datum - SIM B \$Pr\
ovSIMB LowerSlot WAS ALREADY ACTIVE\"\r\
\n:local BOOTtime [/system clock get time];\r\
\n:local BOOTdatum [/system clock get date];\r\
\n:delay 70s\r\
\n/ip cloud force-update\r\
\n:delay 5s\r\
\n:local time [/system clock get time];\r\
\n:local datum [/system clock get date];\r\
\n:global TimeUpdate (\$BOOTtime.\" > \".\$time)\r\
\n:global DateUpdate (\$BOOTdatum.\">\".\$datum)\r\
\n:log warning \"IP-CLOUD UPDATED \$BOOTtime +75sec TO \$time + \$BOOTdatu\
m TO \$datum\"\r\
\n:global Startup Finished\r\
\n}"
add dont-require-permissions=no name="Resetting Counters MTA2 #13" owner=\
Bucky policy=read,write,policy,test,romon source="#/ip kid-control device \
reset-counters\r\
\n#To reset only a specific device in Kid Control, use the number for the\
\_device, f.e. MTA2 is 13, so this would be\r\
\n/ip kid-control device reset-counters 13"
add comment="Resetting Mobile Connection Safely" dont-require-permissions=no \
name="Reset Modem" owner=Bucky policy=reboot,read,write,test,romon \
source=":foreach i in= [ /tool netwatch find ] do={ :tool netwatch disable\
\_\$i };\r\
\n/interface lte at-chat lte1 input=\"AT+reset\";\r\
\n:local time [/system clock get time];\r\
\n:log warning message=\"RESETTING MODEM BY SCRIPT AT \$time - NO SIM SWIT\
CH\";\r\
\n:delay 99s\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch enable \$i }\
\r\
\n"
add comment="Switch to SIMA UpperSlot by Schedule at 16:30" \
dont-require-permissions=no name=Switch2SIMA owner=Bucky policy=\
reboot,read,write,policy,test source="# Script switches to SIM Slot A\r\
\n# Then log descriptive warning\r\
\n:global simSlot [/system routerboard sim get sim-slot]\r\
\n:local time [/system clock get time];\r\
\n# Check which SIM slot is used\r\
\n{\r\
\n:if (\$simSlot=\"b\") do={\r\
\n\r\
\n:foreach i in= [ /tool netwatch find ] do={ \r\
\n:tool netwatch disable \$i};\r\
\n# If \"b\" LowerSlot, switch to \"a\" UpperSlot\r\
\n/system routerboard sim set sim-slot=a\r\
\n:log warning \"SWITCHED TO SIM A - \$ProvSIMA BY SCRIPT at \$time\";\r\
\n:delay 90s;\r\
\n:foreach i in= [ /tool netwatch find ] do={ :tool netwatch enable \$i };\
\r\
\n} else={\r\
\n:log warning \"SIM A \$ProvSIMA WAS ACTIVE - NO CHANGES BY SCRIPT at \$t\
ime\";\r\
\n}\r\
\n}"
/tool bandwidth-server
set enabled=no
/tool graphing interface
add interface=lte1
/tool graphing queue
add simple-queue=PCQ-Queue
/tool graphing resource
add
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool netwatch
add down-script=NetWatchSwitch2OtherSIMSlot host=9.9.9.9 interval=2m30s \
timeout=2s
/tool romon
set enabled=yes id=00:00:00:00:00:06
/tool sms
set port=lte1 receive-enabled=yes