![]() |
|
|
|
|||
|
Hello,
I am wondering if anyone has any insight as to how you can limit the total bandwidth used by a particular IP/host...etc? I know PF/ALTQ can prioritize and limit the total usuable connection speed but I am looking to do something more like a ratio once you reach X you are cut off. And I suppose in my case with the bandwidth you would be cut off for Y amount of time. Is there any simple way of doing this? I have yet to see any software (knowingly) to do this on OpenBSD. Thanks! P.S. I appologize if PF is able to do this. Please point me to the topic in the man page if doable. |
|
||||
|
If you want to shut off a connection after so many bytes, you'll have to do it via an manual examination of PF state tables. This might be as simple as a cron job that examines the output of # pfctl -vs state.
I used to do this with a cron job, to limit script kiddies from looping stupid ftpd attacks on "User Administrator" or other common userids that did not exist. I found a simple modification to ftpd can drop those sessions, and that's a much easier solution.PF can handle state creations via stateful tracking options, but it only direct limits already established and valid sessions -- not killed via stateful "overload flush" -- via traffic shaping from queue management. You have choices here, such as simple packet priority, bps, or percentage of bps of a parent queue.
__________________
OpenBSD LiveCDs/LiveDVDs Last edited by jggimi; 8th October 2008 at 12:49 AM. Reason: visual clarity, typos |
|
|||
|
Hello again jggimi,
Interesting. State would not be 100% accurate though right? For example if I were to reboot the system the states logs would be reset to 0 I presume? I would be interested in seeing any example how to implement this none the less though. It would be nice if there were a more exact way of handling this either through another program or if PF/ALTQ were expanded to support it. pass in on.... from $host ... port ... max bps number/days or something. Anyway thank you for your input.
|
|
||||
|
Rebooting a router will obviously kill any state table within it.
Even if a future PF development hooked bytes-transferred into stateful tracking, rebooting starts from scratch. As it does today with all of the stateful tracking knobs.When I had a cron job tracking bytes transferred, it was a simple perl script that used the output from sysutils/pftop. The state table data from pftop are no longer accurate, as it has not caught up with all PF changes. This is why I recommended using pfctl instead -- it can be trusted to stay in sync with PF changes. From memory, the script ran every 5 minutes, looked for inbound ftp control sessions (port 21) that had surpassed a total bytes transferred threshold (300KB). When found, the script would:
__________________
OpenBSD LiveCDs/LiveDVDs |
|
|||
|
Awesome
![]() Now that you wrote it out it make a little more sense! Haha. I will play around with this idea. Thanks a lot for your input. Good luck with that OBSD patch submission.
|
|
||||
|
Already submitted; already partially accepted.
__________________
OpenBSD LiveCDs/LiveDVDs |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disk I/O Throughput | m4rc | OpenBSD General | 5 | 10th July 2008 02:50 AM |
| limit use memory by Apache | mfaridi | FreeBSD Security | 4 | 8th July 2008 05:59 PM |
| Approaching the limit on PV entries | ccc | FreeBSD General | 6 | 14th June 2008 06:58 PM |
| bandwidth !!! | sybergod | OpenBSD Security | 1 | 23rd May 2008 09:10 AM |