Mac의 Linux VM에서 두 개의 인터페이스를 브리지하려고 하는데 브리지에 두 번째 인터페이스를 추가하면 모든 것이 중단됩니다. 제가 뭘 잘못하고 있는지 조언을 듣고 싶습니다.
설정:
- 네트워크 ------ MacOS / eth0:VirtualBoxLinux:eth1 ---- 라즈베리 파이
- Linux VM은 MacOS 10.14.3의 VirtualBox 6.0에 debian-9 기반 배포판을 새로 설치한 것입니다.
- MacOS Wi-Fi를 통해 인터넷에 연결
- VirtualBox는 브리지된 네트워크 인터페이스를 VM에 eth0으로 노출합니다.
- 가상 머신에 연결된 Apple USB 이더넷 어댑터(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:~#
감사해요!