1NETEM(8) Linux NETEM(8)
2
3
4
6 NetEm - Network Emulator
7
9 tc qdisc ... dev DEVICE ] add netem OPTIONS
10
11 OPTIONS := [ LIMIT ] [ DELAY ] [ LOSS ] [ CORRUPT ] [ DUPLICATION ] [
12 REORDERING ][ RATE ]
13
14 LIMIT := limit packets
15
16 DELAY := delay TIME [ JITTER [ CORRELATION ]]]
17 [ distribution { uniform | normal | pareto | paretonormal } ]
18
19 LOSS := loss { random PERCENT [ CORRELATION ] |
20 state p13 [ p31 [ p32 [ p23 [ p14]]]] |
21 gemodel p [ r [ 1-h [ 1-k ]]] } [ ecn ]
22
23 CORRUPT := corrupt PERCENT [ CORRELATION ]]
24
25 DUPLICATION := duplicate PERCENT [ CORRELATION ]]
26
27 REORDERING := reorder PERCENT [ CORRELATION ] [ gap DISTANCE ]
28
29 RATE := rate RATE [ PACKETOVERHEAD [ CELLSIZE [ CELLOVERHEAD ]]]]
30
31
32
34 NetEm is an enhancement of the Linux traffic control facilities that
35 allow to add delay, packet loss, duplication and more other character‐
36 istics to packets outgoing from a selected network interface. NetEm is
37 built using the existing Quality Of Service (QOS) and Differentiated
38 Services (diffserv) facilities in the Linux kernel.
39
40
42 netem has the following options:
43
44
45 limit packets
46 maximum number of packets the qdisc may hold queued at a time.
47
48
49 delay
50 adds the chosen delay to the packets outgoing to chosen network inter‐
51 face. The optional parameters allows to introduce a delay variation and
52 a correlation. Delay and jitter values are expressed in ms while cor‐
53 relation is percentage.
54
55
56 distribution
57 allow the user to choose the delay distribution. If not specified, the
58 default distribution is Normal. Additional parameters allow to consider
59 situations in which network has variable delays depending on traffic
60 flows concurring on the same path, that causes several delay peaks and
61 a tail.
62
63
64 loss random
65 adds an independent loss probability to the packets outgoing from the
66 chosen network interface. It is also possible to add a correlation, but
67 this option is now deprecated due to the noticed bad behavior.
68
69
70 loss state
71 adds packet losses according to the 4-state Markov using the transition
72 probabilities as input parameters. The parameter p13 is mandatory and
73 if used alone corresponds to the Bernoulli model. The optional parame‐
74 ters allows to extend the model to 2-state (p31), 3-state (p23 and p32)
75 and 4-state (p14). State 1 corresponds to good reception, State 4 to
76 independent losses, State 3 to burst losses and State 2 to good recep‐
77 tion within a burst.
78
79
80 loss gemodel
81 adds packet losses according to the Gilbert-Elliot loss model or its
82 special cases (Gilbert, Simple Gilbert and Bernoulli). To use the
83 Bernoulli model, the only needed parameter is p while the others will
84 be set to the default values r=1-p, 1-h=1 and 1-k=0. The parameters
85 needed for the Simple Gilbert model are two (p and r), while three
86 parameters (p, r, 1-h) are needed for the Gilbert model and four (p, r,
87 1-h and 1-k) are needed for the Gilbert-Elliot model. As known, p and r
88 are the transition probabilities between the bad and the good states,
89 1-h is the loss probability in the bad state and 1-k is the loss proba‐
90 bility in the good state.
91
92
93 ecn
94 can be used optionally to mark packets instead of dropping them. A loss
95 model has to be used for this to be enabled.
96
97
98 corrupt
99 allows the emulation of random noise introducing an error in a random
100 position for a chosen percent of packets. It is also possible to add a
101 correlation through the proper parameter.
102
103
104 duplicate
105 using this option the chosen percent of packets is duplicated before
106 queuing them. It is also possible to add a correlation through the
107 proper parameter.
108
109
110 reorder
111 to use reordering, a delay option must be specified. There are two ways
112 to use this option (assuming 'delay 10ms' in the options list).
113
114 reorder 25% 50% gap 5
115 in this first example, the first 4 (gap - 1) packets are delayed by
116 10ms and subsequent packets are sent immediately with a probability of
117 0.25 (with correlation of 50% ) or delayed with a probability of 0.75.
118 After a packet is reordered, the process restarts i.e. the next 4 pack‐
119 ets are delayed and subsequent packets are sent immediately or delayed
120 based on reordering probability. To cause a repeatable pattern where
121 every 5th packet is reordered reliably, a reorder probability of 100%
122 can be used.
123
124 reorder 25% 50%
125 in this second example 25% of packets are sent immediately (with corre‐
126 lation of 50%) while the others are delayed by 10 ms.
127
128
129 rate
130 delay packets based on packet size and is a replacement for TBF. Rate
131 can be specified in common units (e.g. 100kbit). Optional PACKETOVER‐
132 HEAD (in bytes) specify an per packet overhead and can be negative. A
133 positive value can be used to simulate additional link layer headers. A
134 negative value can be used to artificial strip the Ethernet header
135 (e.g. -14) and/or simulate a link layer header compression scheme. The
136 third parameter - an unsigned value - specify the cellsize. Cellsize
137 can be used to simulate link layer schemes. ATM for example has an pay‐
138 load cellsize of 48 bytes and 5 byte per cell header. If a packet is 50
139 byte then ATM must use two cells: 2 * 48 bytes payload including 2 * 5
140 byte header, thus consume 106 byte on the wire. The last optional value
141 CELLOVERHEAD can be used to specify per cell overhead - for our ATM
142 example 5. CELLOVERHEAD can be negative, but use negative values with
143 caution.
144
145 Note that rate throttling is limited by several factors: the kernel
146 clock granularity avoid a perfect shaping at a specific level. This
147 will show up in an artificial packet compression (bursts). Another
148 influence factor are network adapter buffers which can also add artifi‐
149 cial delay.
150
151
153 The main known limitation of Netem are related to timer granularity,
154 since Linux is not a real-time operating system.
155
156
158 tc qdisc add dev eth0 root netem rate 5kbit 20 100 5
159 delay all outgoing packets on device eth0 with a rate of 5kbit, a
160 per packet overhead of 20 byte, a cellsize of 100 byte and a per
161 celloverhead of 5 byte:
162
163
165 1. Hemminger S. , "Network Emulation with NetEm", Open Source Develop‐
166 ment Lab, April 2005 (http://devresources.linux-founda‐
167 tion.org/shemminger/netem/LCA2005_paper.pdf)
168
169
170 2. Netem page from Linux foundation, (http://www.linuxfounda‐
171 tion.org/en/Net:Netem)
172
173
174 3. Salsano S., Ludovici F., Ordine A., "Definition of a general and
175 intuitive loss model for packet networks and its implementation in
176 the Netem module in the Linux kernel", available at http://net‐
177 group.uniroma2.it/NetemCLG
178
179
181 tc(8), tc-tbf(8)
182
183
185 Netem was written by Stephen Hemminger at Linux foundation and is based
186 on NISTnet. This manpage was created by Fabio Ludovici <fabio.ludovici
187 at yahoo dot it> and Hagen Paul Pfeifer <hagen@jauu.net>
188
189
190
191iproute2 25 November 2011 NETEM(8)