3

I have a requirement to limit the total incoming traffic to 5mbit. I know this can be achieved by using the following tc command:

tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 police rate 5mbit burst 10k drop flowid :1

Problem:

I have two traffic stream, say tcp and udp. My aim is to limit the total tcp and udp traffic to 5mbit and give tcp higher priority than udp.

That is if total incoming traffic is 7mbit, I need only 5mbit with less lose in tcp (as its having higher priority).

I know that I can write 2 different rules with, say 3mbit and 2mbit, like:

tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 match u32 `tcp` 0xff police rate 3mbit burst 10k drop flowid :1
tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 match u32 `udp` 0xff police rate 2mbit burst 10k drop flowid :1

but this will limit the tcp packets to 3mbits even though there is no udp packets.

Question:

Is there any approach so that I can limit the total incoming bandwidth, and drop excess packets based on priority?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.