Skip to content

Instantly share code, notes, and snippets.

@Firefishy
Forked from anonymous/gist:d57d3a5a9b78de742c52
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Firefishy/9464cfa4f6b8bec2644a to your computer and use it in GitHub Desktop.
Save Firefishy/9464cfa4f6b8bec2644a to your computer and use it in GitHub Desktop.
#!/bin/bash
set +e
tc qdisc del dev em1 root
tc qdisc add dev em1 root handle 1: htb default 10
tc class add dev em1 parent 1: classid 1:1 htb rate 1070kbps ceil 1070kbps #Overall Speed
tc class add dev em1 parent 1:1 classid 1:10 htb rate 1000kbps ceil 1000kbps #Default
tc class add dev em1 parent 1:1 classid 1:11 htb rate 60kbps ceil 100kbps # Slower
tc class add dev em1 parent 1:1 classid 1:12 htb rate 10kbps ceil 10kbps # Slowest
tc qdisc add dev em1 parent 1:10 handle 100: fq_codel #fq_codel on default
tc qdisc add dev em1 parent 1:11 handle 110: fq_codel #fq_codel on slower
tc qdisc add dev em1 parent 1:12 handle 120: fq_codel #fq_codel on slowest
#Slower an IP
tc filter add dev em1 parent 1:0 protocol ip prio 1 u32 match ip dst 1.2.3.4/32 match ip sport 80 0xffff flowid 1:11
#Slowest an IP
tc filter add dev em1 parent 1:0 protocol ip prio 1 u32 match ip dst 4.3.2.1/32 match ip sport 80 0xffff flowid 1:12
tc filter add dev em1 parent 1:0 protocol ip prio 1 u32 match ip dst 212.159.112.221/32 match ip sport 80 0xffff flowid 1:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment