Posts: 36
Joined: Mon Jun 30, 2014 2:58 am

Bridge / route eth0 to wlan0

Sun Aug 23, 2015 12:23 am

Hi, hello.
I've been trying everything for many hours. What i want to acchieve is simple to describe, let me show it in an image:


I have a computer (running Windows 7, but it should be the same for any OS) . The target PC doesn't have USB so i cannot plug a dongle.
I have a raspberry pi 2B, with a fully working dongle, up and running latest raspbian and connected to the LAN through wlan0.

What is needed is simply to connect the target computer to the LAN through RPI's wifi dongle. The IP of the target PC will be set by the DHCP of the LAN. Same goes to the internet connection. The target PC should have access to the LAN's resources (printers, files, etc)

I thought that bridging wlan0 and eth0 should do the trick, but the br0 (bridge interface created) doesn't seem to connect to the LAN wifi , i don't know why. I also tried ibtables without success (among many other ideas that are floating through the web).

Any help would be greatly appreciated.

Posts: 36
Joined: Mon Jun 30, 2014 2:58 am

Re: Bridge / route eth0 to wlan0

Tue Aug 25, 2015 3:04 am


Posts: 7
Joined: Mon Feb 24, 2014 11:36 am

Re: Bridge / route eth0 to wlan0

Wed Aug 26, 2015 3:45 am

try ... -ready-tv/

It work for me awhile back. although not sure about print services.

User avatar
Posts: 43
Joined: Fri Jul 18, 2014 9:27 am

Re: Bridge / route eth0 to wlan0

Thu Aug 27, 2015 5:31 am

When I was initially trying to do a similar job with linking the traffic between eth0 and wlan0 I also tried to bridge them... and it didn't work.
First of all, you need to setup the eth0 adapter in /etc/network/interfaces not to be using DHCP, a static configuration should look like

Code: Select all

iface eth0 inet static
On your PC, you should configure the ethernet adapter to be using as IP, as netmask and as gateway for the connection.

The next steps are to enable the traffic forwarding on the fly and make it permanent with

Code: Select all

sudo sysctl -w net.ipv4.ip_forward=1
sudo sed -i "s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g" /etc/sysctl.conf
Add the networking rules to iptables

Code: Select all

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
Export them to a file

Code: Select all

sudo bash -c "iptables-save > /etc/iptables.rules"
And set your wlan0 interface to load them automatically every time it starts up (again, /etc/network/interfaces)

Code: Select all

iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  pre-up iptables-restore < /etc/iptables.rules
I assume that this would probably do it.

Posts: 63
Joined: Fri Feb 06, 2015 2:19 pm

Re: Bridge / route eth0 to wlan0

Fri Aug 28, 2015 1:33 pm

I managed to connect 4 ICQ Trend boiler controllers to our wifi each using a B+ via bridging. The Boiler controllers have to have a static IP address for this to work, normally if via wire DHCP will do fine. The settings I used can be found viewtopic.php?p=733494#p733494.

Note I did change the ath0 settings to br0 later on, still worked though.

One drawback, you cannot access the RPi via the network, it acts as if it is completely transparent to all traffic.

Return to “Networking and servers”