LoginSignup
0
0

Raspberry Piでネットワーク帯域制御「tcconfig」のインストール方法

Posted at

Pythonのpip ver 23.0からPEP668対応で従来のインストール方法では不具合がある様子です。
当方で動作した方法を紹介します。

動作環境

Raspberry Pi 4 (4GBモデル)

Raspberry Pi OS with desktop 64bit (2023-10-10)

pi@raspberrypi:~ $ python -V
Python 3.11.2

pi@raspberrypi:~ $ pip -V
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)

tcconfigインストール方法

$ sudo apt install pipx
$ pipx install tcconfig
  installed package tcconfig 0.28.0, installed using Python 3.11.2
  These apps are now globally available
    - tcdel
    - tcset
    - tcshow
??  Note: '/home/pi/.local/bin' is not on your PATH environment variable. These apps will not be globally accessible until
    your PATH is updated. Run `pipx ensurepath` to automatically add it, or manually modify your PATH in your shell's config file
    (i.e. ~/.bashrc).
done! ? ?? ?

ユーザーローカル環境にインストールされます。

pi@raspberrypi:~ $ ls .local/bin -l
total 0
lrwxrwxrwx 1 pi pi 49 Dec  4 05:35 tcdel -> /home/pi/.local/pipx/venvs/tcconfig/bin/tcdel
lrwxrwxrwx 1 pi pi 49 Dec  4 05:35 tcset -> /home/pi/.local/pipx/venvs/tcconfig/bin/tcset
lrwxrwxrwx 1 pi pi 50 Dec  4 05:35 tcshow -> /home/pi/.local/pipx/venvs/tcconfig/bin/tcshow

コマンド実行例

設定変更する際にはsudoコマンドで管理者root権限が必要です。

tcshow(設定確認)

pi@raspberrypi:~ $ .local/bin/tcshow eth0
{
    "eth0": {
        "outgoing": {},
        "incoming": {}
    }
}

tcset(設定変更)

pi@raspberrypi:~ $ sudo .local/bin/tcset --device eth0 --delay 10
pi@raspberrypi:~ $ .local/bin/tcshow eth0
{
    "eth0": {
        "outgoing": {
            "protocol=ip": {
                "filter_id": "800::800",
                "delay": "10ms",
                "rate": "1Gbps"
            }
        },
        "incoming": {}
    }
}

tcdel(設定削除)

pi@raspberrypi:~ $ sudo .local/bin/tcdel eth0 -a
[INFO] delete eth0 qdisc
[INFO] no qdisc to delete for the incoming device.
[INFO] delete eth0 ingress qdisc
pi@raspberrypi:~ $ .local/bin/tcshow eth0
{
    "eth0": {
        "outgoing": {},
        "incoming": {}
    }
}

参考情報

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0