{
    "content": [
        {
            "type": "text",
            "text": "# NETEM (man)\n\n## NAME\n\nNetEm - Network Emulator\n\n## SYNOPSIS\n\ntc qdisc ... dev DEVICE ] add netem OPTIONS\nOPTIONS := [ LIMIT ] [ DELAY ] [ LOSS ] [ CORRUPT ] [ DUPLICATION ] [ REORDERING ] [ RATE ] [\nSLOT ]\nLIMIT := limit packets\nDELAY := delay TIME [ JITTER [ CORRELATION ]]]\n[ distribution { uniform | normal | pareto |  paretonormal } ]\nLOSS := loss { random PERCENT [ CORRELATION ]  |\nstate p13 [ p31 [ p32 [ p23 [ p14]]]] |\ngemodel p [ r [ 1-h [ 1-k ]]] }  [ ecn ]\nCORRUPT := corrupt PERCENT [ CORRELATION ]]\nDUPLICATION := duplicate PERCENT [ CORRELATION ]]\nREORDERING := reorder PERCENT [ CORRELATION ] [ gap DISTANCE ]\nRATE := rate RATE [ PACKETOVERHEAD [ CELLSIZE [ CELLOVERHEAD ]]]]\nSLOT := slot { MINDELAY [ MAXDELAY ] |\ndistribution { uniform | normal | pareto | paretonormal | FILE } DELAY  JITTER\n}\n[ packets PACKETS ] [ bytes BYTES ]\n\n## DESCRIPTION\n\nNetEm  is  an  enhancement  of  the Linux traffic control facilities that allow to add delay,\npacket loss, duplication and more other characteristics to packets outgoing from  a  selected\nnetwork interface. NetEm is built using the existing Quality Of Service (QOS) and Differenti‐\nated Services (diffserv) facilities in the Linux kernel.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (13 subsections)\n- **LIMITATIONS**\n- **EXAMPLES**\n- **SOURCES**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "NETEM",
        "section": "",
        "mode": "man",
        "summary": "NetEm - Network Emulator",
        "synopsis": "tc qdisc ... dev DEVICE ] add netem OPTIONS\nOPTIONS := [ LIMIT ] [ DELAY ] [ LOSS ] [ CORRUPT ] [ DUPLICATION ] [ REORDERING ] [ RATE ] [\nSLOT ]\nLIMIT := limit packets\nDELAY := delay TIME [ JITTER [ CORRELATION ]]]\n[ distribution { uniform | normal | pareto |  paretonormal } ]\nLOSS := loss { random PERCENT [ CORRELATION ]  |\nstate p13 [ p31 [ p32 [ p23 [ p14]]]] |\ngemodel p [ r [ 1-h [ 1-k ]]] }  [ ecn ]\nCORRUPT := corrupt PERCENT [ CORRELATION ]]\nDUPLICATION := duplicate PERCENT [ CORRELATION ]]\nREORDERING := reorder PERCENT [ CORRELATION ] [ gap DISTANCE ]\nRATE := rate RATE [ PACKETOVERHEAD [ CELLSIZE [ CELLOVERHEAD ]]]]\nSLOT := slot { MINDELAY [ MAXDELAY ] |\ndistribution { uniform | normal | pareto | paretonormal | FILE } DELAY  JITTER\n}\n[ packets PACKETS ] [ bytes BYTES ]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "tc qdisc add dev eth0 root netem rate 5kbit 20 100 5",
            "delay  all outgoing packets on device eth0 with a rate of 5kbit, a per packet overhead of",
            "20 byte, a cellsize of 100 byte and a per celloverhead of 5 byte:"
        ],
        "see_also": [
            {
                "name": "tc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
            },
            {
                "name": "tc-tbf",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-tbf/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": [
                    {
                        "name": "netem OPTIONS",
                        "lines": 3
                    },
                    {
                        "name": "limit packets",
                        "lines": 3
                    },
                    {
                        "name": "delay",
                        "lines": 5
                    },
                    {
                        "name": "distribution",
                        "lines": 6
                    },
                    {
                        "name": "loss random",
                        "lines": 5
                    },
                    {
                        "name": "loss state",
                        "lines": 7
                    },
                    {
                        "name": "loss gemodel",
                        "lines": 10
                    },
                    {
                        "name": "ecn",
                        "lines": 4
                    },
                    {
                        "name": "corrupt",
                        "lines": 4
                    },
                    {
                        "name": "duplicate",
                        "lines": 4
                    },
                    {
                        "name": "reorder",
                        "lines": 16
                    },
                    {
                        "name": "rate",
                        "lines": 18
                    },
                    {
                        "name": "slot",
                        "lines": 18
                    }
                ]
            },
            {
                "name": "LIMITATIONS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SOURCES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "NetEm - Network Emulator\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "tc qdisc ... dev DEVICE ] add netem OPTIONS\n\nOPTIONS := [ LIMIT ] [ DELAY ] [ LOSS ] [ CORRUPT ] [ DUPLICATION ] [ REORDERING ] [ RATE ] [\nSLOT ]\n\nLIMIT := limit packets\n\nDELAY := delay TIME [ JITTER [ CORRELATION ]]]\n[ distribution { uniform | normal | pareto |  paretonormal } ]\n\nLOSS := loss { random PERCENT [ CORRELATION ]  |\nstate p13 [ p31 [ p32 [ p23 [ p14]]]] |\ngemodel p [ r [ 1-h [ 1-k ]]] }  [ ecn ]\n\nCORRUPT := corrupt PERCENT [ CORRELATION ]]\n\nDUPLICATION := duplicate PERCENT [ CORRELATION ]]\n\nREORDERING := reorder PERCENT [ CORRELATION ] [ gap DISTANCE ]\n\nRATE := rate RATE [ PACKETOVERHEAD [ CELLSIZE [ CELLOVERHEAD ]]]]\n\nSLOT := slot { MINDELAY [ MAXDELAY ] |\ndistribution { uniform | normal | pareto | paretonormal | FILE } DELAY  JITTER\n}\n[ packets PACKETS ] [ bytes BYTES ]\n\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "NetEm  is  an  enhancement  of  the Linux traffic control facilities that allow to add delay,\npacket loss, duplication and more other characteristics to packets outgoing from  a  selected\nnetwork interface. NetEm is built using the existing Quality Of Service (QOS) and Differenti‐\nated Services (diffserv) facilities in the Linux kernel.\n\n",
                "subsections": [
                    {
                        "name": "netem OPTIONS",
                        "content": "netem has the following options:\n\n"
                    },
                    {
                        "name": "limit packets",
                        "content": "maximum number of packets the qdisc may hold queued at a time.\n\n"
                    },
                    {
                        "name": "delay",
                        "content": "adds the chosen delay to the packets outgoing to chosen network interface. The  optional  pa‐\nrameters  allows  to  introduce a delay variation and a correlation.  Delay and jitter values\nare expressed in ms while correlation is percentage.\n\n"
                    },
                    {
                        "name": "distribution",
                        "content": "allow the user to choose the delay distribution. If not specified, the  default  distribution\nis  Normal.  Additional parameters allow to consider situations in which network has variable\ndelays depending on traffic flows concurring on the same  path,  that  causes  several  delay\npeaks and a tail.\n\n"
                    },
                    {
                        "name": "loss random",
                        "content": "adds  an  independent loss probability to the packets outgoing from the chosen network inter‐\nface. It is also possible to add a correlation, but this option is now deprecated due to  the\nnoticed bad behavior.\n\n"
                    },
                    {
                        "name": "loss state",
                        "content": "adds  packet losses according to the 4-state Markov using the transition probabilities as in‐\nput parameters. The parameter p13 is mandatory and if used alone corresponds to the Bernoulli\nmodel.  The optional parameters allows to extend the model to 2-state (p31), 3-state (p23 and\np32) and 4-state (p14).  State 1 corresponds  to  good  reception,  State  4  to  independent\nlosses, State 3 to burst losses and State 2 to good reception within a burst.\n\n"
                    },
                    {
                        "name": "loss gemodel",
                        "content": "adds  packet losses according to the Gilbert-Elliot loss model or its special cases (Gilbert,\nSimple Gilbert and Bernoulli). To use the Bernoulli model, the only  needed  parameter  is  p\nwhile  the  others  will  be set to the default values r=1-p, 1-h=1 and 1-k=0. The parameters\nneeded for the Simple Gilbert model are two (p and r), while three parameters (p, r, 1-h) are\nneeded  for  the Gilbert model and four (p, r, 1-h and 1-k) are needed for the Gilbert-Elliot\nmodel. As known, p and r are the transition  probabilities  between  the  bad  and  the  good\nstates,  1-h  is the loss probability in the bad state and 1-k is the loss probability in the\ngood state.\n\n"
                    },
                    {
                        "name": "ecn",
                        "content": "can be used optionally to mark packets instead of dropping them. A loss model has to be  used\nfor this to be enabled.\n\n"
                    },
                    {
                        "name": "corrupt",
                        "content": "allows  the  emulation of random noise introducing an error in a random position for a chosen\npercent of packets. It is also possible to add a correlation through the proper parameter.\n\n"
                    },
                    {
                        "name": "duplicate",
                        "content": "using this option the chosen percent of packets is duplicated before queuing them. It is also\npossible to add a correlation through the proper parameter.\n\n"
                    },
                    {
                        "name": "reorder",
                        "content": "to  use  reordering,  a delay option must be specified. There are two ways to use this option\n(assuming 'delay 10ms' in the options list).\n\nreorder 25% 50% gap 5\nin this first example, the first 4 (gap - 1) packets are delayed by 10ms and subsequent pack‐\nets  are  sent  immediately  with a probability of 0.25 (with correlation of 50% ) or delayed\nwith a probability of 0.75. After a packet is reordered, the process restarts i.e. the next 4\npackets  are delayed and subsequent packets are sent immediately or delayed based on reorder‐\ning probability. To cause a repeatable pattern where every 5th packet is reordered  reliably,\na reorder probability of 100% can be used.\n\nreorder 25% 50%\nin  this  second  example 25% of packets are sent immediately (with correlation of 50%) while\nthe others are delayed by 10 ms.\n\n"
                    },
                    {
                        "name": "rate",
                        "content": "delay packets based on packet size and is a replacement for TBF.  Rate can  be  specified  in\ncommon  units  (e.g. 100kbit). Optional PACKETOVERHEAD (in bytes) specify an per packet over‐\nhead and can be negative. A positive value can be used  to  simulate  additional  link  layer\nheaders.  A  negative  value  can  be used to artificial strip the Ethernet header (e.g. -14)\nand/or simulate a link layer header compression scheme. The third  parameter  -  an  unsigned\nvalue  -  specify  the cellsize. Cellsize can be used to simulate link layer schemes. ATM for\nexample has an payload cellsize of 48 bytes and 5 byte per cell header. If  a  packet  is  50\nbyte then ATM must use two cells: 2 * 48 bytes payload including 2 * 5 byte header, thus con‐\nsume 106 byte on the wire. The last optional value CELLOVERHEAD can be used  to  specify  per\ncell overhead - for our ATM example 5.  CELLOVERHEAD can be negative, but use negative values\nwith caution.\n\nNote that rate throttling is limited by several factors: the kernel clock granularity avoid a\nperfect  shaping  at  a specific level. This will show up in an artificial packet compression\n(bursts). Another influence factor are network adapter buffers which can also add  artificial\ndelay.\n\n"
                    },
                    {
                        "name": "slot",
                        "content": "defer  delivering accumulated packets to within a slot. Each available slot can be configured\nwith a minimum delay to acquire, and an optional maximum delay.  Alternatively it can be con‐\nfigured  with  the  distribution similar to distribution for delay option. Slot delays can be\nspecified in nanoseconds, microseconds, milliseconds or seconds (e.g. 800us). Values for  the\noptional  parameters  BYTES will limit the number of bytes delivered per slot, and/or PACKETS\nwill limit the number of packets delivered per slot.\n\nThese slot options can provide a crude approximation of bursty MACs such as DOCSIS, WiFi, and\nLTE.\n\nNote  that  slotting  is  limited by several factors: the kernel clock granularity, as with a\nrate, and attempts to deliver many packets within a slot will be smeared by the timer resolu‐\ntion, and by the underlying native bandwidth also.\n\nIt  is possible to combine slotting with a rate, in which case complex behaviors where either\nthe rate, or the slot limits on bytes or packets per slot, govern the actual delivered rate.\n\n"
                    }
                ]
            },
            "LIMITATIONS": {
                "content": "The main known limitation of Netem are related to timer granularity, since  Linux  is  not  a\nreal-time operating system.\n\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "tc qdisc add dev eth0 root netem rate 5kbit 20 100 5\ndelay  all outgoing packets on device eth0 with a rate of 5kbit, a per packet overhead of\n20 byte, a cellsize of 100 byte and a per celloverhead of 5 byte:\n\n",
                "subsections": []
            },
            "SOURCES": {
                "content": "1. Hemminger S. , \"Network Emulation with NetEm\", Open Source Development  Lab,  April  2005\n(http://devresources.linux-foundation.org/shemminger/netem/LCA2005paper.pdf)\n\n\n2. Netem page from Linux foundation, (https://wiki.linuxfoundation.org/networking/netem)\n\n\n3. Salsano S., Ludovici F., Ordine A., \"Definition of a general and intuitive loss model for\npacket networks and its implementation in the Netem module in the Linux  kernel\",  avail‐\nable at http://netgroup.uniroma2.it/NetemCLG\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "tc(8), tc-tbf(8)\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Netem  was  written  by  Stephen Hemminger at Linux foundation and is based on NISTnet.  This\nmanpage was created by Fabio Ludovici <fabio.ludovici at yahoo dot it> and Hagen Paul Pfeifer\n<hagen@jauu.net>\n\n\n\niproute2                                  25 November 2011                                  NETEM(8)",
                "subsections": []
            }
        }
    }
}