4.2. Delete traffic control (tcdel command)

tcdel is a command to delete traffic shaping rules from a network interface (device).

Note

tcdel delete mangle tables in iptables. (any other tables are not affected).

4.2.1. tcdel command help

usage: tcdel [-h] [--version] [--tc-command | --tc-script] [--debug | --quiet]
             [--stacktrace] -d DEVICE [-a] [--id FILTER_ID]
             [--direction {outgoing,incoming}] [--network DST_NETWORK]
             [--src-network SRC_NETWORK] [--port DST_PORT]
             [--src-port SRC_PORT] [--ipv6]

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --tc-command          display tc commands to be executed and exit. these
                        commands are not executed.
  --tc-script           generate a script file that described tc commands
                        which equivalent with execution tcconfig command. the
                        script can be execute without tcconfig package
                        installation.
  --debug               for debug print.
  --quiet               suppress execution log messages.

Debug:
  --stacktrace          print stack trace for debug information. --debug
                        option required to see the debug print.

Traffic Control:
  -d DEVICE, --device DEVICE
                        network device name (e.g. eth0)
  -a, --all             delete all of the shaping rules.
  --id FILTER_ID        delete a shaping rule which has a specific id. you can
                        get an id (filter_id) by tcshow command output. e.g.
                        "filter_id": "800::801"

Routing:
  --direction {outgoing,incoming}
                        the direction of network communication that impose
                        traffic control. 'incoming' requires Linux kernel
                        version 2.6.20 or later. (default = outgoing)
  --network DST_NETWORK, --dst-network DST_NETWORK
                        target IP-address/network to control traffic
  --src-network SRC_NETWORK
                        set a traffic shaping rule to specific packets that
                        routed from --src-network to --dst-network. this
                        option required to execute with the --iptables option
                        when you use tbf. the shaping rule only affect to
                        outgoing packets (no effect to if you execute with "--
                        direction incoming" option)
  --port DST_PORT, --dst-port DST_PORT
                        target destination port number to control traffic.
  --src-port SRC_PORT   target source port number to control traffic.
  --ipv6                apply traffic control to IPv6 packets rather than
                        IPv4.

Issue tracker: https://github.com/thombashi/tcconfig/issues

4.2.1.1. e.g. Delete traffic control of eth0

You can delete all of the shaping rules for the eth0 with -a/--all option:

# tcdel --device eth0 --all

4.2.2. Advanced usage

You can delete a specific shaping rule by either network specifier or filter_id.

# tcset --device ens33 --delay 10 --rate 10k --network 192.168.1.2 --overwrite
# tcset --device ens33 --delay 100 --rate 50k --network 192.168.1.3 --add
# tcset --device ens33 --delay 200 --rate 100k --network 192.168.0.0/24 --add
# tcshow -d ens33
{
    "ens33": {
        "outgoing": {
            "dst-network=192.168.1.2/32, protocol=ip": {
                "delay": 10,
                "rate": "10K",
                "filter_id": "800::800"
            },
            "dst-network=192.168.0.0/24, protocol=ip": {
                "delay": 200,
                "rate": "100K",
                "filter_id": "800::802"
            },
            "dst-network=192.168.1.3/32, protocol=ip": {
                "delay": 100,
                "rate": "50K",
                "filter_id": "800::801"
            }
        },
        "incoming": {}
    }
}

e.g. Delete a shaping rule with network specifier:

# tcdel --device ens33 --dst-network 192.168.1.2
# tcshow -d ens33
{
    "ens33": {
        "outgoing": {
            "dst-network=192.168.0.0/24, protocol=ip": {
                "delay": 200,
                "rate": "100K",
                "filter_id": "800::802"
            },
            "dst-network=192.168.1.3/32, protocol=ip": {
                "delay": 100,
                "rate": "50K",
                "filter_id": "800::801"
            }
        },
        "incoming": {}
    }
}

e.g. Delete a shaping rule with filter id:

# tcdel --device ens33 --id 800::801
# tcshow -d ens33
{
    "ens33": {
        "outgoing": {
            "dst-network=192.168.0.0/24, protocol=ip": {
                "delay": 200,
                "rate": "100K",
                "filter_id": "800::802"
            }
        },
        "incoming": {}
    }
}