Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
Raspberry Pi runs with Raspian, a Debian compiled for  ARM architecture. Pi has an ethernet adapter and usually a USB WLAN adapter is also attached in order to be able to have wireless access to Pi. Given this hardware you can use the Raspberry Pi as a  ethernet to WLAN bridge and/or as an access point with a cable connection. The following article explains ho to create a ethernet to WLAN bridge on Debian and Raspberry Pi running Raspbian.
 
Update March 1st, 2014: Until kernel 3.6.11+ everything works as described below. Starting with 3.10.25+ ist doesn't work any more and a router has to be configured.
 
Update March 2018: There exists another way to create a kind of bridge by using an arp proxy. See here.

 

Make sure your WLAN connection and ethernet connaction works when you start to configure the WLAN bridge. Then install the following package:
 
apt-get install bridge-utils
 
Now adapt your file /etc/network/interfaces accordingly:
 
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_maxwait 15

wpa-iface wlan0
wpa-bridge br0
wpa-driver wext
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
 
Start the bridge with
 
ifup br0
 
and 
 
ifconfig br0
 
should give a similar result. It's important  you have an IP address on the bridge which is from the DHCP pool of your local router.
 
br0       Link encap:Ethernet  HWaddr 94:44:52:1f:40:34 
          inet addr:192.168.0.107  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::9644:52ff:fe1f:4034/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:861 errors:0 dropped:0 overruns:0 frame:0
          TX packets:131 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:101477 (99.0 KiB)  TX bytes:15534 (15.1 KiB)
Now it's time to connect another system on the ethernet connector.
 
Unfortunately  this system has to be configured with a static IP which has to come from the same subnet your PI got when it connected via WLAN. DHCP requests unfortunatley are not routed through the bridge. It's probably possible to get this done with ebtables - but there is no solution for this available right now. 
 
Today (5.2.2014) I configured my Pi again because there was an issues reported, and following the instructions I got a DHCP address and I had no static IP to configure.
 
You have to configure your system carefully because DHCP doesn't help any more. All information excluding the IP which has to be a free IP in your local subnet can be extracted from the existing connection your bridge has.
 
1) Free static IP address from your local subnet  (e.g. 192.168.0.222 would be a valid IP in the above example)
2) Netzwerk mask ifconfig br0 | grep -i mask | sed 's/.*ask[0-9]*//'
3) Default Gateway route -n | grep ^0.0.0.0 | awk '{ print $2; }'
4) DNS Server cat /etc/resolv.conf | grep nameserver | cut -f 2 -d ' '
 
It takes some time until you can access systems behind the Pi because the arp Cache needs some time until it's filled over the WLAN (Test of arp cache with sudo arp).  Pi can be connected to immediately.
 

Use of an ARP proxy

 
This solution is not a bridge. But it works similar as a bridge. The driving horse is an arp proxy. In addition a dhcp-helper is required.
 
The following description assumes a raspbian stretch.
 

Before you start to create an arp proxy a working WLAN connection has to exist. Usually you add some lines in /etc/wpa_supplicant/wpa_supplicant.conf. Next add following text at the end of /boot/cmdline.txt separated by a space from the last character in the line. that way the network card will get a much simpler name eth0.

net.ifnames=0

Now activate in /etc/sysctl.conf he following line and remove the leading #. Then your Raspberry can work as a router.

#net.ipv4.ip_forward=1
 
Reboot your system in order to activate the changes.
 
Now install following additional packages:
 
sudo apt-get install parprouted dhcp-helper avahi-daemon
 
Next there are some configuration steps to execute:
 
Enable DHCP relay in /etc/default/dhcp-helper
DHCPHELPER_OPTS="-b wlan0"

Change /etc/avahi/avahi-daemon.conf to enable mDNS relaying

[reflector]
enable-reflector=yes
 
Now create a configuration for your interfaces in /etc/network/interfaces.d/wlanbridge to activate WLAN and the arp proxy.
 
auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
post-down /usr/bin/killall /usr/sbin/parprouted
# Assign eth0 same IP address as wlan0 so dhcp-proxy will proxy for the same subnet
post-up /sbin/ip addr add $(ip addr show wlan0 | grep -Eo "^\s+inet [^ ]+ " | sed -E 's/^\s+//' | cut -f 2 -d ' ' | cut -f 1 -d/)/32 dev eth0
post-up /usr/sbin/service dhcp-helper restart && /usr/sbin/parprouted eth0 wlan0
post-down /sbin/ifdown eth0
 
After a restart it takes some time until the ARP cache is ready and your client will get an IP address. Later on it will work immediately.
 
Usefull links with more detailed information:
help.ubuntu.com: Bridging ethernet connections  
Add comment

*** Note ***

Comments are welcome. But in order to reject spam posts please consider following rules:
  1. Comments with string http are rejected with message You have no rights to use this tag
  2. All comments are reviewed by hand and thus it usually takes one day until a comment will be published.