Skip to content

Instantly share code, notes, and snippets.

@iAnatoly
Created April 27, 2022 21:47
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 iAnatoly/77fcafc884a80faadf015edf28a9c938 to your computer and use it in GitHub Desktop.
Save iAnatoly/77fcafc884a80faadf015edf28a9c938 to your computer and use it in GitHub Desktop.
Emulating packetloss and latency
https://stackoverflow.com/questions/614795/simulate-delayed-and-dropped-packets-on-linux
https://wiki.linuxfoundation.org/networking/netem
```bash
TARGET1='8.8.8.8'
DEV='eth0'
tc qdisc delete dev $DEV root
tc qdisc add dev $DEV root handle 1: prio
echo "part 1"
tc qdisc add dev $DEV parent 1:3 handle 30: tbf rate 20kbit buffer 1600 limit 3000
tc qdisc add dev $DEV parent 30:1 handle 31: netem delay 200ms 100ms loss 10% distribution normal
echo "adding filters"
tc filter add dev $DEV protocol ip parent 1:0 prio 3 u32 match ip dst $TARGET1/32 flowid 1:3
tc -s qdisc ls dev $DEV
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment