[Help] looking for a program that can restart the wan interface when the bandwidth is below a certain level

Hello everyone.
I am a new user to Openwrt.
I want to find a package that can automatically restart the WAN interface when the bandwidth of that WAN is below a certain level (eg 50 Kbps).
Where can I find it or I would like help building an app like it.

Looking forward to everyone's help.
Have a nice day.

It doesn't work that way.

The router can't know the current situation, e.g. if you're trying to download something and your line is genuinely slowing down - or if you're asleep and there's only light background traffic happening, nor can it distinguish between your line being 'bad' or your remote server being overloaded and slow.

I know it's pretty ridiculous, but really I need an app that can do just that for my personal use.

It still doesn't work - and because it doesn't work, no one has done that so far, so you'd be in the developer seat and write it yourself, just to confirm that it can't work

Thank you very much for your sharing

This is usually one of the main reasons new users come to opensource firmware. Not to get restart function! But they are fed up with the memory leaks in original firmware that force them to reboot once a day or week or months to get the speed up and running again?

So why do you want to reboot in the first place? At OpenWRT we really don’t do reboots as standard operating procedure, we just go and go an go online and the surfing never stops.

Currently I'm using AutoIT to restart the WAN interface when conditions are right (bandwidth <50 Kbps) and that takes quite a lot of hardware resources (01 VPS to run autoIT (.exe) 01 Pfsense to follow monitor input bandwidth like State > Realtime Graph > Trafic
available on OpenWRT) and of course add 01 OpenWrt Luci To be able to restart the wan interface.

I want to integrate it all into one application on Openwrt to reduce operating costs and be more compact for my own use.

I will be very grateful if someone can help me to solve the above problem.

<50kbps…what is “normal speed”?

What type of internet connection do you have?

What I don’t get is if you actually run OpenWRT now and on what device and what version of OpenWRT?

But as I already said. A normal working OpenWRT device doesn’t slow down over time. Doing a reboot is just at best solving the symptom of some other problem. Usually a memory leak.

I have a layer that filters through a firewall.
So exactly what connections go through OpenWRT are the connections I allow through. so it's not difficult to understand that when the bandwidth drops to some level, say 50Kbps (average is ~1024 Kbps), I will need to restart the WAN interface.

I'm running OpenWRT over ESXI.
Paradigm:
Internet <> OpenWRT (PPPOE WAN) <> FireWall <> Client

We don’t have any ESXI in table of hardware?
If I google ESXI it seems to be something with VMware?

If you have an unstable connection, restarting an interface isn't going to help. Determine why your connect is unsable. Your modem's http interface might offer clues (many user 192.168.100.1), SNR, power level, lock level and so forth. If the connection from the ISP to the modem is noisy, your ISP is likely accountable to run a new drop line and QC it to be within specs. This has been the case for me several times over the years.

Basicaly you could make a script which will do an iperf3 bandwidth test, and depending on the result will restart the wan interface. And add this in a cronjob.
But there will be some downsides, when you'll download something you may have some problems :sweat_smile:

As i did something similar recently:
You should have a look at luci-app-statistics and collectd package in general.
collectd with a lot of plugins is able to measure almost anything and with monitoring/thresholds you can then trigger events/scripts.
Also another package would be watchcat but i think it measures only pings not bandwith.

But as all the others already said: i would start searching the problem why the connection to your OpenWRT VM is going bad over time.