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
norebtables
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).