Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
tcconfig — tc コマンドラッパー。ネットワーク帯域幅/遅延/パケットロス/パケット破損などのトラフィック制御を、ネットワークインターフェースや Docker コンテナ(veth)に簡単に設定できるようにします。 | Kitploit
ツール/GitHubGitHub/thombashi/tcconfig
汎用ユーティリティネットワークセキュリティカオスエンジニアリング
GitHubthombashi/tcconfig

tcconfig

tc コマンドラッパー。ネットワーク帯域幅/遅延/パケットロス/パケット破損などのトラフィック制御を、ネットワークインターフェースや Docker コンテナ(veth)に簡単に設定できるようにします。

リポジトリを見るウェブサイト
853904ヶ月前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

.. contents:: tcconfig :backlinks: top :depth: 2

概要

tcconfig <https://github.com/thombashi/tcconfig>__ は tc コマンドのラッパーです。ネットワークインターフェースや Docker コンテナ(veth)に対する帯域幅・レイテンシ・パケットロス・パケット破損などのトラフィック制御を簡単に設定できるようにします。

|PyPI pkg ver| |Supported Python ver| |CI status| |CodeQL|

.. |PyPI pkg ver| image:: https://badge.fury.io/py/tcconfig.svg :target: https://badge.fury.io/py/tcconfig :alt: PyPI パッケージバージョン

.. |Supported Python ver| image:: https://img.shields.io/pypi/pyversions/tcconfig.svg :target: https://pypi.org/project/tcconfig :alt: 対応 Python バージョン

.. |CI status| image:: https://github.com/thombashi/tcconfig/actions/workflows/ci.yml/badge.svg :target: https://github.com/thombashi/tcconfig/actions/workflows/ci.yml :alt: テスト CI ステータス

.. |CodeQL| image:: https://github.com/thombashi/tcconfig/actions/workflows/build_and_release.yml/badge.svg :target: https://github.com/thombashi/tcconfig/actions/workflows/build_and_release.yml :alt: ビルド CI ステータス

トラフィック制御

トラフィックシェイピングルールの設定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 特定のネットワークに対するトラフィックシェイピングルールを簡単に適用できます:

  • 送信/受信パケット
  • 送信元/宛先 IP アドレス/ネットワーク(IPv4/IPv6)
  • 送信元/宛先ポート

利用可能なパラメーター ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ネットワークインターフェースには以下のパラメーターを設定できます:

  • ネットワーク帯域幅レート [G/M/K bps]
  • ネットワークレイテンシ [マイクロ秒/ミリ秒/秒/分]
  • パケットロス率 [%]
  • パケット破損率 [%]
  • パケット重複率 [%]
  • パケット並べ替え率 [%]
  • パケット制限数 [COUNT]

対象 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  • ネットワークインターフェース:例 eth0
  • Docker コンテナ(コンテナに対応する veth)

.. image:: docs/gif/tcset_example.gif

使用方法

トラフィック制御の設定(tcset コマンド)

tcset はネットワークインターフェース(デバイス)にトラフィック制御ルールを追加するコマンドです。

例:帯域幅を 100Kbps に制限する ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console

root@kitploit:~
# tcset eth0 --rate 100Kbps

例:ネットワークレイテンシを設定する ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 遅延時間の指定には時間単位(us/sec/min など)を使用できます。

100 ミリ秒のネットワークレイテンシを設定 ''''''''''''''''''''''''''''''''''''''''''''''''''' .. code-block:: console

root@kitploit:~
# tcset eth0 --delay 100ms

10 秒のネットワークレイテンシを設定 ''''''''''''''''''''''''''''''''''''''''''''''''''' .. code-block:: console

root@kitploit:~
# tcset eth0 --delay 10sec

0.5 分(30 秒)のネットワークレイテンシを設定 ''''''''''''''''''''''''''''''''''''''''''''''''''' .. code-block:: console

root@kitploit:~
# tcset eth0 --delay 0.5min

以下の時間単位も使用できます:

.. table::

root@kitploit:~
+------------+----------------------------------------------------------+
|    単位    |                利用可能な指定子(文字列)                 |
+============+==========================================================+
|時間        |``h``/``hour``/``hours``                                  |
+------------+----------------------------------------------------------+
|分          |``m``/``min``/``mins``/``minute``/``minutes``             |
+------------+----------------------------------------------------------+
|秒          |``s``/``sec``/``secs``/``second``/``seconds``             |
+------------+----------------------------------------------------------+
|ミリ秒      |``ms``/``msec``/``msecs``/``millisecond``/``milliseconds``|
+------------+----------------------------------------------------------+
|マイクロ秒  |``us``/``usec``/``usecs``/``microsecond``/``microseconds``|
+------------+----------------------------------------------------------+

例:0.1% のパケットロスを設定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console

root@kitploit:~
# tcset eth0 --loss 0.1%

例:上記のすべての設定を一度に行う ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console

root@kitploit:~
# tcset eth0 --rate 100Kbps --delay 100ms --loss 0.1%

例:トラフィック制御の IP アドレスを指定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console

root@kitploit:~
# tcset eth0 --delay 100ms --network 192.168.0.10

例:トラフィック制御の IP ネットワークとポートを指定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: console

root@kitploit:~
# tcset eth0 --delay 100ms --network 192.168.0.0/24 --port 80

Docker コンテナにトラフィック制御を設定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Docker ホスト上で --docker オプションを付けて tcconfig を実行します:

.. code-block:: console

root@kitploit:~
# tcset <コンテナ名または ID> --docker ...

--src-container/--dst-container オプションを使用して、送信元/宛先コンテナを指定することもできます。

Docker コンテナ内でトラフィック制御を設定 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ コンテナ内で tc ルールを設定するには、コンテナを --cap-add NET_ADMIN オプション付きで実行する必要があります:

.. code-block:: console

root@kitploit:~
docker run -d --cap-add NET_ADMIN -t <docker イメージ>

tcconfig が組み込まれたコンテナイメージは https://hub.docker.com/r/thombashi/tcconfig/ で入手できます。

トラフィック制御の削除(tcdel コマンド)

tcdel はネットワークインターフェース(デバイス)からトラフィックシェイピングルールを削除するコマンドです。

例:eth0 のトラフィック制御を削除 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -a/--all オプションを使用して、eth0 のすべてのシェイピングルールを削除できます:

.. code-block:: console

root@kitploit:~
# tcdel eth0 --all

トラフィック制御設定の表示(tcshow コマンド)

tcshow はネットワークインターフェースの現在のトラフィック制御設定を表示するコマンドです。

例 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: console

root@kitploit:~
# tcset eth0 --delay 10ms --delay-distro 2  --loss 0.01% --rate 0.25Mbps --network 192.168.0.10 --port 8080
# tcset eth0 --delay 1ms --loss 0.02% --rate 500Kbps --direction incoming
# tcshow eth0
{
    "eth0": {
        "outgoing": {
            "dst-network=192.168.0.10/32, dst-port=8080, protocol=ip": {
                "filter_id": "800::800",
                "delay": "10.0ms",
                "delay-distro": "2.0ms",
                "loss": "0.01%",
                "rate": "250Kbps"
            }
        },
        "incoming": {
            "protocol=ip": {
                "filter_id": "800::800",
                "delay": "1.0ms",
                "loss": "0.02%",
                "rate": "500Kbps"
            }
        }
    }
}

詳細情報

より多くの例は以下で入手可能です: https://tcconfig.rtfd.io/en/latest/pages/usage/index.html

インストール

pip でのインストール

tcconfig は PyPI <https://pypi.python.org/pypi>__ から pip <https://pip.pypa.io/en/stable/installing/>__ (Python パッケージマネージャー)コマンドでインストールできます。

.. code:: console

root@kitploit:~
sudo pip install tcconfig

dpkg でのインストール(Debian/Ubuntu)

.. code:: console

root@kitploit:~
curl -sSL https://raw.githubusercontent.com/thombashi/tcconfig/master/scripts/installer.sh | sudo bash

依存関係

  • Python 3.9+
  • Python パッケージの依存関係(自動インストール) <https://github.com/thombashi/tcconfig/network/dependencies>__

Linux パッケージ

  • 必須: tc コマンドに必要:
    • Ubuntu/Debian: iproute2
    • Fedora/RHEL: iproute-tc
  • オプション: --iptables オプションを使用する場合に必要:
    • iptables

Linux カーネルモジュール

  • sch_netem

オプションの Python パッケージ

  • Pygments <http://pygments.org/>__

ドキュメント

https://tcconfig.rtfd.io/

トラブルシューティング

https://tcconfig.rtfd.io/en/latest/pages/troubleshooting.html

Docker イメージ

https://hub.docker.com/r/thombashi/tcconfig/

スポンサー

|chasbecker| |shiguredo| |b4tman| |Arturi0| |github|

.. |chasbecker| image:: https://avatars.githubusercontent.com/u/44389260?s=48&u=6da7176e51ae2654bcfd22564772ef8a3bb22318&v=4 :target: https://github.com/chasbecker :alt: 旧スポンサー: Charles Becker (chasbecker) .. |shiguredo| image:: https://avatars.githubusercontent.com/u/2549434?s=48&v=4 :target: https://github.com/shiguredo :alt: 旧スポンサー: 時雨堂 (shiguredo) .. |b4tman| image:: https://avatars.githubusercontent.com/u/3658062?s=48&v=4 :target: https://github.com/b4tman :alt: 一時スポンサー: Dmitry Belyaev (b4tman) .. |Arturi0| image:: https://avatars.githubusercontent.com/u/46711571?s=48&u=57687c0e02d5d6e8eeaf9177f7b7af4c9f275eb5&v=4 :target: https://github.com/Arturi0 :alt: 一時スポンサー: Arturi0 .. |github| image:: https://avatars.githubusercontent.com/u/9919?s=48&v=4 :target: https://github.com/github :alt: 一時スポンサー: GitHub (github)

スポンサーになる <https://github.com/sponsors/thombashi>__

ツールをダウンロード