I’ve been creating Nagios plugins for MongoDB and I needed to stimulate some network latency for testing my connect test. I wanted to simulate a 2 second connection lag so I ran the following command
tc qdisc add dev eth0 root netem delay 1000ms
When you are done you can delete it like
tc qdisc del root dev eth0
I am sure there is a better tc command you can run to get better results but this worked.