0

I have my Pi Zero W set up as a wireless bridge, bridging from wired eth0 to wireless wlan0; of course, wlan0 operates in AP mode. So far so good. Now I'm noticing that when I forgot to plug in the USB Ethernet adapter for eth0 into my Pi Zero W before boot, it won't be added as a bridge port to my bridge br0 automatically. How can I ensure that eth0 always gets added to the bridge, even if I plug eth0 into the Pi only later?

My /etc/network/interfaces has to say this:

auto eth0
allow-hotplug eth0
...

auto br0
bridge_ports eth0 wlan0
...

When I hot-plug eth0 then brctl show only shows wlan0 for br0, but not eth0.

  • what happens if you plug in eth0 and bring down and back up br0? – Steve Robillard Jul 24 '17 at 9:23
  • Didn't try; but as I could manually add eth0 later, I tried an up declaration in /etc/network/interfaces which worked. So I probably found the answer to my own question. – TheDiveO Jul 24 '17 at 9:29
2

So it occured to me that telling /etc/network/interfaces to "manually" add the network interface eth0 to my br0 bridge may answer my question: yes, indeed, this works. So my /etc/network/interfaces contains this:

auto eth0
allow-hotplug eth0
...
up brctl addif br0 eth0

After quite some testing by pulling eth0 and later hot-plugging it back again I could successfully verify that this works in fact reliably.

| improve this answer | |
  • Generic hint: You may want to suffix the up commands with "|| true" so that they don't fail if the command fails. – V13 Dec 14 '19 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.