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 iniptables
. (any other tables are not affected).
4.2.1. tcdel
command help¶
usage: tcdel [-h] [-V] [--tc-command | --tc-script] [--debug | --quiet] [--debug-query] [--stacktrace] [-a] [--id FILTER_ID] [--direction {outgoing,incoming}] [--network DST_NETWORK] [--src-network SRC_NETWORK]
[--port DST_PORT] [--src-port SRC_PORT] [--ipv6] [--docker] [--src-container SRC_CONTAINER] [--dst-container DST_CONTAINER]
device
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--tc-command display tc commands to be executed and exit. these commands are not actually executed.
--tc-script generate a shell script file that describes tc commands. this tc script execution results are nearly equivalent to the tcconfig command. the script can be executed without tcconfig package
installation.
--debug for debug print.
--quiet suppress execution log messages.
Debug:
--debug-query for debug print.
--stacktrace print stack trace for debugging information. --debug option is required to see the debug print.
Traffic Control:
device network device name (e.g. eth0)
-a, --all delete all of the shaping rules.
--id FILTER_ID delete a shaping rule that 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 imposes traffic control. 'incoming' requires ifb kernel module and Linux kernel 2.6.20 or later. (default = outgoing)
--network DST_NETWORK, --dst-network DST_NETWORK
specify destination IP-address/network that applies traffic control. defaults to any.
--src-network SRC_NETWORK
specify a source IP-address/network that applies traffic control. defaults to any. this option has no effect when executing with "--direction incoming" option. note: this option is required to
execute with the --iptables option when using tbf algorithm.
--port DST_PORT, --dst-port DST_PORT
specify a destination port number that applies traffic control. defaults to any.
--src-port SRC_PORT specify a source port number that applies traffic control. defaults to any.
--ipv6 apply traffic control to IPv6 packets rather than IPv4.
Docker:
--docker apply traffic control to a docker container. to use this option, you will need to specify a container id as 'device' as follows: tcset --container <container id>
--src-container SRC_CONTAINER
specify source container id or name.
--dst-container DST_CONTAINER
specify destination container id or name.
Documentation: https://tcconfig.rtfd.io/
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 eth0 --all
4.2.2. Advanced usage¶
You can delete a specific shaping rule by either network specifier or filter_id
.
# tcset eth0 --delay 10ms --rate 10Kbps --network 192.168.1.2 --overwrite
# tcset eth0 --delay 100ms --rate 50Kbps --network 192.168.1.3 --add
# tcset eth0 --delay 200ms --rate 100Kbps --network 192.168.0.0/24 --add
# tcshow eth0
{
"eth0": {
"outgoing": {
"dst-network=192.168.1.2/32, protocol=ip": {
"filter_id": "800::800",
"delay": "10.0ms",
"rate": "10Kbps"
},
"dst-network=192.168.1.3/32, protocol=ip": {
"filter_id": "800::801",
"delay": "100.0ms",
"rate": "50Kbps"
},
"dst-network=192.168.0.0/24, protocol=ip": {
"filter_id": "800::802",
"delay": "200.0ms",
"rate": "100Kbps"
}
},
"incoming": {}
}
}
e.g. Delete a shaping rule with network specifier:
# tcdel eth0 --dst-network 192.168.1.2
# tcshow eth0
{
"eth0": {
"outgoing": {
"dst-network=192.168.1.3/32, protocol=ip": {
"filter_id": "800::801",
"delay": "100.0ms",
"rate": "50Kbps"
},
"dst-network=192.168.0.0/24, protocol=ip": {
"filter_id": "800::802",
"delay": "200.0ms",
"rate": "100Kbps"
}
},
"incoming": {}
}
}
e.g. Delete a shaping rule with filter id:
# tcdel eth0 --id 800::801
# tcshow eth0
{
"eth0": {
"outgoing": {
"dst-network=192.168.0.0/24, protocol=ip": {
"filter_id": "800::802",
"delay": "200.0ms",
"rate": "100Kbps"
}
},
"incoming": {}
}
}