Community discussions

MikroTik App
 
abajo
just joined
Topic Author
Posts: 2
Joined: Tue Aug 31, 2021 7:42 pm

Requires Netwatch script for LTE failover

Tue Apr 19, 2022 5:11 pm

I have been trying to make a script for several days but without success, please help.
I have RBM33G, three interfaces. Image
The first interface is LINK with which I connect to an external node with internet access, the second interface is AP for clients, the third interface is LTE (USB).
Everything is configured correctly. When I manually disable LINK, it automatically turns on LTE and I have the internet again.
How to set up a script in Netwatch with ping to 8.8.8.8 when the internet disappears to automatically switch to LTE and conversely back?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 7:57 pm

edit: duplicate
Last edited by anav on Tue Apr 19, 2022 10:28 pm, edited 1 time in total.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 7:58 pm

Did you add lte1 to the interface list as a WAN port?

Please post config
/export hide-sensitive file=anynameyouwish

Also found this in SEARCH....
viewtopic.php?p=917598&hilit=lte+failover#p917598
 
abajo
just joined
Topic Author
Posts: 2
Joined: Tue Aug 31, 2021 7:42 pm

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 8:34 pm

Did you add lte1 to the interface list as a WAN port?

Please post config
/export hide-sensitive file=anynameyouwish
# apr/19/2022 19:26:30 by RouterOS 7.2.1
# software id = 9EF8-TBW7
#
# model = RBM33G
# serial number = A2FD0E80DD4E
/interface bridge
add fast-forward=no name=Bridge
/interface lte
set [ find ] name=LTE
/interface ethernet
set [ find default-name=ether2 ] l2mtu=1522 mac-address=D4:CA:6D:3D:C0:BB \
    name=Ether2 speed=100Mbps
set [ find default-name=ether3 ] l2mtu=1522 mac-address=D4:CA:6D:3D:C0:BC \
    name=Ether3 speed=100Mbps
set [ find default-name=ether1 ] name=Kamera
/interface wireless
set [ find default-name=wlan2 ] band=5ghz-a/n country=india disabled=no \
    frequency=5825 mode=station-bridge name=LINK rx-chains=0,1 ssid=LINK_ALEN \
    tx-chains=0,1 wireless-protocol=802.11
/disk
set sd1 disabled=no
set sd1-part1 disabled=no name=disk1
/interface list
add exclude=dynamic name=discover
add name=LAN
add name=WAN
/interface lte apn
set [ find default=yes ] ip-type=ipv4 use-network-apn=no
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk eap-methods="" \
    supplicant-identity=MikroTik
add authentication-types=wpa-psk,wpa2-psk eap-methods="" \
    management-protection=allowed mode=dynamic-keys name=profile1 \
    supplicant-identity=""
/interface wireless
set [ find default-name=wlan1 ] band=2ghz-b/g/n country=croatia disabled=no \
    frequency=2442 mode=ap-bridge name=AP rx-chains=0,1 security-profile=\
    profile1 ssid=HotSpot tx-chains=0,1
/ip ipsec proposal
set [ find default=yes ] enc-algorithms=3des
/ip pool
add name=dhcp ranges=10.51.11.2-10.51.11.13
add name=dhcp_pool-mobile ranges=192.168.100.2-192.168.100.254
/ip dhcp-server
add add-arp=yes address-pool=dhcp interface=Bridge lease-time=1d name=dhcp1
/port
set 0 name=serial0
set 1 name=serial1
/queue simple
add disabled=yes max-limit=5M/5M name="LTE 5/5" target=LTE,LTE
add disabled=yes max-limit=5M/5M name="LINK 5/5" target=LINK,LINK
add disabled=yes max-limit=10M/10M name="LINK 10/10" target=LINK,LINK
/routing bgp template
set default disabled=no output.network=bgp-networks
/routing table
add fib name=""
/snmp community
set [ find default=yes ] addresses=0.0.0.0/0
/system logging action
set 0 memory-lines=100
set 1 disk-file-name=log disk-lines-per-file=100
/interface bridge port
add bridge=Bridge hw=no ingress-filtering=no interface=Ether2
add bridge=Bridge hw=no ingress-filtering=no interface=Ether3
add bridge=Bridge ingress-filtering=no interface=Kamera
add bridge=Bridge interface=AP
/ip firewall connection tracking
set enabled=yes
/ip neighbor discovery-settings
set discover-interface-list=discover
/ipv6 settings
set disable-ipv6=yes max-neighbor-entries=8192
/interface detect-internet
set detect-interface-list=all
/interface list member
add interface=Ether2 list=discover
add interface=Ether3 list=discover
add interface=Ether3 list=LAN
add interface=Kamera list=LAN
add list=LAN
add interface=LTE list=WAN
add list=LAN
add interface=AP list=LAN
add interface=LINK list=WAN
add interface=Bridge list=LAN
/interface ovpn-server server
set auth=sha1,md5
/ip address
add address=10.51.11.1/26 interface=Bridge network=10.51.11.0
add address=192.168.100.1/24 interface=Bridge network=192.168.100.0
add address=10.51.11.254/30 interface=LINK network=10.51.11.252
/ip cloud
set ddns-enabled=yes
/ip dhcp-server network
add address=10.51.11.0/26 gateway=10.51.11.1
add address=192.168.100.0/24 gateway=192.168.100.1
/ip dns
set allow-remote-requests=yes servers=1.1.1.1
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add action=accept chain=input comment=DroidBox dst-port=8728 protocol=tcp
add action=accept chain=input comment=WinBox dst-port=8291 protocol=tcp
add action=fasttrack-connection chain=forward comment="fasttrack-dns tcp" \
    dst-port=53 hw-offload=yes protocol=tcp
add action=fasttrack-connection chain=forward comment="fasttrack-dns udp" \
    dst-port=53 hw-offload=yes protocol=udp
/ip firewall nat
add action=dst-nat chain=dstnat comment="Interni NAT za web kamere" dst-port=\
    23562 protocol=tcp src-address=10.5.0.0/16 to-addresses=10.51.8.254 \
    to-ports=8100
add action=dst-nat chain=dstnat dst-port=23562 protocol=tcp src-address=\
    10.51.0.0/16 to-addresses=10.51.8.254 to-ports=8100
add action=masquerade chain=srcnat comment="Externi NAT za LTE" \
    out-interface=LTE
/ip ipsec policy
set 0 dst-address=0.0.0.0/0 src-address=0.0.0.0/0
/ip proxy
set cache-path=web-proxy1 max-cache-size=none parent-proxy=0.0.0.0
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=10.51.11.253 \
    pref-src=0.0.0.0 routing-table=main scope=30 suppress-hw-offload=no \
    target-scope=10
add disabled=no dst-address=10.51.0.0/16 gateway=10.51.11.253 routing-table=\
    main suppress-hw-offload=no
/ip service
set www-ssl disabled=no
/ip smb shares
set [ find default=yes ] directory=/pub
/ip ssh
set allow-none-crypto=yes forwarding-enabled=remote
/snmp
set contact="Alen(RiWi)" enabled=yes location=Baska
/system clock
set time-zone-autodetect=no time-zone-name=Europe/Zagreb
/system clock manual
set dst-end="jan/01/2000 00:00:00" dst-start="jan/01/2000 00:00:00"
/system identity
set name="ALEN (RiWi)"
/system leds
set 0 leds="AP_signal1-led,AP_signal2-led,AP_signal3-led,AP_signal4-led,AP_sig\
    nal5-led" type=wireless-signal-strength
set 1 leds=AP_tx-led type=interface-transmit
set 2 leds=AP_rx-led type=interface-receive
set 3 leds="LINK_signal1-led,LINK_signal2-led,LINK_signal3-led,LINK_signal4-le\
    d,LINK_signal5-led" type=wireless-signal-strength
set 4 leds=LINK_tx-led type=interface-transmit
set 5 leds=LINK_rx-led type=interface-receive
/system ntp client
set enabled=yes
/system ntp client servers
add address=161.53.123.5
/system scheduler
add interval=4w name=schedule1 on-event=backup policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=\
    sep/26/2015 start-time=09:04:21
/system upgrade upgrade-package-source
add address=1.1.1.1 user=user
/tool bandwidth-server
set authenticate=no
/tool romon
set enabled=yes
/tool romon port
add
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 8:48 pm

Mnoge stvari treba riješiti (nastaje kaos) da bi "kutija rješenja" bolje funkcionirala.
;)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3441
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 9:18 pm

Well you other choices for this too...
1. use "check gateway" on the LINK route – now, this will just ping the "nexthop" (e.g. 10.51.11.253, not 8.8.8.8/"internet) and disable the route if the gateway is not pingable. This is dirt simple since you check need check the box for "check gateway" in IP>Routes for your 0.0.0.0 route:
Periodically (every 10 seconds) check gateway by sending either ICMP echo request (ping) or ARP request (arp). If no response from gateway is received for 10 seconds, request times out. After two timeouts gateway is considered unreachable. After receiving reply from gateway it is considered reachable and timeout counter is reset.
2. more complex, especially with multiple WANs, but "recursive routing", see https://help.mikrotik.com/docs/pages/vi ... d=26476608
3. while posting starts with: how to use script to failover – & possible and people do it – but IMO 1 or 2 are better choices unless you're already familar with RouterOS scripting.

One note. You have internet detect enabled. This generally less useful than it appears. It may work for you, but I found the "side effect" can break things (e.g. it will add a DHCP client to any monitored interface if nothing has internet).
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 10:32 pm

Mnoge stvari treba riješiti (nastaje kaos) da bi "kutija rješenja" bolje funkcionirala.
;)
Many things need to be solved (chaos is created) for the “solution box” to work better.

But abajo is Spanish not Bosnian!! ???
and thus this should have been used.........

Hay que resolver muchas cosas (se crea el caos) para que la “caja de soluciones” funcione mejor.

++++++++++++++++++++++++++
I am now scared to look at the config LOL.

AHHH now I see why location Zagreb!!! Keen eye their cat!! ;-)
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 10:41 pm

time-zone-name=Europe/Zagreb is not the only hint:

set [ find default-name=wlan1 ] country=croatia
+
comment="Interni NAT za web kamere" (Internal NAT for [5] webcams)
+
comment="Externi NAT za LTE" (External NAT for LTE)
+
set contact="Alen(RiWi)" enabled=yes location=Baska (https://hr.wikipedia.org/wiki/Ba%C5%A1ka)
=
baska web kamere
+ Google
=
https://bswireless.solutionbox.hr/ (Solution Box, the hint ;) )

:lol:

On Internet privacy do not exist.
PUBLIC photo available, already present on the Internet and published on the official website:
Image
Last edited by rextended on Tue Apr 19, 2022 10:55 pm, edited 2 times in total.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 10:53 pm

(1) Where is source nat rule for the main WAN link, I only see the one for LTE????

(2) Agree, set this to none, at least during troubleshooting process.
/interface detect-internet
set detect-interface-list=all


(3) Neighbours discovery is best used for all smart devices on the network so use the subnet interface/trusted interface for this setting.

(4) Remove the empty entries.....(orange) and the bridge entry covers all the pORTS..... so many are not required.
/interface list member
add list=LAN
add interface=LTE list=WAN
add list=LAN
add interface=LINK list=WAN
add interface=Bridge list=LAN
add interface=Bridge list=DISCOVER

(5) Why do you have two different addresses associated with the bridge ???? What purpose.........
Why does one of your bridge addresses look suspiciously like the WAN link address
/ip address
add address=10.51.11.1/26 interface=Bridge network=10.51.11.0
add address=192.168.100.1/24 interface=Bridge network=192.168.100.0
add address=10.51.11.254/30 interface=LINK network=10.51.11.252



(6) Very unsafe, why are you allowing EXTERNAL direct access to winbox a ROUTER SERVICE??
/ip firewall filter
add action=accept chain=input comment=DroidBox dst-port=8728 protocol=tcp
add action=accept chain=input comment=WinBox dst-port=8291 protocol=tcp

(7) Droid box above is not a Router Service that I am aware of or a VPN type, why is in the input chain????

(8) What is the purpose of these DNS rules in the forward chain???
add action=fasttrack-connection chain=forward comment="fasttrack-dns tcp" \
dst-port=53 hw-offload=yes protocol=tcp
add action=fasttrack-connection chain=forward comment="fasttrack-dns udp" \
dst-port=53 hw-offload=yes protocol=ud
p

(9) Your port forward rule contains no source for the incoming traffic it either needs in-interface-list=WAN or dst-address=WANIP type approach.
THe WAN IP is not a source address???

add action=dst-nat chain=dstnat dst-port=23562 protocol=tcp src-address=\
10.51.0.0/16
to-addresses=10.51.8.254 to-ports=8100

(10) IP Routes, iNo idea what your are trying to do there....
Should be something like

add distance=5 checkgateway=ping dst-address=0.0.0.0/0 gwy=10.51.11.253
add distance=10 dst-address=0.0.0.0/0 gwy=LTE-gateway-IP

In this regard all traffic will go to WAN link all the time.
If WAN link goes down the traffic will be switched over to LTE. The router will keep checking every 10 seconds or so to see if WAN Link is back up.
When it comes back up, the router will switch traffic back to WAN link.
Last edited by anav on Tue Apr 19, 2022 10:58 pm, edited 2 times in total.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 10:55 pm

On Internet privacy do not exist.
Some one seriously needs to see the barber!! ;-)
I know someone that can help!
....................
edward-scissorhands.jpg
You do not have the required permissions to view the files attached to this post.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Requires Netwatch script for LTE failover

Tue Apr 19, 2022 10:56 pm

Just some clue on .rsc and voilà...
Rex the Detective Cat :lol:
Image
 
aesmith
Member Candidate
Member Candidate
Posts: 264
Joined: Wed Mar 27, 2019 6:43 pm

Re: Requires Netwatch script for LTE failover

Wed Apr 20, 2022 4:04 pm

How to set up a script in Netwatch with ping to 8.8.8.8 when the internet disappears to automatically switch to LTE and conversely back?
However you do it there are good reasons not to use 8.8.8.8 as the test address. Firstly it is known that the Google DNS servers stop responding to ping when they're busy. Secondly using it as a test node means that it becomes unavailable on the backup Internet. I suggest using two nodes for your tests, failover only if both become unreachable, and use something that you don't need to access over the backup link, for example DNS or NTP specific to the main Internet.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Requires Netwatch script for LTE failover

Wed Apr 20, 2022 4:32 pm

[...] it is known that the Google DNS servers stop responding to ping when they're busy [...]
No, its not.
I'm probably extremely lucky. The 8.8.8.8 always stops responding only when I restart the device for planned maintenance...


Probably other IP than 1.1.1.1 and 8.8.8.8 produce more false positives than the first two...

Who is online

Users browsing this forum: sebol1204 and 63 guests