{
    "content": [
        {
            "type": "text",
            "text": "# tc (man)\n\n## NAME\n\ntc - show / manipulate traffic control settings\n\n## SYNOPSIS\n\ntc  [  OPTIONS ] qdisc [ add | change | replace | link | delete ] dev DEV [ parent qdisc-id |\nroot ] [ handle qdisc-id ] [ ingressblock BLOCKINDEX ] [ egressblock BLOCKINDEX ] qdisc [\nqdisc specific parameters ]\ntc [ OPTIONS ] class [ add | change | replace | delete | show ] dev  DEV  parent  qdisc-id  [\nclassid class-id ] qdisc [ qdisc specific parameters ]\ntc  [  OPTIONS ] filter [ add | change | replace | delete | get ] dev DEV [ parent qdisc-id |\nroot ] [ handle filter-id ] protocol protocol prio priority filtertype [ filtertype  specific\nparameters ] flowid flow-id\ntc  [  OPTIONS  ] filter [ add | change | replace | delete | get ] block BLOCKINDEX [ handle\nfilter-id ] protocol protocol prio priority filtertype [  filtertype  specific  parameters  ]\nflowid flow-id\ntc  [  OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [\nfiltertype specific parameters ]\ntc [ OPTIONS ] chain [ add | delete | get ] block BLOCKINDEX filtertype  [  filtertype  spe‐\ncific parameters ]\ntc [ OPTIONS ] [ FORMAT ] qdisc { show | list } [ dev DEV ] [ root | ingress | handle QHANDLE\n| parent CLASSID ] [ invisible ]\ntc [ OPTIONS ] [ FORMAT ] class show dev DEV\ntc [ OPTIONS ] filter show dev DEV\ntc [ OPTIONS ] filter show block BLOCKINDEX\ntc [ OPTIONS ] chain show dev DEV\ntc [ OPTIONS ] chain show block BLOCKINDEX\ntc [ OPTIONS ] monitor [ file FILENAME ]\nOPTIONS := { [ -force ] -b[atch] [ filename ] | [ -n[etns] name ] | [ -N[umeric] ] | [ -nm |\n\n## DESCRIPTION\n\nTc  is used to configure Traffic Control in the Linux kernel. Traffic Control consists of the\nfollowing:\n\n## TLDR\n\n> Show/manipulate traffic control settings.\n\n- Add constant network delay to outbound packages:\n  `sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem delay {{delay_in_milliseconds}}ms`\n- Add normal distributed network delay to outbound packages:\n  `sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem delay {{mean_delay_ms}}ms {{delay_std_ms}}ms`\n- Add package corruption/loss/duplication to a portion of packages:\n  `sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem {{corruption|loss|duplication}} {{effect_percentage}}%`\n- Limit bandwidth, burst rate and max latency:\n  `sudo tc {{q|qdisc}} {{a|add}} dev eth0 root tbf rate {{max_bandwidth_mb}}mbit burst {{max_burst_rate_kb}}kbit latency {{max_latency_before_drop_ms}}ms`\n- Show active traffic control policies:\n  `tc {{q|qdisc}} {{s|show}} dev {{eth0}}`\n- Delete all traffic control rules:\n  `sudo tc {{q|qdisc}} {{d|delete}} dev {{eth0}}`\n- Change traffic control rule:\n  `sudo tc {{q|qdisc}} {{c|change}} dev {{eth0}} root netem {{policy}} {{policy_parameters}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (2 subsections)\n- **DESCRIPTION**\n- **QDISCS**\n- **CLASSES**\n- **FILTERS**\n- **QEVENTS**\n- **CLASSLESS QDISCS**\n- **CONFIGURING CLASSLESS QDISCS**\n- **CLASSFUL QDISCS**\n- **THEORY OF OPERATION**\n- **NAMING**\n- **PARAMETERS**\n- **TC COMMANDS**\n- **MONITOR**\n- **OPTIONS** (8 subsections)\n- **FORMAT** (10 subsections)\n- **EXAMPLES**\n- **HISTORY**\n- **SEE ALSO** (1 subsections)\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "tc",
        "section": "",
        "mode": "man",
        "summary": "tc - show / manipulate traffic control settings",
        "synopsis": "tc  [  OPTIONS ] qdisc [ add | change | replace | link | delete ] dev DEV [ parent qdisc-id |\nroot ] [ handle qdisc-id ] [ ingressblock BLOCKINDEX ] [ egressblock BLOCKINDEX ] qdisc [\nqdisc specific parameters ]\ntc [ OPTIONS ] class [ add | change | replace | delete | show ] dev  DEV  parent  qdisc-id  [\nclassid class-id ] qdisc [ qdisc specific parameters ]\ntc  [  OPTIONS ] filter [ add | change | replace | delete | get ] dev DEV [ parent qdisc-id |\nroot ] [ handle filter-id ] protocol protocol prio priority filtertype [ filtertype  specific\nparameters ] flowid flow-id\ntc  [  OPTIONS  ] filter [ add | change | replace | delete | get ] block BLOCKINDEX [ handle\nfilter-id ] protocol protocol prio priority filtertype [  filtertype  specific  parameters  ]\nflowid flow-id\ntc  [  OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [\nfiltertype specific parameters ]\ntc [ OPTIONS ] chain [ add | delete | get ] block BLOCKINDEX filtertype  [  filtertype  spe‐\ncific parameters ]\ntc [ OPTIONS ] [ FORMAT ] qdisc { show | list } [ dev DEV ] [ root | ingress | handle QHANDLE\n| parent CLASSID ] [ invisible ]\ntc [ OPTIONS ] [ FORMAT ] class show dev DEV\ntc [ OPTIONS ] filter show dev DEV\ntc [ OPTIONS ] filter show block BLOCKINDEX\ntc [ OPTIONS ] chain show dev DEV\ntc [ OPTIONS ] chain show block BLOCKINDEX\ntc [ OPTIONS ] monitor [ file FILENAME ]\nOPTIONS := { [ -force ] -b[atch] [ filename ] | [ -n[etns] name ] | [ -N[umeric] ] | [ -nm |",
        "tldr_summary": "Show/manipulate traffic control settings.",
        "tldr_examples": [
            {
                "description": "Add constant network delay to outbound packages",
                "command": "sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem delay {{delay_in_milliseconds}}ms"
            },
            {
                "description": "Add normal distributed network delay to outbound packages",
                "command": "sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem delay {{mean_delay_ms}}ms {{delay_std_ms}}ms"
            },
            {
                "description": "Add package corruption/loss/duplication to a portion of packages",
                "command": "sudo tc {{q|qdisc}} {{a|add}} dev {{eth0}} root netem {{corruption|loss|duplication}} {{effect_percentage}}%"
            },
            {
                "description": "Limit bandwidth, burst rate and max latency",
                "command": "sudo tc {{q|qdisc}} {{a|add}} dev eth0 root tbf rate {{max_bandwidth_mb}}mbit burst {{max_burst_rate_kb}}kbit latency {{max_latency_before_drop_ms}}ms"
            },
            {
                "description": "Show active traffic control policies",
                "command": "tc {{q|qdisc}} {{s|show}} dev {{eth0}}"
            },
            {
                "description": "Delete all traffic control rules",
                "command": "sudo tc {{q|qdisc}} {{d|delete}} dev {{eth0}}"
            },
            {
                "description": "Change traffic control rule",
                "command": "sudo tc {{q|qdisc}} {{c|change}} dev {{eth0}} root netem {{policy}} {{policy_parameters}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "read commands from provided file or standard input and invoke them. First failure will cause termination of tc."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "of the commands, the application return code will be non zero."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "output each record on a single line, replacing line feeds with the '\\' character. This is convenient when you want to count records with wc(1) or to grep(1) the output."
            },
            {
                "flag": "-n",
                "long": null,
                "arg": null,
                "description": "switches tc to the specified network namespace NETNS. Actually it just simplifies ex‐ ecuting of: ip netns exec NETNS tc [ OPTIONS ] OBJECT { COMMAND | help } to tc -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }"
            },
            {
                "flag": "-N",
                "long": null,
                "arg": null,
                "description": "Print the number of protocol, scope, dsfield, etc directly instead of converting it to human readable name."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "specifies path to the config file. This option is used in conjunction with other op‐ tions (e.g. -nm)."
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "When tc monitor runs, print timestamp before the event message in format: Timestamp: <Day> <Month> <DD> <hh:mm:ss> <YYYY> <usecs> usec"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When tc monitor runs, prints short timestamp before the event message in format: [<YYYY>-<MM>-<DD>T<hh:mm:ss>.<ms>]"
            }
        ],
        "examples": [
            "tc -g class show dev eth0",
            "Shows classes as ASCII graph on eth0 interface.",
            "tc -g -s class show dev eth0",
            "Shows classes as ASCII graph with stats info under each class."
        ],
        "see_also": [
            {
                "name": "tc-basic",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-basic/8/json"
            },
            {
                "name": "tc-bfifo",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-bfifo/8/json"
            },
            {
                "name": "tc-bpf",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-bpf/8/json"
            },
            {
                "name": "tc-cake",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-cake/8/json"
            },
            {
                "name": "tc-cbq",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-cbq/8/json"
            },
            {
                "name": "tc-cgroup",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-cgroup/8/json"
            },
            {
                "name": "tc-choke",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-choke/8/json"
            },
            {
                "name": "codel",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/codel/8/json"
            },
            {
                "name": "tc-drr",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-drr/8/json"
            },
            {
                "name": "tc-ematch",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-ematch/8/json"
            },
            {
                "name": "tc-ets",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-ets/8/json"
            },
            {
                "name": "tc-flow",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-flow/8/json"
            },
            {
                "name": "tc-flower",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-flower/8/json"
            },
            {
                "name": "tc-fq",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-fq/8/json"
            },
            {
                "name": "fqcodel",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/fqcodel/8/json"
            },
            {
                "name": "tc-fqpie",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-fqpie/8/json"
            },
            {
                "name": "tc-fw",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-fw/8/json"
            },
            {
                "name": "tc-hfsc",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/tc-hfsc/7/json"
            },
            {
                "name": "tc-hfsc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-hfsc/8/json"
            },
            {
                "name": "tc-htb",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-htb/8/json"
            },
            {
                "name": "tc-mqprio",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-mqprio/8/json"
            },
            {
                "name": "pfifo",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/pfifo/8/json"
            },
            {
                "name": "tc-pfifofast",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-pfifofast/8/json"
            },
            {
                "name": "tc-pie",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-pie/8/json"
            },
            {
                "name": "tc-red",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-red/8/json"
            },
            {
                "name": "tc-route",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-route/8/json"
            },
            {
                "name": "tc-sfb",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-sfb/8/json"
            },
            {
                "name": "tc-sfq",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-sfq/8/json"
            },
            {
                "name": "stab",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/stab/8/json"
            },
            {
                "name": "tc-tbf",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-tbf/8/json"
            },
            {
                "name": "tc-tcindex",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-tcindex/8/json"
            },
            {
                "name": "tc-u32",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-u32/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 40,
                "subsections": [
                    {
                        "name": "-nam -cf  -c",
                        "lines": 3,
                        "flag": "-c"
                    },
                    {
                        "name": "-col",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "QDISCS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "FILTERS",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "QEVENTS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "CLASSLESS QDISCS",
                "lines": 83,
                "subsections": []
            },
            {
                "name": "CONFIGURING CLASSLESS QDISCS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "CLASSFUL QDISCS",
                "lines": 42,
                "subsections": []
            },
            {
                "name": "THEORY OF OPERATION",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "NAMING",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 88,
                "subsections": []
            },
            {
                "name": "TC COMMANDS",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "MONITOR",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-b -b filename -batch -batch filename",
                        "lines": 4,
                        "flag": "-b"
                    },
                    {
                        "name": "-force",
                        "lines": 3
                    },
                    {
                        "name": "-o -oneline",
                        "lines": 4,
                        "flag": "-o"
                    },
                    {
                        "name": "-n -net -netns",
                        "lines": 10,
                        "flag": "-n"
                    },
                    {
                        "name": "-N -Numeric",
                        "lines": 4,
                        "flag": "-N"
                    },
                    {
                        "name": "-cf -conf",
                        "lines": 4
                    },
                    {
                        "name": "-t -timestamp",
                        "lines": 4,
                        "flag": "-t"
                    },
                    {
                        "name": "-ts -tshort",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "FORMAT",
                "lines": 3,
                "subsections": [
                    {
                        "name": "-s -stats -statistics",
                        "lines": 3,
                        "flag": "-s"
                    },
                    {
                        "name": "-d -details",
                        "lines": 3,
                        "flag": "-d"
                    },
                    {
                        "name": "-r -raw",
                        "lines": 3,
                        "flag": "-r"
                    },
                    {
                        "name": "-p -pretty",
                        "lines": 4,
                        "flag": "-p"
                    },
                    {
                        "name": "-iec",
                        "lines": 1
                    },
                    {
                        "name": "-g -graph",
                        "lines": 4,
                        "flag": "-g"
                    },
                    {
                        "name": "-c",
                        "lines": 7,
                        "flag": "-c"
                    },
                    {
                        "name": "-j -json",
                        "lines": 3,
                        "flag": "-j"
                    },
                    {
                        "name": "-nm -name",
                        "lines": 13
                    },
                    {
                        "name": "-br -brief",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": [
                    {
                        "name": "dev@vger.kernel.org>",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "tc - show / manipulate traffic control settings\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "tc  [  OPTIONS ] qdisc [ add | change | replace | link | delete ] dev DEV [ parent qdisc-id |\nroot ] [ handle qdisc-id ] [ ingressblock BLOCKINDEX ] [ egressblock BLOCKINDEX ] qdisc [\nqdisc specific parameters ]\n\ntc [ OPTIONS ] class [ add | change | replace | delete | show ] dev  DEV  parent  qdisc-id  [\nclassid class-id ] qdisc [ qdisc specific parameters ]\n\ntc  [  OPTIONS ] filter [ add | change | replace | delete | get ] dev DEV [ parent qdisc-id |\nroot ] [ handle filter-id ] protocol protocol prio priority filtertype [ filtertype  specific\nparameters ] flowid flow-id\n\ntc  [  OPTIONS  ] filter [ add | change | replace | delete | get ] block BLOCKINDEX [ handle\nfilter-id ] protocol protocol prio priority filtertype [  filtertype  specific  parameters  ]\nflowid flow-id\n\ntc  [  OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [\nfiltertype specific parameters ]\n\ntc [ OPTIONS ] chain [ add | delete | get ] block BLOCKINDEX filtertype  [  filtertype  spe‐\ncific parameters ]\n\n\ntc [ OPTIONS ] [ FORMAT ] qdisc { show | list } [ dev DEV ] [ root | ingress | handle QHANDLE\n| parent CLASSID ] [ invisible ]\n\ntc [ OPTIONS ] [ FORMAT ] class show dev DEV\n\ntc [ OPTIONS ] filter show dev DEV\n\ntc [ OPTIONS ] filter show block BLOCKINDEX\n\ntc [ OPTIONS ] chain show dev DEV\n\ntc [ OPTIONS ] chain show block BLOCKINDEX\n\n\ntc [ OPTIONS ] monitor [ file FILENAME ]\n\n\nOPTIONS := { [ -force ] -b[atch] [ filename ] | [ -n[etns] name ] | [ -N[umeric] ] | [ -nm |",
                "subsections": [
                    {
                        "name": "-nam -cf  -c",
                        "content": "] }\n\nFORMAT := { -s[tatistics] | -d[etails] | -r[aw] | -i[ec] | -g[raph] | -j[json] | -p[retty] |",
                        "flag": "-c"
                    },
                    {
                        "name": "-col",
                        "content": ""
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "Tc  is used to configure Traffic Control in the Linux kernel. Traffic Control consists of the\nfollowing:\n\n\nSHAPING\nWhen traffic is shaped, its rate of transmission is under control. Shaping may be more\nthan lowering the available bandwidth - it is also used to smooth out bursts in  traf‐\nfic for better network behaviour. Shaping occurs on egress.\n\n\nSCHEDULING\nBy  scheduling the transmission of packets it is possible to improve interactivity for\ntraffic that needs it while still guaranteeing bandwidth to bulk transfers. Reordering\nis also called prioritizing, and happens only on egress.\n\n\nPOLICING\nWhereas shaping deals with transmission of traffic, policing pertains to  traffic  ar‐\nriving. Policing thus occurs on ingress.\n\n\nDROPPING\nTraffic  exceeding  a set bandwidth may also be dropped forthwith, both on ingress and\non egress.\n\n\nProcessing of traffic is controlled by three kinds of objects: qdiscs, classes and filters.\n\n",
                "subsections": []
            },
            "QDISCS": {
                "content": "qdisc is short for 'queueing discipline' and it is elementary to understanding  traffic  con‐\ntrol. Whenever the kernel needs to send a packet to an interface, it is enqueued to the qdisc\nconfigured  for that interface. Immediately afterwards, the kernel tries to get as many pack‐\nets as possible from the qdisc, for giving them to the network adaptor driver.\n\nA simple QDISC is the 'pfifo' one, which does no processing at all and is a  pure  First  In,\nFirst Out queue. It does however store traffic when the network interface can't handle it mo‐\nmentarily.\n\n",
                "subsections": []
            },
            "CLASSES": {
                "content": "Some  qdiscs can contain classes, which contain further qdiscs - traffic may then be enqueued\nin any of the inner qdiscs, which are within the classes.  When the kernel tries to dequeue a\npacket from such a classful qdisc it can come from any of the classes. A qdisc may for  exam‐\nple prioritize certain kinds of traffic by trying to dequeue from certain classes before oth‐\ners.\n\n",
                "subsections": []
            },
            "FILTERS": {
                "content": "A  filter  is used by a classful qdisc to determine in which class a packet will be enqueued.\nWhenever traffic arrives at a class with subclasses, it needs to be classified. Various meth‐\nods may be employed to do so, one of these are the filters. All filters attached to the class\nare called, until one of them returns with a verdict. If no verdict was made, other  criteria\nmay be available. This differs per qdisc.\n\nIt  is  important  to notice that filters reside within qdiscs - they are not masters of what\nhappens.\n\nThe available filters are:\n\nbasic  Filter packets based on an ematch expression. See tc-ematch(8) for details.\n\nbpf    Filter packets using (e)BPF, see tc-bpf(8) for details.\n\ncgroup Filter packets based on the control group of their process. See tc-cgroup(8)  for  de‐\ntails.\n\nflow, flower\nFlow-based  classifiers,  filtering  packets based on their flow (identified by selec‐\ntable keys). See tc-flow(8) and tc-flower(8) for details.\n\nfw     Filter based on fwmark. Directly maps fwmark value to traffic class. See tc-fw(8).\n\nroute  Filter packets based on routing table. See tc-route(8) for details.\n\nrsvp   Match Resource Reservation Protocol (RSVP) packets.\n\ntcindex\nFilter packets based on traffic control index. See tc-tcindex(8).\n\nu32    Generic filtering on arbitrary packet data, assisted by syntax to abstract common  op‐\nerations. See tc-u32(8) for details.\n\nmatchall\nTraffic control filter that matches every packet. See tc-matchall(8) for details.\n\n",
                "subsections": []
            },
            "QEVENTS": {
                "content": "Qdiscs  may  invoke user-configured actions when certain interesting events take place in the\nqdisc. Each qevent can either be unused, or can have a block attached to it.  To  this  block\nare  then  attached filters using the \"tc block BLOCKIDX\" syntax. The block is executed when\nthe qevent associated with the attachment point takes place. For  example,  packet  could  be\ndropped, or delayed, etc., depending on the qdisc and the qevent in question.\n\nFor example:\n\ntc qdisc add dev eth0 root handle 1: red limit 500K avpkt 1K \\\nqevent earlydrop block 10\ntc filter add block 10 matchall action mirred egress mirror dev eth1\n\n",
                "subsections": []
            },
            "CLASSLESS QDISCS": {
                "content": "The classless qdiscs are:\n\nchoke  CHOKe  (CHOose  and Keep for responsive flows, CHOose and Kill for unresponsive flows)\nis a classless qdisc designed to both identify and penalize flows that monopolize  the\nqueue. CHOKe is a variation of RED, and the configuration is similar to RED.\n\ncodel  CoDel  (pronounced  \"coddle\")  is an adaptive \"no-knobs\" active queue management algo‐\nrithm (AQM) scheme that was developed to address the shortcomings of RED and its vari‐\nants.\n\n[p|b]fifo\nSimplest usable qdisc, pure First In, First Out behaviour. Limited in  packets  or  in\nbytes.\n\nfq     Fair  Queue  Scheduler  realises TCP pacing and scales to millions of concurrent flows\nper qdisc.\n\nfqcodel\nFair Queuing Controlled Delay is queuing discipline that combines  Fair  Queuing  with\nthe  CoDel  AQM  scheme. FQCodel uses a stochastic model to classify incoming packets\ninto different flows and is used to provide a fair share of the bandwidth to  all  the\nflows  using the queue. Each such flow is managed by the CoDel queuing discipline. Re‐\nordering within a flow is avoided since Codel internally uses a FIFO queue.\n\nfqpie FQ-PIE (Flow Queuing with Proportional Integral controller Enhanced) is a queuing dis‐\ncipline that combines Flow Queuing with the PIE AQM scheme. FQ-PIE uses a Jenkins hash\nfunction to classify incoming packets into different flows and is used  to  provide  a\nfair  share  of the bandwidth to all the flows using the qdisc. Each such flow is man‐\naged by the PIE algorithm.\n\ngred   Generalized Random Early Detection combines multiple RED queues in  order  to  achieve\nmultiple drop priorities. This is required to realize Assured Forwarding (RFC 2597).\n\nhhf    Heavy-Hitter  Filter  differentiates  between small flows and the opposite, heavy-hit‐\nters. The goal is to catch the heavy-hitters and move them to a  separate  queue  with\nless priority so that bulk traffic does not affect the latency of critical traffic.\n\ningress\nThis  is  a  special qdisc as it applies to incoming traffic on an interface, allowing\nfor it to be filtered and policed.\n\nmqprio The Multiqueue Priority Qdisc is a simple queuing discipline that allows mapping traf‐\nfic flows to hardware queue ranges using priorities and  a  configurable  priority  to\ntraffic  class  mapping.  A traffic class in this context is a set of contiguous qdisc\nclasses which map 1:1 to a set of hardware exposed queues.\n\nmultiq Multiqueue is a qdisc optimized for devices with multiple Tx queues. It has been added\nfor hardware that wishes to avoid head-of-line blocking.  It  will  cycle  though  the\nbands and verify that the hardware queue associated with the band is not stopped prior\nto dequeuing a packet.\n\nnetem  Network  Emulator is an enhancement of the Linux traffic control facilities that allow\none to add delay, packet loss, duplication and more other characteristics  to  packets\noutgoing from a selected network interface.\n\npfifofast\nStandard  qdisc  for 'Advanced Router' enabled kernels. Consists of a three-band queue\nwhich honors Type of Service flags, as well as the priority that may be assigned to  a\npacket.\n\npie    Proportional  Integral  controller-Enhanced  (PIE) is a control theoretic active queue\nmanagement scheme. It is based on the proportional integral  controller  but  aims  to\ncontrol delay.\n\nred    Random Early Detection simulates physical congestion by randomly dropping packets when\nnearing  configured bandwidth allocation. Well suited to very large bandwidth applica‐\ntions.\n\nrr     Round-Robin qdisc with support for multiqueue  network  devices.  Removed  from  Linux\nsince kernel version 2.6.27.\n\nsfb    Stochastic  Fair  Blue  is a classless qdisc to manage congestion based on packet loss\nand link utilization history while trying to prevent non-responsive flows (i.e.  flows\nthat do not react to congestion marking or dropped packets) from impacting performance\nof  responsive flows.  Unlike RED, where the marking probability has to be configured,\nBLUE tries to determine the ideal marking probability automatically.\n\nsfq    Stochastic Fairness Queueing reorders queued traffic so each 'session' gets to send  a\npacket in turn.\n\ntbf    The  Token  Bucket Filter is suited for slowing traffic down to a precisely configured\nrate. Scales well to large bandwidths.\n",
                "subsections": []
            },
            "CONFIGURING CLASSLESS QDISCS": {
                "content": "In the absence of classful qdiscs, classless qdiscs can only be attached at the root of a de‐\nvice. Full syntax:\n\ntc qdisc add dev DEV root QDISC QDISC-PARAMETERS\n\nTo remove, issue\n\ntc qdisc del dev DEV root\n\nThe pfifofast qdisc is the automatic default in the absence of a configured qdisc.\n\n",
                "subsections": []
            },
            "CLASSFUL QDISCS": {
                "content": "The classful qdiscs are:\n\nATM    Map flows to virtual circuits of an underlying asynchronous transfer mode device.\n\nCBQ    Class Based Queueing implements a rich linksharing hierarchy of classes.  It  contains\nshaping elements as well as prioritizing capabilities. Shaping is performed using link\nidle time calculations based on average packet size and underlying link bandwidth. The\nlatter may be ill-defined for some interfaces.\n\nDRR    The  Deficit Round Robin Scheduler is a more flexible replacement for Stochastic Fair‐\nness Queuing. Unlike SFQ, there are no built-in queues -- you need to add classes  and\nthen  set up filters to classify packets accordingly.  This can be useful e.g. for us‐\ning RED qdiscs with different settings for particular traffic.  There  is  no  default\nclass -- if a packet cannot be classified, it is dropped.\n\nDSMARK Classify  packets based on TOS field, change TOS field of packets based on classifica‐\ntion.\n\nETS    The ETS qdisc is a queuing discipline that merges functionality of PRIO and DRR qdiscs\nin one scheduler. ETS makes it easy to configure a set of strict and bandwidth-sharing\nbands to implement the transmission selection described in 802.1Qaz.\n\nHFSC   Hierarchical Fair Service Curve guarantees precise bandwidth and delay allocation  for\nleaf classes and allocates excess bandwidth fairly. Unlike HTB, it makes use of packet\ndropping to achieve low delays which interactive sessions benefit from.\n\nHTB    The  Hierarchy Token Bucket implements a rich linksharing hierarchy of classes with an\nemphasis on conforming to existing practices. HTB facilitates  guaranteeing  bandwidth\nto  classes, while also allowing specification of upper limits to inter-class sharing.\nIt contains shaping elements, based on TBF and can prioritize classes.\n\nPRIO   The PRIO qdisc is a non-shaping container for a configurable number of  classes  which\nare  dequeued  in  order.  This allows for easy prioritization of traffic, where lower\nclasses are only able to send if higher ones have no packets available. To  facilitate\nconfiguration, Type Of Service bits are honored by default.\n\nQFQ    Quick Fair Queueing is an O(1) scheduler that provides near-optimal guarantees, and is\nthe first to achieve that goal with a constant cost also with respect to the number of\ngroups and the packet length. The QFQ algorithm has no loops, and uses very simple in‐\nstructions  and data structures that lend themselves very well to a hardware implemen‐\ntation.\n",
                "subsections": []
            },
            "THEORY OF OPERATION": {
                "content": "Classes form a tree, where each class has a single parent.  A class may have  multiple  chil‐\ndren.  Some  qdiscs  allow for runtime addition of classes (CBQ, HTB) while others (PRIO) are\ncreated with a static number of children.\n\nQdiscs which allow dynamic addition of classes can have zero  or  more  subclasses  to  which\ntraffic may be enqueued.\n\nFurthermore,  each class contains a leaf qdisc which by default has pfifo behaviour, although\nanother qdisc can be attached in place. This qdisc may again contain classes, but each  class\ncan have only one leaf qdisc.\n\nWhen  a  packet  enters  a  classful qdisc it can be classified to one of the classes within.\nThree criteria are available, although not all qdiscs will use all three:\n\ntc filters\nIf tc filters are attached to a class, they are consulted first for relevant  instruc‐\ntions.  Filters can match on all fields of a packet header, as well as on the firewall\nmark applied by iptables.\n\nType of Service\nSome qdiscs have built in rules for classifying packets based on the TOS field.\n\nskb->priority\nUserspace programs can encode a  class-id  in  the  'skb->priority'  field  using  the\nSOPRIORITY option.\n\nEach  node  within  the tree can have its own filters but higher level filters may also point\ndirectly to lower classes.\n\nIf classification did not succeed, packets are enqueued to the leaf qdisc  attached  to  that\nclass. Check qdisc specific manpages for details, however.\n\n",
                "subsections": []
            },
            "NAMING": {
                "content": "All  qdiscs,  classes and filters have IDs, which can either be specified or be automatically\nassigned.\n\nIDs consist of a major number and a minor number, separated by a colon -  major:minor.   Both\nmajor  and  minor  are  hexadecimal numbers and are limited to 16 bits. There are two special\nvalues: root is signified by major and minor of all ones, and unspecified is all zeros.\n\n\nQDISCS A qdisc, which potentially can have children, gets assigned a major number,  called  a\n'handle',  leaving the minor number namespace available for classes. The handle is ex‐\npressed as '10:'.  It is customary to explicitly assign a handle to qdiscs expected to\nhave children.\n\n\nCLASSES\nClasses residing under a qdisc share their qdisc major number, but each have  a  sepa‐\nrate  minor  number  called  a 'classid' that has no relation to their parent classes,\nonly to their parent qdisc. The same naming custom as for qdiscs applies.\n\n\nFILTERS\nFilters have a three part ID, which is only needed when using a hashed filter  hierar‐\nchy.\n\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "The  following  parameters are widely used in TC. For other parameters, see the man pages for\nindividual qdiscs.\n\n\nRATES  Bandwidths or rates.  These parameters accept a floating point number,  possibly  fol‐\nlowed by either a unit (both SI and IEC units supported), or a float followed by a '%'\ncharacter  to specify the rate as a percentage of the device's speed (e.g. 5%, 99.5%).\nWarning: specifying the rate as a percentage means a fraction of the current speed; if\nthe speed changes, the value will not be recalculated.\n\nbit or a bare number\nBits per second\n\nkbit   Kilobits per second\n\nmbit   Megabits per second\n\ngbit   Gigabits per second\n\ntbit   Terabits per second\n\nbps    Bytes per second\n\nkbps   Kilobytes per second\n\nmbps   Megabytes per second\n\ngbps   Gigabytes per second\n\ntbps   Terabytes per second\n\n\nTo specify in IEC units, replace the SI prefix (k-, m-, g-, t-) with IEC prefix  (ki-,\nmi-, gi- and ti-) respectively.\n\n\nTC store rates as a 32-bit unsigned integer in bps internally, so we can specify a max\nrate of 4294967295 bps.\n\n\nTIMES  Length  of  time.  Can be specified as a floating point number followed by an optional\nunit:\n\ns, sec or secs\nWhole seconds\n\nms, msec or msecs\nMilliseconds\n\nus, usec, usecs or a bare number\nMicroseconds.\n\n\nTC defined its own time unit (equal to microsecond) and stores time values  as  32-bit\nunsigned integer, thus we can specify a max time value of 4294967295 usecs.\n\n\nSIZES  Amounts  of  data. Can be specified as a floating point number followed by an optional\nunit:\n\nb or a bare number\nBytes.\n\nkbit   Kilobits\n\nkb or k\nKilobytes\n\nmbit   Megabits\n\nmb or m\nMegabytes\n\ngbit   Gigabits\n\ngb or g\nGigabytes\n\n\nTC stores sizes internally as 32-bit unsigned integer in byte, so we can specify a max\nsize of 4294967295 bytes.\n\n\nVALUES Other values without a unit.  These parameters are interpreted as decimal by  default,\nbut  you can indicate TC to interpret them as octal and hexadecimal by adding a '0' or\n'0x' prefix respectively.\n\n",
                "subsections": []
            },
            "TC COMMANDS": {
                "content": "The following commands are available for qdiscs, classes and filter:\n\nadd    Add a qdisc, class or filter to a node. For all entities, a parent must be passed, ei‐\nther by passing its ID or by attaching directly to the root of a device.  When  creat‐\ning  a  qdisc or a filter, it can be named with the handle parameter. A class is named\nwith the classid parameter.\n\n\ndelete A qdisc can be deleted by specifying its handle, which may also be  'root'.  All  sub‐\nclasses  and  their  leaf qdiscs are automatically deleted, as well as any filters at‐\ntached to them.\n\n\nchange Some entities can be modified 'in place'. Shares the syntax of 'add', with the  excep‐\ntion  that  the  handle  cannot be changed and neither can the parent. In other words,\nchange cannot move a node.\n\n\nreplace\nPerforms a nearly atomic remove/add on an existing node id. If the node does not exist\nyet it is created.\n\n\nget    Displays a single filter given the interface DEV,  qdisc-id,  priority,  protocol  and\nfilter-id.\n\n\nshow   Displays  all  filters  attached  to  the  given  interface. A valid parent ID must be\npassed.\n\n\nlink   Only available for qdiscs and performs a replace where the node must exist already.\n\n",
                "subsections": []
            },
            "MONITOR": {
                "content": "The tc utility can monitor events generated by the kernel  such  as  adding/deleting  qdiscs,\nfilters or actions, or modifying existing ones.\n\nThe following command is available for monitor :\n\nfile   If  the  file  option is given, the tc does not listen to kernel events, but opens the\ngiven file and dumps its contents. The file has to be in  binary  format  and  contain\nnetlink messages.\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-b -b filename -batch -batch filename",
                        "content": "read  commands  from  provided  file or standard input and invoke them.  First failure\nwill cause termination of tc.\n\n",
                        "flag": "-b"
                    },
                    {
                        "name": "-force",
                        "content": "of the commands, the application return code will be non zero.\n\n"
                    },
                    {
                        "name": "-o -oneline",
                        "content": "output each record on a single line, replacing line feeds with the '\\' character. This\nis convenient when you want to count records with wc(1) or to grep(1) the output.\n\n",
                        "flag": "-o"
                    },
                    {
                        "name": "-n -net -netns",
                        "content": "switches tc to the specified network namespace NETNS.  Actually it just simplifies ex‐\necuting of:\n\nip netns exec NETNS tc [ OPTIONS ] OBJECT { COMMAND | help }\n\nto\n\ntc -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }\n\n",
                        "flag": "-n"
                    },
                    {
                        "name": "-N -Numeric",
                        "content": "Print the number of protocol, scope, dsfield, etc directly instead of converting it to\nhuman readable name.\n\n",
                        "flag": "-N"
                    },
                    {
                        "name": "-cf -conf",
                        "content": "specifies path to the config file. This option is used in conjunction with  other  op‐\ntions (e.g.  -nm).\n\n"
                    },
                    {
                        "name": "-t -timestamp",
                        "content": "When tc monitor runs, print timestamp before the event message in format:\nTimestamp: <Day> <Month> <DD> <hh:mm:ss> <YYYY> <usecs> usec\n\n",
                        "flag": "-t"
                    },
                    {
                        "name": "-ts -tshort",
                        "content": "When tc monitor runs, prints short timestamp before the event message in format:\n[<YYYY>-<MM>-<DD>T<hh:mm:ss>.<ms>]\n\n"
                    }
                ]
            },
            "FORMAT": {
                "content": "The show command has additional formatting options:\n\n",
                "subsections": [
                    {
                        "name": "-s -stats -statistics",
                        "content": "output more statistics about packet usage.\n\n",
                        "flag": "-s"
                    },
                    {
                        "name": "-d -details",
                        "content": "output more detailed information about rates and cell sizes.\n\n",
                        "flag": "-d"
                    },
                    {
                        "name": "-r -raw",
                        "content": "output raw hex values for handles.\n\n",
                        "flag": "-r"
                    },
                    {
                        "name": "-p -pretty",
                        "content": "for  u32  filter, decode offset and mask values to equivalent filter commands based on\nTCP/IP.  In JSON output, add whitespace to improve readability.\n\n",
                        "flag": "-p"
                    },
                    {
                        "name": "-iec",
                        "content": ""
                    },
                    {
                        "name": "-g -graph",
                        "content": "shows classes as ASCII graph. Prints generic stats info under each class if -s  option\nwas specified. Classes can be filtered only by dev option.\n\n",
                        "flag": "-g"
                    },
                    {
                        "name": "-c",
                        "content": "Configure color output. If parameter is omitted or always, color output is enabled re‐\ngardless of stdout state. If parameter is auto, stdout is checked to be a terminal be‐\nfore enabling color output. If parameter is never, color output is disabled. If speci‐\nfied  multiple  times, the last one takes precedence. This flag is ignored if -json is\nalso given.\n\n",
                        "flag": "-c"
                    },
                    {
                        "name": "-j -json",
                        "content": "Display results in JSON format.\n\n",
                        "flag": "-j"
                    },
                    {
                        "name": "-nm -name",
                        "content": "resolve class name from /etc/iproute2/tccls file or from file specified  by  -cf  op‐\ntion. This file is just a mapping of classid to class name:\n\n# Here is comment\n1:40   voip # Here is another comment\n1:50   web\n1:60   ftp\n1:2    home\n\ntc will not fail if -nm was specified without -cf option but /etc/iproute2/tccls file\ndoes not exist, which makes it possible to pass -nm option for creating tc alias.\n\n"
                    },
                    {
                        "name": "-br -brief",
                        "content": "Print  only  essential  data needed to identify the filter and action (handle, cookie,\netc.) and stats. This option is currently only supported by tc filter show and tc  ac‐\ntions ls commands.\n\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "tc -g class show dev eth0\nShows classes as ASCII graph on eth0 interface.\n\ntc -g -s class show dev eth0\nShows classes as ASCII graph with stats info under each class.\n\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "tc was written by Alexey N. Kuznetsov and added in Linux 2.2.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "tc-basic(8),  tc-bfifo(8),  tc-bpf(8),  tc-cake(8), tc-cbq(8), tc-cgroup(8), tc-choke(8), tc-\ncodel(8),  tc-drr(8),  tc-ematch(8),  tc-ets(8),  tc-flow(8),  tc-flower(8),  tc-fq(8),   tc-\nfqcodel(8),  tc-fqpie(8),  tc-fw(8),  tc-hfsc(7),  tc-hfsc(8), tc-htb(8), tc-mqprio(8), tc-\npfifo(8), tc-pfifofast(8), tc-pie(8),  tc-red(8),  tc-route(8),  tc-sfb(8),  tc-sfq(8),  tc-\nstab(8), tc-tbf(8), tc-tcindex(8), tc-u32(8),\nUser  documentation  at http://lartc.org/, but please direct bugreports and patches to: <net‐",
                "subsections": [
                    {
                        "name": "dev@vger.kernel.org>",
                        "content": ""
                    }
                ]
            },
            "AUTHOR": {
                "content": "Manpage maintained by bert hubert (ahu@ds9a.nl)\n\niproute2                                  16 December 2001                                     TC(8)",
                "subsections": []
            }
        }
    }
}