Traffic control with tc
October 12, 2021 -
Tags: linux
tc
(traffic control) is a great tool to “show / manipulate traffic settings”
in the Linux kernel. With the qdisc
command it’s e.g. possible to introduce
delays:
tc qdisc add dev eth0 root netem delay 200ms # exact delay
tc qdisc change dev eth0 root netem delay 200ms 20ms # 20ms uniform variation
tc qdisc change dev eth0 root netem delay 200ms 20ms 20% # 20ms uniform variation with correlation
errors:
tc qdisc change dev eth0 root netem corrupt 1%
loss:
tc qdisc add dev eth0 root netem loss 1%
and duplicates:
tc qdisc change dev eth0 root netem duplicate 1%
To view the current settings use:
tc qdisc show # all devices
tc qdisc show dev eth0 # a specific device
To delete rules use:
tc qdisc del dev eth0 root