add a network delay in linux

16 July 2015

Adding a delay to all network traffic is pretty easy and can be done through the following command.

adding a delay

#for device enp0s3
tc qdisc add dev enp0s3 root netem delay 100ms

query the current delay

#for all devices
tc -s qdisc
#for device enp0s3
tc qdisc show dev enp0s3

removing the delay

tc qdisc del dev enp0s3 root netem