8

I'm running a Raspberry Pi 3 with Raspbian Jessie. I have been trying to set up a bridged network using:

brctl addbr br0
brctl addif eth0 eth1

It works. Traffic is bridged in both directions properly. Unfortunately, after less than 60 seconds all SSH connections to the Pi timeout and the Pi itself no longer responds to any pings or connections on any of the ports that are listening. I checked my router's DHCP client list and it hasn't handed out any new IPs -- the Pi should still be accessible on the reserved IP I've provided for it.

using /etc/network/interfaces:

iface eth0 inet manual
iface eth1 inet manual

I do not have the bridge settings in /etc/network/interfaces yet, as I want to figure this issue out first. I have tried setting the eth0 IP manually, instead of letting it get it via DHCP, but no dice.

What am I overlooking?

1
  • Thanks for sharing the solution! I suggest you remove it from your question though, and post it as an answer. I'd upvote it. Commented Sep 30, 2016 at 9:42

3 Answers 3

4

You need to define br0 in you /etc/network/interfaces. Mine is:

auto br0
iface br0 inet static
bridge_ports eth0 eth1
    address 192.168.201.1
    netmask 255.255.255.0

If you want DHCP, change it to:

auto br0
iface br0 inet dhcp
bridge_ports eth0 eth1
5
  • It's working great with the IP statically assigned, but what if I want it to acquire the IP using DHCP reservations? Which MAC address should I be using? Trying to use the one from eth0 isn't cutting it.
    – apraetor
    Commented May 9, 2016 at 14:23
  • Try ifconfig -a to see the MAC. I would advise that for new supplementary doubts, to open new questions. Commented May 9, 2016 at 14:27
  • Sorry, my original question wasn't as clear as it should have been. Your suggestion did get the bridge working and an IP assigned, but my real question was basically "why doesn't br0 pick up the reserved IP (or ANY IP off DHCP)?" The bridge itself always worked, I was just manually creating it so I could try out different options.
    – apraetor
    Commented May 9, 2016 at 14:48
  • Edited it for DHCP. Commented May 9, 2016 at 16:56
  • OK I found my answer: the lowest MAC address from the slaved adapters is used. eth0 was originally the one with the reserved IP but eth1 has the lower MAC so I need to change the reservation. Thanks again.
    – apraetor
    Commented May 9, 2016 at 22:07
3

I found my own answer, after a bit of digging. Two things mattered:

  1. Bridges use the lowest-order MAC address of the slaved adapters for DHCP
  2. The IP assigned to eth0 was being released when the bridge came up, causing SSH to drop.

I had eth0's MAC used for the reservation but it should have been eth1's MAC I used. The bridge was coming up properly, but the wrong MAC address was assigned to the DHCP reservation.

I made this mistake because eth0 was the link to the DHCP server, but eth1's MAC was the lowest-order; with a bridge the physical connections don't matter for DHCP.

My final /etc/network/interfaces (which turned out not to be the cause):

auto br0
iface br0 inet dhcp
bridge_ports eth0 eth1
2
  • You can change eth0 and eth1 definitions...how this answer differs from mine? Commented Oct 4, 2016 at 10:45
  • The problem wasn't the /etc/network/interfaces definition, it was that the wrong MAC was being used. It was unrelated to the definitions; I basically included them in my answer (someone asked I take the solution out of the "question" section) so people would see that they are boilerplate. The issue was that when br0 was set to use DHCP it wasn't acquiring the reserved address.
    – apraetor
    Commented Oct 5, 2016 at 13:28
0

my /etc/network/interfaces:

#loopback adapter
auto lo
iface lo inet loopback

auto eth0    
auto wlan0

auto br0
iface br0 inet static
        address 192.168.1.29
        netmask 255.255.255.0
        gateway 192.168.1.30

bridge_ports eth0 wlan0 # build bridge
bridge_fd 0             # no forwarding delay
bridge_stp off          # disable Spanning Tree Protocol
1
  • I'm glad your setup works, but the question is about the apraetor's setup, not yours. Commented Sep 30, 2016 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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