Community discussions

MikroTik App
 
Ick
newbie
Topic Author
Posts: 26
Joined: Sat Mar 11, 2006 5:31 pm

Bandwidth shaping

Wed Oct 27, 2010 11:51 pm

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?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Bandwidth shaping

Wed Oct 27, 2010 11:57 pm

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
 
Ick
newbie
Topic Author
Posts: 26
Joined: Sat Mar 11, 2006 5:31 pm

Re: Bandwidth shaping

Thu Nov 04, 2010 11:15 pm

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
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Bandwidth shaping

Thu Nov 04, 2010 11:26 pm

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.
 
devchaos
just joined
Posts: 18
Joined: Sat Oct 13, 2007 6:27 pm

Re: Bandwidth shaping

Tue Mar 22, 2011 5:19 pm

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?
 
Feklar
Forum Guru
Forum Guru
Posts: 1724
Joined: Tue Dec 01, 2009 11:46 pm

Re: Bandwidth shaping

Tue Mar 22, 2011 5:24 pm

Everyone in the myList address list will share the 512k/512k limit.
 
devchaos
just joined
Posts: 18
Joined: Sat Oct 13, 2007 6:27 pm

Re: Bandwidth shaping

Tue Mar 22, 2011 5:58 pm

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
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Bandwidth shaping

Tue Mar 22, 2011 6:17 pm

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
 
devchaos
just joined
Posts: 18
Joined: Sat Oct 13, 2007 6:27 pm

Re: Bandwidth shaping

Tue Mar 22, 2011 6:21 pm

Thank you