0

Looks like the question was asked a few years ago, but no answer (describing how to do it)..

RPI - wlan0 to wlan1 bridge

I'm running Raspian (Jessie) on the PiZeroW, and would love to configure it so that it broadcasts a unique SSID for other devices to connect to, with the dhcp server handled by the main internet router.

And can it be done without using a usb wifi adapter? (I don't mind if wlan0 and wlan1 use the same channel).

ben
  • 101
  • 1
  • 1

1 Answers1

2

This has been answered: no, you cannot bridge (on the data link layer 2) an AP-type wlan station to a non-AP wlan station, such as between wlan0 and wlan1, or non-AP wlan0 and eth0. Bridging only works between an AP-mode wlan0 and eth0. Period.

The reason is not a driver issue, but the 3-MAC-address model of the IEEE 802.11 Wifi/WLAN standard. As a minor side note: a repeater is not a bridge, as it just electrically regenerates signals, but has no intelligence beyond. In contrast, a bridge decides what to do with frames it receives based on the destination MAC address (and even more criteria).

With 3 MAC addresses it is possible to reach an IEEE 802.11 station from a bridged IEEE 802.1D/Q network, but it is not possible to address any further device beyond a 802.11 station. With the shared radio medium you need MAC addresses for the radio link itself, and then you would also need the ultimate source and destination MACs. For whatever reason, the IEEE 802.11 settled for a 3 MAC address model instead of the full 4 MAC address model, probably because it makes things easier and cheaper to develop and produce. While there is room in the protocol for a fourth address, it never has been standardized.

The only way is to give up on bridging in this setup and go with the IP network layer: deploy routing, and optionally NAT in case of IPv4.

TheDiveO
  • 1,591
  • 1
  • 11
  • 16
  • Since the existing guides (with possibly the exception of this one http://imti.co/post/145442415333/raspberry-pi-3-wifi-station-ap ) seem to bridge eth0 and wlan0, do you think it's possible if a usb wifi adapter is used (as the eth0 AP) and then bridging it to the on-chip wlan0 for the internet connection? – ben Aug 01 '17 at 00:04
  • Please don't mix Ethernet and Wifi/WLAN. You can only use a WLAN adaptor (or the integrated WLAN interface) in a bridge when it is working in AP (access point or hotspot) mode. You can't use a WLAN adapter with bridging if it is not in AP mode. In consequence, you can't bridge between an WLAN adapter (which would be wlan1) and the integrated WLAN wlan0. Never ever, unless the IEEE 802.11 changes how things work. You cannot rename wlan1 to eth0, because these are device names and thus can't be changed at will. – TheDiveO Aug 01 '17 at 06:12
  • Thanks, do you have any thoughts on any of these guides? They seem to describe a pi a simultaneous wireless access point and client: http://www.0xf8.org/2016/02/using-your-raspberry-pi-zeros-usb-wifi-adapter-as-both-wifi-client-and-access-point/ https://gist.github.com/tcg/0c1d32770fcf6a0acf448b7358c5d059 https://raspberrypi.stackexchange.com/questions/66620/rpi-zero-w-as-router-client-and-access-point-at-the-same-time – ben Aug 01 '17 at 17:26
  • Using the same WLAN hardware as multiple virtual WLAN stations (even AP and non-AP simultaneously) is an entirely different topic; some hardware does support it. But this does not allow bridging either, unless you have rare hardware that supports non-standard WDS and you have compatible hardware both on the AP and non-AP side. – TheDiveO Aug 01 '17 at 19:01
  • Why not starting easy with less room for difficult problems, by going with separate hardware for wlan0 and wlan1 first and getting this up and running using IP routing or IP NATing? Then you can start optimizing by trying to get virtual WLAN interfaces working on the same interface hardware. – TheDiveO Aug 01 '17 at 19:04
  • I have bridged wifi-wired with no issues. I had wifi-wifi working across 2 interfaces in the past, but need to try it again with stretch, but wouldn't anticipate any issues. – bobstro Jan 12 '18 at 13:31