Data plan limit on LTE modem?

Hi!

I’m using a SIM card with a 30GB monthly data plan, is there a way to stop the interface if I reach the 30GB data plan?
The LTE modem is used as a backup connection, so the solution must keep the primary connection active.

Thanks!

This should be possible via some script that would poll the interface statistics from command like tcpstat. You could have a cron job run the script periodically and just disable the interface if the reported value reached certain threshold.

Hi kixorz, thanks for your reply!
Not so easy, I noticed that if I lose signal the counter is reset (the interface disappears and reappears).
That’s amusing that this feature is not already implented in OpenWRT. Maybe I should give a try and ask on OpenWRT board?

I use vnstat to monitor the traffic per interface.
You might be able to extract the monthly traffic using grep and some regular expression from vnstat -m and a script (cron job) to stop the interface when the maximum is exceeded.
Edit: check the vnstat command line options, --oneline might be what you want http://humdi.net/vnstat/man/vnstat.html

2 Likes