3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

linuxbridge をループさせてみる

Posted at

はじめに

Linux の仮想 bridge をループさせます。

computer_hub_loop_setsuzoku.png

ループ接続のイラスト | かわいいフリー素材集 いらすとや http://www.irasutoya.com/2016/07/blog-post_529.html

環境

iproute2(ip コマンド), brctl がインストールされた Linux
ループで CPU 利用率が 100% になるため、支障をきたさないマシンで行ってください。

手順

veth の作成

ip link add a-to-b type veth peer name b-to-a

コマンド実行後 ip l をすると、a-to-b@b-to-a, b-to-a@a-to-b が一覧に追加されています。

bridge の作成

brctl addbr br
ip link set dev br up

brctl show で作成されたブリッジ一覧を見れます。

veth を bridge に接続する

brctl addif br a-to-b
brctl addif br b-to-a

実機ではこの時点でループしますが、仮想ではまだ大丈夫です。
brctl show で intefaces に a-to-b, b-to-a が接続されていることを確認してください。

仮想インタフェースを up させる

ip link set dev a-to-b up
ip link set dev b-to-a up

ループします。CPUが100%になります。お疲れ様でした。

※止めるには ip link set dev a-to-b down とかで。。

おまけ STP を有効にする

brctl stp br on

brctl show stp br

1506255954.png

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?