Skip to content

Instantly share code, notes, and snippets.

@lesovsky
Created July 27, 2015 18:19
Show Gist options
  • Select an option

  • Save lesovsky/6c4e0aaa3fb03b58efae to your computer and use it in GitHub Desktop.

Select an option

Save lesovsky/6c4e0aaa3fb03b58efae to your computer and use it in GitHub Desktop.
Destination based traffic limiting with tc.
# add
# avpkt 1500 - MTU, bandwidth 1000mbit - interface speed, rate 20mbit - limit threshold
tc qdisc add dev eth1 root handle 1: cbq avpkt 1500 bandwidth 1000mbit
tc class add dev eth1 parent 1: classid 1:1 cbq rate 20mbit allot 1500 prio 5 bounded isolated
tc filter add dev eth1 parent 1: protocol ip prio 16 u32 match ip dst 10.0.0.33 flowid 1:1
# remove
tc filter del dev eth1 parent 1: protocol ip prio 16 u32 match ip dst 10.0.0.33 flowid 1:1
tc class del dev eth1 parent 1: classid 1:1 cbq rate 20mbit allot 1500 prio 5 bounded isolated
tc qdisc del dev eth1 root handle 1: cbq avpkt 1500 bandwidth 1000mbit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment