2番目のインターフェイスを追加した後、Linuxブリッジは機能しません。

2番目のインターフェイスを追加した後、Linuxブリッジは機能しません。

MacのLinux VMで2つのインターフェイスをブリッジしようとしていますが、ブリッジに2番目のインターフェイスを追加すると、すべてが中断されます。何が間違っているのかアドバイスを聞きたいです。

設定:

  • ネットワーク ------ MacOS / eth0:VirtualBoxLinux:eth1 ---- ラズベリーパイ
  • Linux VMは、MacOS 10.14.3のVirtualBox 6.0にdebian-9ベースのディストリビューションを新しくインストールしたものです。
  • MacOS Wi-Fi経由でインターネットに接続
  • VirtualBoxは、ブリッジされたネットワークインターフェイスをVMにeth0として公開します。
  • 仮想マシンに接続されたApple USB Ethernetアダプタ(eth1として公開)
  • テストするには、Raspberry PiをUSBアダプタに接続してください。

目的は、eth0とeth1を接続してRaspberry Piをメインネットワークに直接接続することです。

eth0を起動してVM内でIPを提供すると、Linux VMはネットワークとシームレスに通信できます。

eth0のみを含むブリッジを作成し、ブリッジにIPを割り当てると、Linux仮想マシンは引き続きネットワークと通信できます。

その後、eth1をブリッジに追加すると、Linux仮想マシンはネットワークと通信できなくなります。この時点で、ラズベリーパイはDHCPを介してIPを取得できますが、ネットワークとも通信できないようです。

ブリッジから eth1 を削除すると、Linux 仮想マシンのネットワーク接続が復元されます。

編集:ブリッジでSTPを無効にしましたが、br0を設定した後、状況がより良くなることを確認するためにしばらく待っていました。 「brctlshowstp」がeth0とeth1の転送を表示し、Raspberry Piが何らかの方法でDHCPを介してIPを取得できるという事実は、少なくともある程度何かが進行中であることを意味します。

詳細:

起動設定:インターフェイスが動作しており、割り当てられたIPがありません。

root@cbpp:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 6325015  bytes 7231844627 (6.7 GiB)
        RX errors 0  dropped 75  overruns 0  frame 0
        TX packets 1129  bytes 84075 (82.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 04:69:f8:eb:c8:1a  txqueuelen 1000  (Ethernet)
        RX packets 100  bytes 9369 (9.1 KiB)
        RX errors 1  dropped 0  overruns 0  frame 0
        TX packets 39002  bytes 5454636 (5.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ブリッジを作成し、eth0を追加し、DHCPを介してIPを取得し、ホストにpingを送信します。

root@cbpp:~# brctl addbr br0
root@cbpp:~# brctl addif br0 eth0
root@cbpp:~# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.08002706fd0a   no      eth0
root@cbpp:~# ifconfig br0 up
root@cbpp:~# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 161  bytes 16286 (15.9 KiB)
        RX errors 0  dropped 4  overruns 0  frame 0
        TX packets 0  bytes 0 (0.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:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 6352292  bytes 7256149955 (6.7 GiB)
        RX errors 0  dropped 76  overruns 0  frame 0
        TX packets 1129  bytes 84075 (82.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 04:69:f8:eb:c8:1a  txqueuelen 1000  (Ethernet)
        RX packets 106  bytes 9645 (9.4 KiB)
        RX errors 1  dropped 0  overruns 0  frame 0
        TX packets 39002  bytes 5454636 (5.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@cbpp:~# dhclient br0 -v
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/br0/08:00:27:06:fd:0a
Sending on   LPF/br0/08:00:27:06:fd:0a
Sending on   Socket/fallback
DHCPREQUEST of 192.168.28.236 on br0 to 255.255.255.255 port 67
DHCPACK of 192.168.28.236 from 192.168.28.1
bound to 192.168.28.236 -- renewal in 3046 seconds.

root@cbpp:~# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.28.236  netmask 255.255.255.0  broadcast 192.168.28.255
        ether 08:00:27:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 869  bytes 100262 (97.9 KiB)
        RX errors 0  dropped 11  overruns 0  frame 0
        TX packets 45  bytes 4656 (4.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 6400166  bytes 7294827072 (6.7 GiB)
        RX errors 0  dropped 77  overruns 0  frame 0
        TX packets 1174  bytes 88761 (86.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 04:69:f8:eb:c8:1a  txqueuelen 1000  (Ethernet)
        RX packets 112  bytes 9921 (9.6 KiB)
        RX errors 1  dropped 0  overruns 0  frame 0
        TX packets 39002  bytes 5454636 (5.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


root@cbpp:~# ping -c 1 192.168.28.1
PING 192.168.28.1 (192.168.28.1) 56(84) bytes of data.
64 bytes from 192.168.28.1: icmp_seq=1 ttl=64 time=1.21 ms

--- 192.168.28.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.213/1.213/1.213/0.000 ms

ブリッジにeth1を追加し、接続が失敗したことを確認しました。注:この時点で、Raspberry Piはeth0からDHCPを介してIPを取得できますが、そのポイントも通過しないようです。

root@cbpp:~# brctl addif br0 eth1
root@cbpp:~# ping -c 1 192.168.28.1
PING 192.168.28.1 (192.168.28.1) 56(84) bytes of data.
From 192.168.28.236 icmp_seq=1 Destination Host Unreachable

--- 192.168.28.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

この時点の構成の詳細(eth0 / eth1を使用したブリッジ設定は機能しません):

root@cbpp:~# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.28.236  netmask 255.255.255.0  broadcast 192.168.28.255
        ether 04:69:f8:eb:c8:1a  txqueuelen 1000  (Ethernet)
        RX packets 5755  bytes 668798 (653.1 KiB)
        RX errors 0  dropped 11  overruns 0  frame 0
        TX packets 82  bytes 9698 (9.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:06:fd:0a  txqueuelen 1000  (Ethernet)
        RX packets 6590263  bytes 7428675506 (6.9 GiB)
        RX errors 0  dropped 83  overruns 0  frame 0
        TX packets 1217  bytes 94469 (92.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 04:69:f8:eb:c8:1a  txqueuelen 1000  (Ethernet)
        RX packets 148  bytes 11577 (11.3 KiB)
        RX errors 1  dropped 0  overruns 0  frame 0
        TX packets 40112  bytes 5608073 (5.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@cbpp:~# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.0469f8ebc81a   no      eth0
                            eth1

root@cbpp:~# brctl showstp br0
br0
 bridge id      8000.0469f8ebc81a
 designated root    8000.0469f8ebc81a
 root port         0            path cost          0
 max age          20.00         bridge max age        20.00
 hello time        2.00         bridge hello time      2.00
 forward delay        15.00         bridge forward delay      15.00
 ageing time         300.00
 hello timer           0.00         tcn timer          0.00
 topology change timer     0.00         gc timer          73.23
 flags


eth0 (1)
 port id        8001            state            forwarding
 designated root    8000.0469f8ebc81a   path cost          4
 designated bridge  8000.0469f8ebc81a   message age timer      0.00
 designated port    8001            forward delay timer    0.00
 designated cost       0            hold timer         0.00
 flags

eth1 (2)
 port id        8002            state            forwarding
 designated root    8000.0469f8ebc81a   path cost         19
 designated bridge  8000.0469f8ebc81a   message age timer      0.00
 designated port    8002            forward delay timer    0.00
 designated cost       0            hold timer         0.00
 flags

root@cbpp:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

root@cbpp:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.28.1    0.0.0.0         UG    0      0        0 br0
192.168.28.0    0.0.0.0         255.255.255.0   U     0      0        0 br0

ブリッジから eth1 を削除すると、接続が復元されます。

root@cbpp:~# brctl delif br0 eth1
root@cbpp:~# ping -c 1 192.168.28.1
PING 192.168.28.1 (192.168.28.1) 56(84) bytes of data.
64 bytes from 192.168.28.1: icmp_seq=1 ttl=64 time=2.50 ms

--- 192.168.28.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.504/2.504/2.504/0.000 ms
root@cbpp:~#

ありがとうございます!

ベストアンサー1

おすすめ記事