Pádraig Brady taught me a great trick in a comment to a previous blog post and it was so neat I feel a need to highlight it further as it also makes it easier for me to find it again later!
To simulate a far away server, add RTT time to the localhost device. For example if we add 100 milliseconds (which then makes 200ms ping time to localhost):
$ tc qdisc add dev lo root handle 1:0 netem delay 100msec
Restore it back to normal again with:
$ tc qdisc del dev lo root
tc qdisc add dev lo root handle 1:0 netem delay 100msec
Restore it back to normal again with:
tc qdisc del dev lo root
In addition, add a random packet loss. 500ms latency with 2.5% packet loss:
tc qdisc add dev lo root handle 1:0 netem delay 250msec loss 2.5%