Community discussions

MUM Europe 2020
 
timesecuritypr
just joined
Topic Author
Posts: 1
Joined: Wed Jun 19, 2019 2:43 pm

Script to reboot phones

Wed Jun 19, 2019 2:55 pm

Good day:

I need to create a script that does the following:

Condition 1

1. check if primary ISP connection is unreachable and secondary ISP connection is reachable and primary ISP connection distance is 1
2. If primary ISP connection is unreachable and second reachable, change distance of primary connection to 4, clear all firewall connections and invoke certain http links. These links will reboot the phones so they can register using the failover ISP connection.

Condition 2

1. check if primary ISP connection is reachable and primary ISP connection distance is 4
2. If primary ISP connection is reachable and primary ISP connection distance is 4, change distance of primary connection to 1, clear all firewall connections and invoke certain http links. These links will reboot the phones so they can register using the primary ISP connection.

3. Script must check every 10 seconds.
 
ksthree
just joined
Posts: 18
Joined: Thu Jul 18, 2019 10:51 pm
Location: Durban, South Africa

Re: Script to reboot phones

Wed Nov 20, 2019 7:44 pm

start by disabling eth2

you could use a netwatch, if network is down, then check if eth2 is disabled, if yes then disable enth1 enable eth2 else enable eth1 disable eth2

doing it every 10seconds could cause an issue, check to see how fast eth2 get's ip address and same for eth1.

your setup might mean this needs to be done differently
---
I am a RouterOS Junkie... needing my daily fix. If I don't get to work on a RouterBoard I get a major itch.
 
gotsprings
Forum Veteran
Forum Veteran
Posts: 802
Joined: Mon May 14, 2012 9:30 pm

Re: Script to reboot phones

Sat Nov 30, 2019 1:21 pm

How about recursive routing for the 2 ISPs?

That eliminates the need to change distances dynamically.

Also you can query if a route is active or not.

Then make your script work on
If active then, else then.

You could alternatively set a static route to a host using your primary ISP and firewall it from reaching it over the secondary. Then a netwatch could monitor it.

You would set the netwatch to clear connections on any change between up or down.

(This is what I do for my router. Since both my ISPs are dynamic... I have a script on the dhcp-client to add the gateway to my recursive routes. Then I have a route set to use the primary ISP to reach a DNS service. There is a firewall output rule to drop the connection if that DNS is called via the secondary ISP. A netwatch pings that host. On Up: clear firewall connections. On Down: clear firewall connections. Been solid for almost a year.)
"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so."
Mark Twain

Who is online

Users browsing this forum: No registered users and 9 guests