Page 1 of 1
Bandwidth shaping
Posted: Wed Oct 27, 2010 11:51 pm
by Ick
We hand out privates to our clients. Currently we are shaping bandwidth at the ap using non Mikrotik products (for now).
Just installed a Mikrotik Core router which we are NATing at. I would like to bandwidth shape our customers as follows:
Range 192.168.10.75 - 192.168.10.30 512K
Then we specify individual customers that are not on the 512K plan in a different range, Currently we have them listed as separate line items.
What would be the best way to setup a range of address to all use 512K?
Re: Bandwidth shaping
Posted: Wed Oct 27, 2010 11:57 pm
by fewi
Put those addresses on an address list (summarizing where you can for fast processing). Apply a packet mark for all traffic to/from addresses on that address list. Install a queue for that packet mark.
Simple example using simple queues:
/ip firewall address-list
# the below is a summary of .30 - .75
add list=myList address=192.168.10.30/31
add list=myList address=192.168.10.32/27
add list=myList address=192.168.10.64/29
add list=myList address=192.168.10.72/30
/ip firewall mangle
add chain=prerouting connection-mark=no-mark src-address-list=myList action=mark-connection new-connection-mark=myConnMark
add chain=prerouting connection-mark=myConnMark action=mark-packet new-packet-mark=myPacketMark
/queue simple
add name=myQueue max-limit=512k/512k direction=both packet-marks=myPacketMark
Re: Bandwidth shaping
Posted: Thu Nov 04, 2010 11:15 pm
by Ick
I did what you suggested, with the exception I changed the address subnet in my list to make it easier. I just used a 192168.10.128/25.
When I have the rules in the mangle tab enabled, the traffic comes to a crawl for the entire ap, almost nothing. When I disable them, traffic comes back to normal.
What am I doing wrong?
/ip firewall address-list
add list=myList address=192.168.10.128/25
/ip firewall mangle
add chain=prerouting connection-mark=no-mark src-address-list=myList action=mark-connection new-connection-mark=myConnMark
add chain=prerouting connection-mark=myConnMark action=mark-packet new-packet-mark=myPacketMark
/queue simple
add name=myQueue max-limit=512k/512k direction=both packet-marks=myPacketMark
Re: Bandwidth shaping
Posted: Thu Nov 04, 2010 11:26 pm
by Feklar
It will do that because that simple queue will match every single user on that address list, so all of the addresses will share the 512k/512k pipe, hence why you are seeing everything slow down, that's what you are telling it to do. Simple queues are just that simple, the first queue rule that a packet hits is the one it will be processed under.
Either set up a bunch of simple queues for each IP you want it to match for, or set up a queue tree with PCQ as the queue type.
Re: Bandwidth shaping
Posted: Tue Mar 22, 2011 5:19 pm
by devchaos
Put those addresses on an address list (summarizing where you can for fast processing). Apply a packet mark for all traffic to/from addresses on that address list. Install a queue for that packet mark.
Simple example using simple queues:
/ip firewall address-list
# the below is a summary of .30 - .75
add list=myList address=192.168.10.30/31
add list=myList address=192.168.10.32/27
add list=myList address=192.168.10.64/29
add list=myList address=192.168.10.72/30
/ip firewall mangle
add chain=prerouting connection-mark=no-mark src-address-list=myList action=mark-connection new-connection-mark=myConnMark
add chain=prerouting connection-mark=myConnMark action=mark-packet new-packet-mark=myPacketMark
/queue simple
add name=myQueue max-limit=512k/512k direction=both packet-marks=myPacketMark
This example will shape each user in list 512k/512k or all users 512k together?
Re: Bandwidth shaping
Posted: Tue Mar 22, 2011 5:24 pm
by Feklar
Everyone in the myList address list will share the 512k/512k limit.
Re: Bandwidth shaping
Posted: Tue Mar 22, 2011 5:58 pm
by devchaos
Sounds not good, need shaping each user in list 512k, not share 512k to all users, how to make it correct? Or I dont understand you? Sorry for my english
Re: Bandwidth shaping
Posted: Tue Mar 22, 2011 6:17 pm
by fewi
Read the manual:
http://wiki.mikrotik.com/wiki/Manual:Qu ... Q_Examples
/ip firewall address-list
# the below is a summary of .30 - .75
add list=myList address=192.168.10.30/31
add list=myList address=192.168.10.32/27
add list=myList address=192.168.10.64/29
add list=myList address=192.168.10.72/30
/ip firewall mangle
add chain=prerouting connection-mark=no-mark src-address-list=myList action=mark-connection new-connection-mark=myConnMark
add chain=prerouting connection-mark=myConnMark action=mark-packet new-packet-mark=myPacketMark
/queue type
add name="PCQ_download" kind=pcq pcq-rate=512000 pcq-classifier=dst-address
add name="PCQ_upload" kind=pcq pcq-rate=512000 pcq-classifier=src-address
/queue simple
add name=myQueue queue=PCQ_upload/PCQ_download packet-marks=myPacketMark
Re: Bandwidth shaping
Posted: Tue Mar 22, 2011 6:21 pm
by devchaos
Thank you