Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bandwidth Quotas using iptables
#11

Hi Dave

Thanks a lot for your support.

I will try out your trick by moving eth1 to some other B/C network.See I will tell you what I have done to setup my router initially(after installation of OS) so as to understand better.

1. Defined the eth0 as 10.10.56.23

2. Define eth1 as 10.136.15.197

3. enabled ip forwarding in the sysctl.conf

Controls IP packet forwarding

net.ipv4.ip_forward = 1

4. applied the below for firewall rules (after flushing all the iptable rules)

iptables -A FORWARD --in-interface eth1 --out-interface eth0 --source 10.136.0.0/24 -m state --state NEW -j ACCEPT

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A POSTROUTING -t nat -j MASQUERADE

Reply
#12

Hi Dave,

just to inform you all that I have solved the problem.Here is how:-

 

 

iptables -t mangle -A PREROUTING -i eth1 -p tcp -m quota --quota 100000 -j ACCEPT

iptables -t mangle -A PREROUTING -i eth1 -p tcp -j LOG --log-prefix "quotaover " --log-level 4

iptables -t mangle -A PREROUTING -i eth1 -p tcp -j DROP

 

But one strange thing is for example I m have fixed the quota to 3000bytes, and then i randomly doewnload video to exceed the quota,and once i exceed the quota i again and again (very fast)execute the command below to check the status for the quota

iptables -t mangle -L -v

then I see that the left out quota (usually 0 bytes as I have exceeded the defined quota of 3000) keeps on changing automatically and randomly.sometimes it comes to again the original value(3000) and then again reverts to 0 value.it keeps on fluctualting between 3000 and 0.But one good thing is I am not able to surf the internet once the I have crossed the quota (though the value keeps on changing)

Thanks a lot for your help..

Will dig further to know why this value keeps fluctuating

Reply
#13

If you are downloading using a browser, be aware that you could be looking at a cached copy.

 

Try the "wget" command if you want to download without a browser.

Reply
#14
I am downloading from a internet explorer after deleting the cache from browser.Also I am downloading a video from the Youtube which I have never seen before for testing, which means that If i have not visited that video, then there is no question of being cached.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)