The Linux networking stack is the Swiss Army Knife of the tech world.
Using iptables, drop a random 10% of incoming and outgoing packets:
iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP
iptables -A OUTPUT -m statistic --mode random --probability 0.1 -j DROP
To reset:
iptables -D INPUT -m statistic --mode random --probability 0.1 -j DROP
iptables -D OUTPUT -m statistic --mode random --probability 0.1 -j DROP
Same thing using tc but adding some delay, reorders and dups:
tc qdisc add dev eth0 root netem delay 50ms 20ms distribution normal
tc qdisc change dev eth0 root netem reorder 0.02 duplicate 0.05 corrupt 0.01
To reset:
tc qdisc del dev eth0 root netem
That's it.