4

Bridging

There's a lot of information available on bridging for various configurations, some of which is targeted at RPi, others which is available for the general Debian distribution. I've wasted about a day digging through all of it, and still haven't found a satisfactory answer.

Is there a sane way to do this?

Clean State

Let's start from a clean slate and state the expectations:

  • I have an existing router providing wired and WPA2 access to an internet connection
  • I have a Raspberry Pi with a wireless adapter (8192cu driver, RTL8188CUS device)
    • It is running the latest Raspbian Wheezy
    • Its firmware is up-to-date per rpi-update
  • Neither iptables nor ebtables have any rules
  • net.ipv4.ip_forward = 1

Here's the simple-and-easy /etc/network/interfaces which works for basic connectivity.

auto lo 
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp

wpa-ssid   "YourWifiSSID"
wpa-psk    "YourWpaPassphrase"

Requirements

Now let's add some requirements.

  • I have a device which has an ethernet port, which I want to connect to the network
  • I want to connect this device via ethernet to the RPi
    • It should get address via DHCP from the router
    • It should be on the same subnet as all other devices

This rules out NAT (via iptables) and per-device MAC spoofing (via ebtables).

Examples

The closest thing that I've seen is a Gist on Github (though there are others like it)

auto lo

iface lo inet loopback
iface eth0 inet manual

auto wlan0
iface wlan0 inet manual

auto br0
iface br0 inet dhcp
  bridge_ports wlan0 eth0
  bridge_stp off
  bridge_fd 0
  bridge_waitport 0

wpa-iface  wlan0
wpa-bridge br0
wpa-ssid   "YourWifiSSID"
wpa-psk    "YourWpaPassphrase"

Rebooting after setting this configuration, no DHCP address is pulled by br0. According to iwconfig, wlan0 is associated with the base station.

Setting br0 to a static address gives it an IP, but there's no connectivity (cannot ping the gateway, even though ip route shows the correct route).

1
0

A guess - did you try a crossover ethernet cable?

Also you dont need ip on the bridge to connect device behind it. Use tcpdump on bridge and eth to understand where the packets are lost

3
  • You should not need a crossover cable since the turn of the century, that said I have no idea if the Pi and the posters device implement it. en.wikipedia.org/wiki/Ethernet_crossover_cable (Automatic crossover)
    – rob
    Sep 2 '14 at 13:04
  • A crossover would only matter if the ethernet-attached device was lacking connectivity. In this case, the RPi itself lacks connectivity, while it should have connectivity even if the Ethernet is disconnected. Printer --> Ethernet --> RPi --> Wireless --> Router --> Internet Sep 10 '14 at 3:55
  • Zach, you are correct of course. I answered assuming wifi is connected and bridge and device behind it has an issue Sep 10 '14 at 14:50

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