Hi. I have googled a lot for the answer to this question, and although I have learned a lot about mangle and queues, I have not found a way to do what I imagine is quite a simple task.
I am looking to put Mikrotiks as NTEs which feed into a Cisco network. As such I want to mark packets leaving the Mikrotik with various DSCP values to be processed by the Cisco routers.
I have found Mangle is sufficient to mark packets based on IP address, port and protocol. So far so good.
However - I also want to be able to (for instance) mark the first 50Meg of bandwidth with one DSCP value, then mark anything over that with a different DSCP value, and I cannot see how to do that.
Note - I do not want to actually rate limit anything on the Mikrotik, I only want to mark the packets based on bandwidth usage. The rate limiting will be done upstream.
I am not 100% sure I have explained myself properly:
If a customer is sending traffic at a rate of 0-50Mbps, I need it to me marked with, for example, AF11.
If a customer then sends traffic at a rate of say, 60Mbps, I still need the first 50Mbps marked with AF11, and I only need the traffic from 51Mbps-60Mbps to be marked AF12.
I think your code would, for instance, mark traffic at 49Mbps as AF11, but then if the traffic rate was increased to 55Mbps, ALL traffic from 0-55Mbps would be marked as AF12, when I would still need the first 50Mbps to be AF11 and only the portion of traffic which is over 50Mbps to be marked as AF12.
This is so I can offer a CIR of 50Mbps and classify traffic over and above this rate differently.
I have tried using the ‘connection-rate’ command rather than ‘connection-bytes’, but the same problem applies.
ie. if a user is sending data at 40Mbps, it will mark the traffic as AF11 - which is fine.
but: if they then start sending data at 55Mbps, then the whole 55Mbps will be marked as AF12, when I need the first 50Mbps to be still marked at AF11 and only the final 5Mbps to be marked as AF12.
Of course not. How should the router know which traffic is below and which is above 50 Mbps?
Traffic is just packets and can only be judged “as a whole” to have a certain rate.