There is a
tc command on Ubunut to manipulate traffic control settings, for example to introduce artificial packet
Add a packet delay of 100ms ± 10ms with the current delay depending 25% on the last delay:
tc qdisc change dev eth0 root netem delay 100ms 10ms 25%
You can even configure more convoluted settings:
sudo tc qdisc change dev lo root netem delay 50ms 200ms loss 10% 25% reorder 25% 50%
This page gives more thorough examples.