Simulate single big network delay and packet burst after
I’m testing the Opus codec and VoIP stack which uses it.
I have synthetic test utility which sends internally Opus RTP traffic between two ports on loopback interface + this writes resulting audio to files to allow further analysis.
Using Linux ‘tc’ utility I can simulate various network impairments.
However I stuck to simulate such thing like "sudden network lag". Sorry for my poor English !
This should look like network is stopped for 1 seconds and after all delayed packets are sent as soon as possible to their targets.
Is it possible to implement with ‘tc’ utility ?
I tried to run the ‘tc’ command to make delay 1000ms during the synthetic test process; but it doesn’t give me wanted effect.
May anyone to give advice ?
Thank you 🙂
This should look like network is stopped for 1 seconds and after all
delayed packets are sent as soon as possible to their targets.
That is actually possible … From man tc
:
netem
Network Emulator is an enhancement of the Linux traffic
control facilities that
allow to add delay, packet loss, duplication and more other characteristics to
packets outgoing from a selected network interface.
… and from man tc-netem
:
slot
defer delivering accumulated packets to within a slot.
Each available slot can be configured with a minimum delay to
acquire, and an optional maximum delay.
… So, you can do something like this:
sudo tc qdisc add dev interface root netem slot 1000ms 1000ms
… where interface
is your intended network interface name as shown in e.g. the output of ip a
.
That will hold all transmitted packets on the specified interface for 1000ms
and then release them all at once (in a burst).
Notice that delay
on the other hand will add a delay of 1000ms
to every transmitted packet on the specified interface.