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