11384 questions

13563 answers

21250 comments

31888 members

0 votes
118 views 0 comments
by

Is it possible to restrict access to certain applications when a monthly data limit has reached i.e.

  • Tier 1 (always) - Application A 
  • Tier 2 (only when data limit is <250mb per month). Application B, C, D etc

We don't want to cut-off all traffic, but restrict some types (based on destination IP or port), if/when a predefined limit has been reached on a monthly basis?

1 Answer

–1 vote
by

Hi,

This would require a custom script and a few commands that should act on different conditions.

The first one you should act on is mdcollectdctl1. This command will give you various information about the usage of the data on your SIM that is being collected. What you can do with it is collect data of the month, once it reaches the limit you have - add and activate firewall rules:

To add them and change them I would suggest using UCI:



firewall.@rule[24]=rule
firewall.@rule[24].enabled='1'
firewall.@rule[24].src='lan'
firewall.@rule[24].proto='tcp udp'
firewall.@rule[24].dest='wan'
firewall.@rule[24].name='block'
firewall.@rule[24].dest_ip='79.98.28.174'
firewall.@rule[24].target='DROP'
You can add these using uci add command.
Once you add all of these use uci commit firewall and luci-reload to save and reload.
Once you do this, traffic rule should be activated and working.
EB.
Best answer