Precisely tc and netem. To give an idea how powerful and tuneable netem can be, we had a piece of network gear that lost messages if they were too close in time to each other (less than N microseconds). Probably some 'copy packet during interrupt' stuff. We couldn't change anything in the applications or the network gear. The solution was (on the sender side) to 1) classify with tc the specific packet sequence and 2) delay the second message in the sequence. It's a large command-line, it does the job perfectly. It's marvelous.