[Raspberry Pi] tcconfig でネットワーク帯域制限

Raspberry Pi でネットワーク帯域制限をしたくなった。tcconfig というツールを使えば簡単にできる。今回は tcconfig をインストールした Raspberry Pi そのものの帯域制限をしてみた。

GitHub - thombashi/tcconfig: 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).
https://github.com/thombashi/tcconfig

環境:Raspberry Pi 4 Model B 4GB(bullseye 32bit)

以下のコマンドでインストールできる。

$ sudo pip install tcconfig

試しに 1 Mbps に制限してみる。

$ sudo tcset wlan0 --rate 1Mbps

前回インストールした Speedtest CLI を使って計測すると、tcconfig 前後で以下のようになった。

使用前:
Download 62.06 Mbps
Upload 74.63 Mbps

使用後:
Download 54.49 Mbps
Upload 0.88 Mbps

確かに上りが 1 Mpbs 以下になっている。

下りも 1 Mpbs に制限するには以下のコマンドを実行する。

$ sudo tcset wlan0 --rate 1Mbps --direction incoming

すると以下のようになった。

Download 0.93 Mbps
Upload 0.90 Mbps

設定をリセットするには以下。

$ sudo tcdel wlan0 --all

参考:
簡単にDockerのネットワーク帯域制限を実現する - Qiita
https://qiita.com/----_/items/dfa542bc2976ebfd5b3c


この記事が気に入ったらサポートをしてみませんか?