geneworld
Posts: 71
Joined: Sun Jan 19, 2014 11:46 pm

Pi0w as a bridged wireless access point

Wed Dec 09, 2020 3:11 pm

Hey guys,

Sorry if this is in the wrong spot.

I followed the following link https://www.raspberrypi.org/documentati ... bridged.md to try to extend my home wifi range while maintaining the same ip address as the router and am not able to connect to it.

I am using a Pi0w with a second wifi dongle to connect to the router. The tutorial (incomplete in my opinion) discusses being able to use a pi0w but it only talks about bridging a eth0 to wlan0, not a wlan1 to wlan0 bridge.

Below are the steps that I did from a fresh install of the 2020-12-02-raspios-buster-armhf-lite.img

Code: Select all

sudo apt-get update && sudo apt-get upgrade -y

Code: Select all

sudo apt-get install -y hostapd

Code: Select all

sudo systemctl unmask hostapd
sudo systemctl enable hostapd

Code: Select all

sudo nano /etc/systemd/network/bridge-br0.netdev
Added:

Code: Select all

[NetDev]
Name=br0
Kind=bridge
Save and exit

Code: Select all

sudo systemctl enable systemd-networkd

Code: Select all

sudo nano /etc/dhcpcd.conf
Added at the end of the file:

Code: Select all

denyinterfaces wlan0 eth0
interface br0
Save and exit

Code: Select all

sudo rfkill unblock wlan

Code: Select all

sudo nano /etc/hostapd/hostapd.conf
Added:

Code: Select all

country_code=US
interface=wlan0
bridge=br0
ssid=Nugget_Bridge
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Save and exit

Code: Select all

sudo reboot
When I rebooted I saw the network but my phone would not connect to it, it never even gets to the Authenticating step. It says "Failed to obtain IP address"

When I check with

Code: Select all

sudo service hostapd status
I get:

Code: Select all

hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-12-09 09:41:35 EST; 15min ago
  Process: 542 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SUCCESS)
 Main PID: 543 (hostapd)
    Tasks: 1 (limit: 995)
   CGroup: /system.slice/hostapd.service
           ââ543 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Dec 09 09:54:56 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: associated
Dec 09 09:54:56 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 RADIUS: starting accounting session 1E67737D3FFCC940
Dec 09 09:54:56 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 WPA: pairwise key handshake completed (RSN)
Dec 09 09:55:32 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: disassociated
Dec 09 09:55:33 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: disassociated
Dec 09 09:55:33 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: associated
Dec 09 09:55:33 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 RADIUS: starting accounting session 3E0B5D1C900217A7
Dec 09 09:55:33 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 WPA: pairwise key handshake completed (RSN)
Dec 09 09:56:09 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: disassociated
Dec 09 09:56:09 NuggetPi hostapd[543]: wlan0: STA 90:b6:86:72:c1:f5 IEEE 802.11: disassociated
And if i try

Code: Select all

sudo service hostapd stop
sudo service hostapd start
sudo service hostapd status
I get:

Code: Select all

hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-12-09 09:59:23 EST; 2s ago
  Process: 714 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SUCCESS)
 Main PID: 717 (hostapd)
    Tasks: 1 (limit: 995)
   CGroup: /system.slice/hostapd.service
           ââ717 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf

Dec 09 09:59:23 NuggetPi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Dec 09 09:59:23 NuggetPi hostapd[714]: Configuration file: /etc/hostapd/hostapd.conf
Dec 09 09:59:23 NuggetPi hostapd[714]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Dec 09 09:59:23 NuggetPi hostapd[714]: wlan0: Could not connect to kernel driver
Dec 09 09:59:23 NuggetPi hostapd[714]: Using interface wlan0 with hwaddr b8:27:eb:80:e6:b0 and ssid "Nugget_Bridge"
Dec 09 09:59:23 NuggetPi hostapd[714]: wlan0: interface state COUNTRY_UPDATE->ENABLED
Dec 09 09:59:23 NuggetPi hostapd[714]: wlan0: AP-ENABLED
Dec 09 09:59:23 NuggetPi systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
But I still cannot connect!

Has anyone been able to get this to work??
1 B R1
4B R2 IR
1B+ USB Boot/RetroPie2.6/KODI
1Pi2 USB Boot/Media Server/Torrent Box
1Pi Zero Web-based universal remote control
2Pi Zero Misc.
1Pi3 USB Boot/RetroPie3.6/KODI/pianobar

epoch1970
Posts: 6474
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Pi0w as a bridged wireless access point

Wed Dec 09, 2020 3:56 pm

By the standards, you can't bridge a client wifi interface. Only bridging an AP interface is possible.

Besides, your modification to dhcpcd.conf is not correct: i. "denyinterfaces" should be present on top of the file in order to avoid processing, and ii. an "interface xxx" block should be preceded and followed by an empty line.

To "extend" wireless over wireless using a Pi, you can use the routed AP how-to guide linked to the one you used, replacing "eth0" by "wlan1" (assuming wlan1 is the client interface to the upstream AP.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

geneworld
Posts: 71
Joined: Sun Jan 19, 2014 11:46 pm

Re: Pi0w as a bridged wireless access point

Wed Dec 09, 2020 4:15 pm

Thanks for you reply!
epoch1970 wrote: By the standards, you can't bridge a client wifi interface. Only bridging an AP interface is possible.
Does that mean that I cannot use a second wifi dongle to act like below:

[Home Router]<---->[wifi dongle (wlan1)]<---->[wlan0 acting as bridge]<---->[phone/computer/etc]
[ 192.168.1.1 ]<---->[ say 192.168.1.100]<---->[ ??? ]<---->[ 192.168.1.125 ]
epoch1970 wrote: Besides, your modification to dhcpcd.conf is not correct: i. "denyinterfaces" should be present on top of the file in order to avoid processing, and ii. an "interface xxx" block should be preceded and followed by an empty line.
I do not have any "interface" call outs active in my dhcpcd.conf file, they are all commented out so does it matter where I put it?
epoch1970 wrote: To "extend" wireless over wireless using a Pi, you can use the routed AP how-to guide linked to the one you used, replacing "eth0" by "wlan1" (assuming wlan1 is the client interface to the upstream AP.)
I've done that in the past, setting up an Access Point on a pi0w with the wlan0 and wlan1 but the issue I have is the IP addresses. I want to continue the IP addresses from the router like 192.168.1.xxx instead of a new network like 192.168.16.xxx

I have local webpages as well as network shares that I am looking to still be able to connect to.
1 B R1
4B R2 IR
1B+ USB Boot/RetroPie2.6/KODI
1Pi2 USB Boot/Media Server/Torrent Box
1Pi Zero Web-based universal remote control
2Pi Zero Misc.
1Pi3 USB Boot/RetroPie3.6/KODI/pianobar

epoch1970
Posts: 6474
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Pi0w as a bridged wireless access point

Wed Dec 09, 2020 5:36 pm

geneworld wrote:
Wed Dec 09, 2020 4:15 pm
Does that mean that I cannot use a second wifi dongle to act like below:

[Home Router]<---->[wifi dongle (wlan1)]<---->[wlan0 acting as bridge]<---->[phone/computer/etc]
[ 192.168.1.1 ]<---->[ say 192.168.1.100]<---->[ ??? ]<---->[ 192.168.1.125 ]
Correct. This is not possible because wlan1 cannot be bridged. It is a client.
If you want "acting as a bridge" instead of real ethernet bridging you can look for stuff like this. Pseudo-bridging sort of works in general (e.g. not great with DHCP). Or see if your router offers a proprietary solution.
I do not have any "interface" call outs active in my dhcpcd.conf file, they are all commented out so does it matter where I put it?
It wouldn't in this case, but the best place is the top of the file.
To reiterate, this is wrong:

Code: Select all

denyinterfaces wlan0 eth0
interface br0
and this is correct:

Code: Select all

denyinterfaces wlan0 eth0

interface br0

See "man dhcpcd.conf" for details.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

geneworld
Posts: 71
Joined: Sun Jan 19, 2014 11:46 pm

Re: Pi0w as a bridged wireless access point

Wed Dec 09, 2020 6:53 pm

epoch1970 wrote: Correct. This is not possible because wlan1 cannot be bridged. It is a client.
If you want "acting as a bridge" instead of real ethernet bridging you can look for stuff like this. Pseudo-bridging sort of works in general (e.g. not great with DHCP). Or see if your router offers a proprietary solution.
So would I need to look into a wifi dongle that can act act as a bridge?

I guess what is tripping me up is shown in the diagrams below:


1. What I want
[Home Router]<---->[wifi dongle (wlan1)]<---->[wlan0 acting as bridge]<---->[phone/computer/etc]
[ 192.168.1.1 ]<---->[ say 192.168.1.100]<---->[ ??? ]<---->[ 192.168.1.125 ]

2. What I have done in the past as an access point
[Home Router]<---->[wifi dongle (wlan1)]<---->[wlan0 acting as Access Point]<---->[phone/computer/etc]
[192.168.1.1]<---->[say 192.168.1.100]<---->[192.168.16.1]<---->[say 192.168.16.4]


I have done #2 and it will connect to the internet but with new IP addresses

From my [limited knowledge] point of view it looks like wlan1 would act the same way in both 1 & 2.

So then the only difference is when I actually want to bridge the connections then right?
1 B R1
4B R2 IR
1B+ USB Boot/RetroPie2.6/KODI
1Pi2 USB Boot/Media Server/Torrent Box
1Pi Zero Web-based universal remote control
2Pi Zero Misc.
1Pi3 USB Boot/RetroPie3.6/KODI/pianobar

epoch1970
Posts: 6474
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Pi0w as a bridged wireless access point

Wed Dec 09, 2020 8:07 pm

Yes option 2 works because that is routing, an IP layer 3 technique.
Bridging is a layer 2 technique, and the WiFi protocol is such that bridging a client interface is impossible.

There is a seemingly endless stream of posts on that precise question, please search this forum for “wireless bridging”.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Troubleshooting”