LoginSignup
1
0

More than 3 years have passed since last update.

Virtualboxでブロードキャストストーム

Posted at

VirtualboxのVMを使ってブロードキャストストームをつくってみる

ネットワーク

2つのVirtual Machine(VM)を用意する。ここではEthernet Switch AとEthernet Switch Bとし、それぞれが2つのネットワークI/Fをもち、それらがネットワークブリッジされている。
構成図.PNG

Virtualboxでの設定

2つのVMでネットワークアダプタ(ネットワークI/F)を2つ作成。"intnet1"および"intnet2"という内部ネットワークをつくり、プロミスキャスモードは"すべて許可"、MACアドレスはすべてのアダプタで重複しないものを選ぶ。


これにより、VMに用いたLinux(Busterdog)のネットワークI/Fの"eth0"が内部ネットワーク"intnet1"、"eth1"が内部ネットワーク"intnet2"に割り当てられる。

Linuxでの設定

起動時にネットワークブリッジが構成されるように、"/etc/network/interfaces"を設定する。起動時にSTP(Spanning Tree Protocol)はON。(でないと危険)

root@live:~# cat /etc/network/interfaces
auto eth0
iface eth0 inet static
  address 0.0.0.0
auto eth1
iface eth1 inet static
  address 0.0.0.0

auto br0
iface br0 inet static
  address 0.0.0.0
  bridge_ports eth0 eth1
  bridge_stp on

起動後の状態確認。

root@live:~# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:feb4:1e00  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:b4:1e:00  txqueuelen 1000  (イーサネット)
        RX packets 18  bytes 1968 (1.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:b4:1e:00  txqueuelen 1000  (イーサネット)
        RX packets 102  bytes 7290 (7.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1076 (1.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:cc:b0:74  txqueuelen 1000  (イーサネット)
        RX packets 99  bytes 6974 (6.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 180 (180.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (ローカルループバック)
        RX packets 340  bytes 24672 (24.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 340  bytes 24672 (24.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@live:~# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.080027b41e00   yes         eth0
                                        eth1

ブリッジネットワークI/F"br0"にはIPv6アドレスが割り当てられている。

実験

STPオン(起動時状態)

ping6送付前のWiresharkでのパケット。
Wireshark(通常).PNG
パケットを発生させる。

root@live:~# ping6 ff02::1

全ノードあてのマルチキャストだけどいいでしょう。
Wireshark(STPあり).PNG
conkyによる負荷状況。
負荷(STPあり).PNG
いたってノーマル。

STPオフ

コマンドでSTPをオフにする。

root@live:~# brctl stp br0 off
root@live:~# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.080027b41e00   no          eth0
                                        eth1

同じくパケットを発生させる。

root@live:~# ping6 ff02::1

直後のWiresharkの状況。
Wireshark(発散).PNG
ですが、そのうちこんな感じになる。
Wireshark(発散3).PNG
パケット番号に着目。conkyによる負荷状況はこちら。
負荷(死亡).PNG

ファンが激しく回り続けて、VMがお亡くなりなることもありました。STPをオフにすると負荷は下がります(当然)。
負荷(収束).PNG

まとめ

実験成功。でもやってはいけない。

1
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
1
0