Skip to content

Instantly share code, notes, and snippets.

@blueset blueset/tcdrop.sh
Last active Apr 17, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.