Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Forked from digilist/delay.sh
Created January 30, 2018 09:49
Show Gist options
  • Save zhouqiang-cl/d1172b89786a11c39b68e08e5643c838 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/d1172b89786a11c39b68e08e5643c838 to your computer and use it in GitHub Desktop.
Delaying network traffic to a specific IP
#!/bin/bash
interface=lo
ip=10.0.0.1
delay=100ms
tc qdisc add dev $interface root handle 1: prio
tc filter add dev $interface parent 1:0 protocol ip prio 1 u32 match ip dst $ip flowid 2:1
tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment