-
Notifications
You must be signed in to change notification settings - Fork 32
NetEm
This page is introduction to the new NetEm implementation. It contains a list of supported NetEm parameters, descriptions and examples of usage.
NetEm parameters are configured on each individual interface. You can configure them via XML recipe. Currently, LNST supports these parameters:
- Packet delay
- Packet loss
- Packet corruption
- Packet duplication
- Packet reordering
You can set any combination of these parameters, but only 1 instance of each parameter per interface is allowed. For example, you can't set delay twice on one interface. Following sections are more detailed descriptions of each NetEm parameter, with basic usage example.
To use this feature you need to have netem support enabled in kernel and kernel module installed. To check this run:
# grep -i netem /boot/config-3.19.8-100.fc20.x86_64
CONFIG_NET_SCH_NETEM=m
This means that netem code has been compiled as kernel module. To check if netem driver is available run:
# modinfo sch_netem
filename: /lib/modules/3.19.8-100.fc20.x86_64/extra/net/sched/sch_netem.ko
license: GPL
depends:
intree: Y
vermagic: 3.19.8-100.fc20.x86_64 SMP mod_unload
signer: Fedora kernel signing key
sig_key: 06:AF:36:EB:7B:28:A5:AD:E9:0B:02:1E:17:E6:AA:B2:B6:52:63:AA
sig_hashalgo: sha256
If you get an error that the module has not been found you have to install the kernel module or build it manually. For Fedora releases you can get the module by installing kernel-modules-extra package:
# yum install kernel-modules-extra
Adds the chosen delay to the packets outgoing to chosen network interface. The optional parameters allows to introduce a delay variation and a correlation. Delay and jitter values are expressed in ms while correlation is percentage.
option name | format | mandatory | other |
---|---|---|---|
time | ms | yes | |
jitter | ms | no | |
correlation | percent | no | jitter must be entered |
distribution | uniform | normal | pareto | no | jitter must be entered |
<eth id="testiface" label="testnet">
<netem>
<delay>
<options>
<option name="time" value="10ms" />
<option name="jitter" value="1ms" />
<option name="correlation" value="50%" />
<option name="distribution" value="normal" />
</options>
</delay>
</netem>
<addresses>
<address>192.168.101.10/24</address>
</addresses>
</eth>
Adds an independent loss probability to the packets outgoing from the chosen network interface. It is also possible to add a correlation, but this option is now deprecated due to the noticed bad behavior.
option name | format | mandatory | other |
---|---|---|---|
percent | percent | yes | |
correlation | percent | no | percent must be entered |
<eth id="testiface" label="testnet">
<netem>
<loss>
<options>
<option name="percent" value="10%" />
<option name="correlation" value="50%" />
</options>
</loss>
</netem>
<addresses>
<address>192.168.101.10/24</address>
</addresses>
</eth>
Allows the emulation of random noise introducing an error in a random position for a chosen percent of packets. It is also possible to add a correlation through the proper parameter.
option name | format | mandatory | other |
---|---|---|---|
percent | percent | yes | |
correlation | percent | no | percent must be entered |
<eth id="testiface" label="testnet">
<netem>
<corrupt>
<options>
<option name="percent" value="10%" />
<option name="correlation" value="50%" />
</options>
</corrupt>
</netem>
<addresses>
<address>192.168.101.10/24</address>
</addresses>
</eth>
Using this option the chosen percent of packets is duplicated before queuing them. It is also possible to add a correlation through the proper parameter.
option name | format | mandatory | other |
---|---|---|---|
percent | percent | yes | |
correlation | percent | no | percent must be entered |
<eth id="testiface" label="testnet">
<netem>
<duplication>
<options>
<option name="percent" value="10%" />
<option name="correlation" value="50%" />
</options>
</duplication>
</netem>
<addresses>
<address>192.168.101.10/24</address>
</addresses>
</eth>
To use reordering, a delay option must be specified. There are two ways to use this option (assuming 'delay 10ms' in the options list).
percent=10%, correlation=50%, gap_distance=10
- in this example, the first 9 (gap_distance - 1) packets are delayed by 10ms and subsequent packets are sent immediately with a probability of 0.10 (with correlation of 50%) or delayed with a probability of 0.90. After a packet is reordered, the process restarts i.e. the next 9 packets are delayed and subsequent packets are sent immediately or delayed based on reordering probability. To cause a repeatable pattern where every 10th packet is reordered reliably, a reorder probability of 100% can be used.
percent 10%,correlation=50%
- in this second example 10% of packets are sent immediately (with correlation of 50%) while the others are delayed by 10ms
option name | format | mandatory | other |
---|---|---|---|
percent | percent | yes | |
correlation | percent | no | percent must be entered |
gap_distance | number | no |
<eth id="testiface" label="testnet">
<netem>
<reorder>
<options>
<option name="percent" value="10%" />
<option name="gap_distance" value="10" />
<option name="correlation" value="50%" />
</options>
</reorder>
</netem>
<addresses>
<address>192.168.101.10/24</address>
</addresses>
</eth>
All the examples stated above are available in recipes/examples/
folder
Parameter description has been taken from NetEm man pages.