Skip to content

Instantly share code, notes, and snippets.

@blueset
Last active April 17, 2017 05:23
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 blueset/01d5e4d9aab5612c5e52b89bfba6a22d to your computer and use it in GitHub Desktop.
Save blueset/01d5e4d9aab5612c5e52b89bfba6a22d to your computer and use it in GitHub Desktop.
TC netem Drop packets from 32000 to 60000
modprobe sch_netem
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: prio priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
tc qdisc add dev eth0 parent 1:2 handle 20: netem loss 80% 20%
# tc filter add dev eth0 parent 1:0 protocol ip u32 match ip protocol 17 0xff match ip sport 32768 0xe000 flowid 1:2
tc filter add dev eth0 parent 1:0 protocol ip prio 1 basic match "cmp(u16 at 0 layer transport gt 31999) and cmp(u16 at 0 layer transport lt 60001) and u32(u8 0x11 0xff at 0x9)" flowid 1:2
tc qdisc ls
tc -s qdisc show dev eth0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment