{"id":13586368,"url":"https://github.com/thombashi/tcconfig","last_synced_at":"2025-05-14T21:05:25.570Z","repository":{"id":45476345,"uuid":"49825187","full_name":"thombashi/tcconfig","owner":"thombashi","description":"A tc command wrapper. Make it easy to set up traffic control of network bandwidth/latency/packet-loss/packet-corruption/etc. to a network-interface/Docker-container(veth).","archived":false,"fork":false,"pushed_at":"2024-08-17T10:01:54.000Z","size":1499,"stargazers_count":792,"open_issues_count":23,"forks_count":84,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-10-29T15:12:46.390Z","etag":null,"topics":["cli-app","docker","linux","network","tc","traffic-shaping","wrapper"],"latest_commit_sha":null,"homepage":"https://tcconfig.rtfd.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thombashi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"thombashi","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-01-17T16:24:09.000Z","updated_at":"2024-10-22T05:23:41.000Z","dependencies_parsed_at":"2024-01-07T04:04:40.214Z","dependency_job_id":"f21aca2b-9d32-4cc3-a438-1fdd66f95388","html_url":"https://github.com/thombashi/tcconfig","commit_stats":{"total_commits":1595,"total_committers":16,"mean_commits":99.6875,"dds":0.4150470219435737,"last_synced_commit":"cc0a851e5c870a556c69695443dba4f207aaf50b"},"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2Ftcconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2Ftcconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2Ftcconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thombashi%2Ftcconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thombashi","download_url":"https://codeload.github.com/thombashi/tcconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378134,"owners_count":20929296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-app","docker","linux","network","tc","traffic-shaping","wrapper"],"created_at":"2024-08-01T15:05:30.907Z","updated_at":"2025-05-14T21:05:25.520Z","avatar_url":"https://github.com/thombashi.png","language":"Python","funding_links":["https://github.com/sponsors/thombashi"],"categories":["Python","network"],"sub_categories":[],"readme":".. contents:: **tcconfig**\n   :backlinks: top\n   :depth: 2\n\nSummary\n=========\n`tcconfig \u003chttps://github.com/thombashi/tcconfig\u003e`__ is a tc command wrapper. Make it easy to set up traffic control of network bandwidth/latency/packet-loss/packet-corruption/etc. to a network-interface/Docker-container(veth).\n\n|PyPI pkg ver| |Supported Python ver| |CI status| |CodeQL|\n\n.. |PyPI pkg ver| image:: https://badge.fury.io/py/tcconfig.svg\n    :target: https://badge.fury.io/py/tcconfig\n    :alt: PyPI package version\n\n.. |Supported Python ver| image:: https://img.shields.io/pypi/pyversions/tcconfig.svg\n    :target: https://pypi.org/project/tcconfig\n    :alt: Supported Python versions\n\n.. |CI status| image:: https://github.com/thombashi/tcconfig/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/thombashi/tcconfig/actions/workflows/ci.yml\n    :alt: Test CI status\n\n.. |CodeQL| image:: https://github.com/thombashi/tcconfig/actions/workflows/build_and_release.yml/badge.svg\n   :target: https://github.com/thombashi/tcconfig/actions/workflows/build_and_release.yml\n   :alt: Build CI status\n\nTraffic control\n------------------------\n\nSetup traffic shaping rules\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nEasy to apply traffic shaping rules to specific networks:\n\n- Outgoing/Incoming packets\n- Source/Destination IP-address/network (IPv4/IPv6)\n- Source/Destination ports\n\nAvailable Parameters\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nThe following parameters can be set to network interfaces:\n\n- Network bandwidth rate ``[G/M/K bps]``\n- Network latency ``[microseconds/milliseconds/seconds/minutes]``\n- Packet loss rate ``[%]``\n- Packet corruption rate ``[%]``\n- Packet duplicate rate ``[%]``\n- Packet reordering rate  ``[%]``\n- Packet limit count  ``[COUNT]``\n\nTargets\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n- Network interfaces: e.g. ``eth0``\n- Docker container (``veth`` corresponding with a container)\n\n.. image:: docs/gif/tcset_example.gif\n\nUsage\n=======\nSet traffic control (``tcset`` command)\n-----------------------------------------\n``tcset`` is a command to add a traffic control rule to a network interface (device).\n\ne.g. Set a limit on bandwidth up to 100Kbps\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    # tcset eth0 --rate 100Kbps\n\ne.g. Set network latency\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nYou can use time units (such as us/sec/min/etc.) to designate delay time.\n\nSet 100 milliseconds of network latency\n'''''''''''''''''''''''''''''''''''''''''''''''''''\n.. code-block:: console\n\n    # tcset eth0 --delay 100ms\n\n\nSet 10 seconds of network latency\n'''''''''''''''''''''''''''''''''''''''''''''''''''\n.. code-block:: console\n\n    # tcset eth0 --delay 10sec\n\nSet 0.5 minutes (30 seconds) network latency\n'''''''''''''''''''''''''''''''''''''''''''''''''''\n.. code-block:: console\n\n    # tcset eth0 --delay 0.5min\n\nYou can also use the following time units:\n\n.. table::\n\n    +------------+----------------------------------------------------------+\n    |    Unit    |                Available specifiers (str)                |\n    +============+==========================================================+\n    |hours       |``h``/``hour``/``hours``                                  |\n    +------------+----------------------------------------------------------+\n    |minutes     |``m``/``min``/``mins``/``minute``/``minutes``             |\n    +------------+----------------------------------------------------------+\n    |seconds     |``s``/``sec``/``secs``/``second``/``seconds``             |\n    +------------+----------------------------------------------------------+\n    |milliseconds|``ms``/``msec``/``msecs``/``millisecond``/``milliseconds``|\n    +------------+----------------------------------------------------------+\n    |microseconds|``us``/``usec``/``usecs``/``microsecond``/``microseconds``|\n    +------------+----------------------------------------------------------+\n\ne.g. Set 0.1% packet loss\n^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    # tcset eth0 --loss 0.1%\n\ne.g. All of the above settings at once\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    # tcset eth0 --rate 100Kbps --delay 100ms --loss 0.1%\n\ne.g. Specify the IP address of the traffic control\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    # tcset eth0 --delay 100ms --network 192.168.0.10\n\ne.g. Specify the IP network and port of traffic control\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n.. code-block:: console\n\n    # tcset eth0 --delay 100ms --network 192.168.0.0/24 --port 80\n\nSet traffic control to a docker container\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nExecute ``tcconfig`` with ``--docker`` option on a Docker host:\n\n.. code-block:: console\n\n    # tcset \u003ccontainer name or ID\u003e --docker ...\n\nYou could use ``--src-container``/``--dst-container`` options to specify the source/destination container.\n\n\nSet traffic control within a docker container\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nYou need to run a container with ``--cap-add NET_ADMIN`` option\nif you would like to set a tc rule within a container:\n\n.. code-block:: console\n\n    docker run -d --cap-add NET_ADMIN -t \u003cdocker image\u003e\n\nA container image that builtin tcconfig can be available at https://hub.docker.com/r/thombashi/tcconfig/\n\nDelete traffic control (``tcdel`` command)\n------------------------------------------\n``tcdel`` is a command to delete traffic shaping rules from a network interface (device).\n\ne.g. Delete traffic control of ``eth0``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nYou can delete all of the shaping rules for the ``eth0`` with ``-a``/``--all`` option:\n\n.. code-block:: console\n\n    # tcdel eth0 --all\n\nDisplay traffic control configurations (``tcshow`` command)\n-----------------------------------------------------------\n``tcshow`` is a command to display the current traffic control settings for network interface(s).\n\nExample\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: console\n\n    # tcset eth0 --delay 10ms --delay-distro 2  --loss 0.01% --rate 0.25Mbps --network 192.168.0.10 --port 8080\n    # tcset eth0 --delay 1ms --loss 0.02% --rate 500Kbps --direction incoming\n    # tcshow eth0\n    {\n        \"eth0\": {\n            \"outgoing\": {\n                \"dst-network=192.168.0.10/32, dst-port=8080, protocol=ip\": {\n                    \"filter_id\": \"800::800\",\n                    \"delay\": \"10.0ms\",\n                    \"delay-distro\": \"2.0ms\",\n                    \"loss\": \"0.01%\",\n                    \"rate\": \"250Kbps\"\n                }\n            },\n            \"incoming\": {\n                \"protocol=ip\": {\n                    \"filter_id\": \"800::800\",\n                    \"delay\": \"1.0ms\",\n                    \"loss\": \"0.02%\",\n                    \"rate\": \"500Kbps\"\n                }\n            }\n        }\n    }\n\nFor more information\n----------------------\nMore examples are available at \nhttps://tcconfig.rtfd.io/en/latest/pages/usage/index.html\n\n\n\nInstallation\n============\nInstallation: pip\n------------------------------\n``tcconfig`` can be installed from `PyPI \u003chttps://pypi.python.org/pypi\u003e`__ via\n`pip \u003chttps://pip.pypa.io/en/stable/installing/\u003e`__ (Python package manager) command.\n\n.. code:: console\n\n    sudo pip install tcconfig\n\n\nInstallation: dpkg (Debian/Ubuntu)\n--------------------------------------------\n.. code:: console\n\n    curl -sSL https://raw.githubusercontent.com/thombashi/tcconfig/master/scripts/installer.sh | sudo bash\n\n\nDependencies\n============\n- Python 3.9+\n- `Python package dependencies (automatically installed) \u003chttps://github.com/thombashi/tcconfig/network/dependencies\u003e`__\n\nLinux packages\n--------------\n- mandatory: required for ``tc`` command:\n    - `Ubuntu`/`Debian`: ``iproute2``\n    - `Fedora`/`RHEL`: ``iproute-tc``\n- optional: required when you use the ``--iptables`` option:\n    - ``iptables``\n\nLinux kernel module\n----------------------------\n- ``sch_netem``\n\nOptional Python packages\n----------------------------\n- `Pygments \u003chttp://pygments.org/\u003e`__\n\nDocumentation\n===============\nhttps://tcconfig.rtfd.io/\n\nTroubleshooting\n=================\nhttps://tcconfig.rtfd.io/en/latest/pages/troubleshooting.html\n\nDocker image\n==============\nhttps://hub.docker.com/r/thombashi/tcconfig/\n\nSponsors\n====================================\n|chasbecker| |shiguredo| |b4tman| |Arturi0| |github|\n\n.. |chasbecker| image:: https://avatars.githubusercontent.com/u/44389260?s=48\u0026u=6da7176e51ae2654bcfd22564772ef8a3bb22318\u0026v=4\n   :target: https://github.com/chasbecker\n   :alt: ex-sponsor: Charles Becker (chasbecker)\n.. |shiguredo| image:: https://avatars.githubusercontent.com/u/2549434?s=48\u0026v=4\n   :target: https://github.com/shiguredo\n   :alt: ex-sponsor: 時雨堂 (shiguredo)\n.. |b4tman| image:: https://avatars.githubusercontent.com/u/3658062?s=48\u0026v=4\n   :target: https://github.com/b4tman\n   :alt: onetime: Dmitry Belyaev (b4tman)\n.. |Arturi0| image:: https://avatars.githubusercontent.com/u/46711571?s=48\u0026u=57687c0e02d5d6e8eeaf9177f7b7af4c9f275eb5\u0026v=4\n   :target: https://github.com/Arturi0\n   :alt: onetime: Arturi0\n.. |github| image:: https://avatars.githubusercontent.com/u/9919?s=48\u0026v=4\n   :target: https://github.com/github\n   :alt: onetime: GitHub (github)\n\n`Become a sponsor \u003chttps://github.com/sponsors/thombashi\u003e`__\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthombashi%2Ftcconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthombashi%2Ftcconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthombashi%2Ftcconfig/lists"}