Page 1 of 1

Bandwitdh limit per IP

Posted: Sat Feb 11, 2006 2:09 pm
by fatonk
Hello,

I'm trying to limit users based on IP, I want each user to have dedicated 128 Kbit/s including 56 Kbit/s within 128 Kbits. I do not want to use simple queuing, I'm trying this to be more dynamically using PCQ queuing, below is my configuration, but it seems not to work:


ip firewall mangle add chain=forward in-interface=2.4Ghz src-address=192.168.2.0/24 p2p=all-p2p action=mark-connection new-connection-mark=p2p-conn-up

ip firewall mangle add chain=forward in-interface=2.4Ghz p2p=all-p2p action=mark-packet new-packet-mark=p2p-up

ip firewall mangle add chain=forward out-interface=5.8Ghz dst-address=192.168.2.0/24 p2p=all-p2p action=mark-connection new-connection-mark=p2p-conn-down

ip firewall mangle add chain=forward out-interface=5.8Ghz p2p=all-p2p action=mark-packet new-packet-mark=p2p-down

ip firewall mangle add chain=forward p2p=!all-p2p action=mark-packet new-packet-mark=other

--------------------------------------------------------------------------------------

queue type add name=pcq-download kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000

queue type add name=pcq-upload kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000

queue type add name=pcq-down kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000

queue type add name=pcq-up kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000

-------------------------------------------------------------------------------------

queue tree add name=Download parent=chapelbridge packet-mark=p2p-down limit-at=56000 queue=pcq-download priority=8 max-limit=56000 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=queue2 parent=Download packet-mark=p2p-down limit-at=0 queue=pcq-download priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=Upload parent=chapelbridge packet-mark=p2p-up limit-at=56000 queue=pcq-upload priority=8 max-limit=56000 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=queue4 parent=Upload packet-mark=p2p-up limit-at=0 queue=pcq-upload priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=Down parent=chapelbridge packet-mark=other limit-at=131072 queue=pcq-down priority=1 max-limit=131072 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=queue6 parent=Down packet-mark=other limit-at=0 queue=pcq-down priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=Up parent=chapelbridge packet-mark=other limit-at=131072 queue=pcq-up priority=1 max-limit=131072 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=queue8 parent=Up packet-mark=other limit-at=0 queue=pcq-up priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

----------------------------------------------------------------------------------



Best regards,

Faton

Posted: Sat Feb 11, 2006 2:14 pm
by Hugh Hartman
http://www.butchevans.com/readarticle.php?article_id=10

This is for v 2.8--it would need to be converted for 2.9

Posted: Sat Feb 11, 2006 2:25 pm
by fatonk
I,m usiong version 2.9.6, but it is not clear for me on this article, just to use PCQ kind without classifiers, and thats it??!!

Posted: Sat Feb 11, 2006 2:52 pm
by fatonk
Hi,

This example limits overall bandwidth, I want each user to have 128 Kbits up and down 128 Kbits, not all users to share 128 Kbits.

Regards.

Faton

Posted: Sun Feb 12, 2006 2:40 am
by Hugh Hartman
I have retested this setup and it is not working per IP--when tested before it was working on each IP--
back to the books,,as i know there is a way to do this using PCQ without classifiers,,and adding an IP class which triggers the limits for each IP.

Posted: Mon Feb 13, 2006 12:05 pm
by fatonk
Hi,

Thanks for giving me a clue, I have found the formula which limits the bandwidth per IP, so the configuration below limits bandwidth at 128 Kbit per IP and also p2p at 56 Kbit but included within 128 Kbit, this is working if you do not put any src address in mangle, and as aprent use interfaces. This I have tested with three users all of them were getting 128 Kbits, here it is the config:

ip firewall mangle add chain=forward p2p=all-p2p action=mark-connection new-connection-mark=p2p_conn passthrough=yes

ip firewall mangle add chain=forward connection-mark=p2p_conn action=mark-packet new-packet-mark=p2p passthrough=yes

ip firewall mangle add chain=forward connection-mark=!p2p_conn action=mark-packet new-packet-mark=other passthrough=yes


queue type add name=p2p-Down kind=pcq pcq-rate=56000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000

queue type add name=p2p-Up kind=pcq pcq-rate=56000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000

queue type add name=Down kind=pcq pcq-rate=128000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000

queue type add name=Up kind=pcq pcq-rate=128000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000


queue tree add name=p2p-up parent=WAN packet-mark=p2p limit-at=0 queue=p2p-Up priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=p2p-Down parent=LAN packet-mark=p2p limit-at=0 queue=p2p-Down priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=Upload parent=WAN packet-mark=other limit-at=0 queue=Up priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s

queue tree add name=Download parent=LAN packet-mark=other limit-at=0 queue=Down priority=1 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s


Regards,

Faton

Posted: Mon Feb 13, 2006 4:24 pm
by Hugh Hartman
Thanks, I was able to apply what you have done to rewrite a simple 4 rule bandwidth configuration for v2.8 as follows:

/ queue type
queue type add name=Down kind=pcq pcq-rate=393216 pcq-limit=50 classifier=dst-address
queue type add name=Up kind=pcq pcq-rate=98304 pcq-limit=50 classifier=src-address


/ queue simple
add name="upload" target-address=0.0.0.0/0 dst-address=0.0.0.0/0 \
interface=Public queue=Up priority=1 limit-at=0/0 max-limit=0/0 \
disabled=no
add name="download" target-address=0.0.0.0/0 dst-address=0.0.0.0/0 \
interface=Local queue=Down priority=1 limit-at=0/0 max-limit=0/0 \
disabled=no

This should limit traffic to 96/384 without regard IP scheme behind the Mikrotik.
I have tested with (3) simultaneous user with good results.

Regards, Hugh

Posted: Mon Feb 13, 2006 5:03 pm
by fatonk
This worked for me too, up 64 down 128 no problem,

Thanks Hugh.

Regards.

Posted: Mon Feb 13, 2006 9:32 pm
by cyb.0rg
Hi,
fatonk, thx for interesting config :wink:

But, i have the next problem:
I have 320Kbit dw and this speed have to be equal (dynamicaly)share among all users,BUT only for 10 min(per user) , after it speed down to 64kbit (per user).

any ideas ?

Posted: Fri Feb 17, 2006 10:54 pm
by cyb.0rg
still nobody... :(