jsmith7342
Posts: 31
Joined: Sat Jan 11, 2014 3:46 am

RPi WiFi to eth0 bridge not working

Sat Apr 25, 2015 1:12 am

Hi all,

I have been trying to use my Raspberry Pi as a wifi-to-ethernet bridge using various different methods i.e. bridge utils and using the script here http://hackhappy.org/uncategorized/how- ... rk-bridge/ but none of these seem to be working. My network details (as seen from my PC) is:
Gateway: 192.168.2.1
Subnet Mask: 255.255.255.0
IP address: 192.168.2.18 (my Pi always gets this address, even without using static IP)
What settings should I use on the above script to make it work (I think the problem is in the isc-dhcp-server which isn't allocating my PC (eth0) an IP address? And does anyone know of any other methods of doing this (bridge-utils doesn't work at all for me). Oh, and does it matter if I assign the static ip for eth0 as 192.168.0.xx or 192.168.1.xx (since my wifi is 192.168.2.xx)?

Thanks in advance,

gdt
Posts: 85
Joined: Thu Jul 19, 2012 10:19 am

Re: RPi WiFi to eth0 bridge not working

Sat Apr 25, 2015 12:26 pm

A few questions you might want to consider:

- are the packets forwarding between eth0 and wlan0 using bridging, routing or NAT?

- How do devices deeper in the network discover this forwarding device?

- is the wlan0 interface a client interface or an access point?

- what device in each subnet is responsible for DHCP?

Most issues with networking are due to fuzzy thinking about these topics.

If you are actually bridging then I suggest you don't assign an IP address to eth0 or to wlan0. Create a dummy0 and assign the IP address to that. The add eth0, wlan0 and dummy0 into the same bridge. Packets will move between eth0 and wlan0 using ethernet flooding and learning.

Code: Select all

# modprobe dummy
# ip addr add 10.1.2.3/24 dev dummy0
# brctl addbr br0
# brctl addif br0 dummy0
# brctl addif br0 eth0
# brctl addif br0 wlan0

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: RPi WiFi to eth0 bridge not working

Sat Apr 25, 2015 12:39 pm

A true bridge requires two(2) RPi units... the wlan0 needs to be setup adhoc between the to PIs and then each end of the bridge is tethered via eth0 on each end.

The main problem you have is that the wifi in your RPi is not meant to be used as an access point... it can be setup ad-hoc (I've not done it, but others have) and if you have two PIs talking via wifi and each is eth0 connected to their own subnet, well, you have a bridge.

I've been using a pair of linksys wifi routers configured this way for some time to span the house without internal wires... the wifi bridge is limited only by internal metal duct work and objects in the building interfering with the signal. And of course you can configure each end so that it will only connect with the other's mac address... which gives you a bit more security.
marcus
:ugeek:

jsmith7342
Posts: 31
Joined: Sat Jan 11, 2014 3:46 am

Re: RPi WiFi to eth0 bridge not working

Sun Apr 26, 2015 3:04 am

Thanks for the replies,

I'm not an expert on Linux so could you please give me step-by-step information on how to set up said bridge? E.g. what I need to download? It seems like you are using bridge-utils which hasn't worked for me in the past... could you explain what I need to do?

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

Re: RPi WiFi to eth0 bridge not working

Sun Apr 26, 2015 7:26 am

Have a look at this thread viewtopic.php?p=733494#p733494, it may help. Note changing the ath0 entries to br0 does work. I have 4 Trend boiler monitors connected to Cisco WiFi each via a B+.

jsmith7342
Posts: 31
Joined: Sat Jan 11, 2014 3:46 am

Re: RPi WiFi to eth0 bridge not working

Sun May 03, 2015 2:44 am

Hi, I looked at the thread and replaced the ath0 entries with br0. However, I am not completely sure of what to put in for <mac-address-of-wireless-dongle> (is this the rpi wireless dongle), <IP-address-of-device> (which device, the computer or the Pi, and what if it isn't static IP), <mac-address-of-device> (is this the Pi or the computer)? Could you post the settings that you used for your setup?

Any help will be greatly appreciated.

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

Re: RPi WiFi to eth0 bridge not working

Mon May 04, 2015 11:14 am

Hi. If you have used the Edimax wifi dongle then the MAC (media access control) number is written in very tiny lettering on the gold surface or I think it may be written on the box it came in, I'm not sure of this latter statement though. The MAC address of the WiFi dongle you can get from doing the following from the console or console window.

sudo ifconfig

The device MAC address is that of the device you wish to connect to the RPi, not the ethernet port of the RPi. If the device has an IP address then you could ping it and look at your local arp table or if you can see the MAC address somehow on the device then all well and good.

MAC addresses have 6 pairs of hex characters separated by colons eg 12:34:56:78:9a:bc and are unique throughout the world, well, should be, that's the theory anyway. So you cannot make these up.

You have to replace the items in the scripts that have these characters <>, this includes those characters as well, with the appropriate MAC and IP addresses. The IP address is that of the device you wish to enable to connect to the wifi, not the RPi, the RPi has no IP address in this configuration.

What you are happens is the same MAC address of the WiFi dongle gets allocated to all the networking interfaces on the RPi and ebtables creates a mapping between the IP address of the device and its own MAC address. When a packet destined for the devices IP address arrives using the RPis WiFi MAC, the RPi looks up using ebtables the IP address destination and forwards the packet to the destination swapping the appropriate MAC addresses. The reverse happens when a packet comes from the device, the RPi swaps the MAC address of the device for its own. So packets from the attached device, on the rest of the network have an IP address of the device but the source MAC address being that of the RPi.

Your device (PC) needs a static address in the same range as your WiFi with the same netmask and gateway as the rest of your network. Usually DNS is set to your ADSL router.

Return to “Networking and servers”