Created
April 27, 2022 21:47
-
-
Save iAnatoly/77fcafc884a80faadf015edf28a9c938 to your computer and use it in GitHub Desktop.
Emulating packetloss and latency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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