joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

RaspberryPi 4 as access point BRIDGE not working

Mon Jul 29, 2019 4:20 pm

I have the access point visible now and can connect to it but there is no internet connection via the access point and no internet connection on the Pi locally.
So somewhere in the bridge setup I lost network connection on eth0

results of ip addr

i@raspberrypi:~ $ ip addr
1
: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether dc:a6:32:04:6e:3d brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether dc:a6:32:04:6e:3e brd ff:ff:ff:ff:ff:ff
inet6 fe80::dea6:32ff:fe04:6e3e/64 scope link
valid_lft forever preferred_lft forever
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether dc:a6:32:04:6e:3e brd ff:ff:ff:ff:ff:ff
inet 169.254.159.96/16 brd 169.254.255.255 scope global noprefixroute br0
valid_lft forever preferred_lft forever
inet6 fe80::d2ea:c55b:9d0d:d1e/64 scope link
valid_lft forever preferred_lft forever


Anyone see any problems in this
Thanks


I have been following various instructions I have found on how to install a wifi access point. They all fail at the same point. Hostapd service wil not start that is it exits with an error.

Using RPi 4 with internal wifi. Raspian and all updates made. (also tried Ubuntu which fails say way)

I am currently following the instructions at https://www.raspberrypi.org/documentati ... s-point.md

I am at the subheading Start it up
when after entering sudo systemctl start hostapd
I get:
Job for hostapd.service failed because the control process exited with error code.
See "systemctl status hostapd.service" and "journalctl -xe" for details.
I tried:
systemctl status hostapd.service

● 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: activating (auto-restart) (Result: exit-code) since Mon 2019-07-29 12:09:36 EDT;
Process: 5044 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_
li

I am stuck here dont know what to try next. Can someone help please.



/etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=rpi4access
hw_mode=a --->>>this was the original problem so i change this line to hw_mode=g and access point became visable
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=rpi4access
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

/etc/dnsmasq.conf
interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.1.2,192.168.1.20,255.255.255.0,24h

/etc/default/hostapd
# Defaults for hostapd initscript
#
# WARNING: The DAEMON_CONF setting has been deprecated and will be removed
# in future package releases.
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"

# Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

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

Re: RaspberryPi 4 as access point BRIDGE not working

Mon Jul 29, 2019 9:33 pm

joep72 wrote:
Mon Jul 29, 2019 4:20 pm
So somewhere in the bridge setup I lost network connection on eth0

results of ip addr
If you look closely you can see eth0 is down and is not part of the bridge. Compare the lines for eth0 and wlan0 in "ip a show" and "ip link show".
Since eth0 is down, I suppose br0 fails to get a DHCP address, so it comes up with an autoipv4ll address, defined by avahi.

Fix the issue with eth0, and things will work ok. Read the how-to again, you must have missed a step.

EDIT. In fact, I would suggest to restart from scratch and apply the guide again, from the title Using the Raspberry Pi as an access point to share an internet connection (bridge) down to the end.
You are not supposed to run Dnsmasq in the bridged guide, because it is assumed there is already a DHCP server on the network. There must be one single DHCP server by network (unless special cases like proxies, but we're not there.)
Do not mix the first and second part of this guide, the configurations are not compatible.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 12:21 pm

Hi thanks for your advice. I have retried 3 times and still end up with no internet connection. So I guess I should ask some questions because I must be doing something wrong.

So I started with a fresh install of Raspian-Buster all recommended software. I do Apt update,upgrade and dist-upgrade. no issues. I open the page with instructions and start at the heading:
Using the Raspberry Pi as an access point to share an internet connection (bridge).
Do all the instructions with no issues.
I change this :
[Network]
Address=192.168.10.100/24
Gateway=192.168.10.1
DNS=8.8.8.8

to this
[Network]
Address=192.168.1.100/24
Gateway=192.168.1.1
DNS=8.8.8.8


for my ip address range.

Now I create the hostapd.conf as it does not exist at this point.
put in
interface=wlan0
bridge=br0
#driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

I dont change anything.

Now reboot the Raspberry Pi and I dont have no internet connection.
IP addr results
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether dc:a6:32:04:6e:3d brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether dc:a6:32:04:6e:3e brd ff:ff:ff:ff:ff:ff
inet6 fe80::dea6:32ff:fe04:6e3e/64 scope link
valid_lft forever preferred_lft forever
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether dc:a6:32:04:6e:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global noprefixroute br0
valid_lft forever preferred_lft forever
inet6 fe80::d6ae:15a8:2b0b:aea4/64 scope link
valid_lft forever preferred_lft forever

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 12:38 pm

Mhh. The guide changed, now it uses systemd networking to setup the bridge. I have no experience with that beast, sorry.
The ethernet interface eth0 is still not in the bridge.
Do you have created the file "/etc/systemd/network/bridge-br0-slave.network"? Is it correct?
Are you sure the ethernet port is connected, on the Pi and the router? Can you use another cable and check?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 12:49 pm

To be honest, I think somebody tried to improve the documentation and created a total mixup.

What I think you should do is to ignore everything from "If you want to create a Linux bridge (br0)..." until just before "You can also use the brctl tool to verify that a bridge br0 has been created." IMHO this part does not belong there because that is where the IP address is set instead of receiving it via DHCP.

There is another slight problem in the following passage:
The access point setup is almost the same as that shown in the previous section. Follow the instructions above to set up the hostapd.conf file, but ...
where "above" refers to the first part of the instructions and it is easy to overlook the following:
We now need to tell the system where to find this configuration file.

Code: Select all

sudo nano /etc/default/hostapd
Find the line with #DAEMON_CONF, and replace it with this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
The road to insanity is paved with static ip addresses

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 2:17 pm

Ernst wrote:
Wed Jul 31, 2019 12:49 pm
To be honest, I think somebody tried to improve the documentation and created a total mixup.
... IMHO this part does not belong there because that is where the IP address is set instead of receiving it via DHCP.
Yes, it appears the guide now mandates a static IP address for the AP without any rationale.
I've compared the 2 last versions, I'm not sure all edits were to the point...

I don't have a Buster machine installed, I don't care about systemd, especially networking, so I won't offer an alternative but the .network file that gives a static IP to the bridge is wrong IMHO.

To the OP: perhaps you want to try the previous version of the instructions? Should work fine still in Buster. (You'll need to move the .network files you created outside of /etc/systemd)

EDIT. An since I am more of less specialized into doing the exegesis of that document to newcomers, here are the things that should be improved according to my experience:
1) Make 2 documents. The configs are not compatible. People get confused and mix both parts of the document.
2) Open with a picture or ASCII art showing the target setup, esp. the location of the DHCP server(s)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 2:47 pm

epoch1970 wrote:
Wed Jul 31, 2019 2:17 pm
I don't have a Buster machine installed, I don't care about systemd, especially networking, so I won't offer an alternative but the .network file that gives a static IP to the bridge is wrong IMHO.
Based on my previous experiences I have just now successfully installed an access point under buster using the instructions.
epoch1970 wrote:
Wed Jul 31, 2019 2:17 pm
EDIT. An since I am more of less specialized into doing the exegesis of that document to newcomers, here are the things that should be improved according to my experience:
1) Make 2 documents. The configs are not compatible. People get confused and mix both parts of the document.
2) Open with a picture or ASCII art showing the target setup, esp. the location of the DHCP server(s)
I agree on those point, in addition the second part needs a cleanup because it starts right in the middle, refers back to the first section, and does not mention unmasking hostapd.
The road to insanity is paved with static ip addresses

jerrm
Posts: 202
Joined: Wed May 02, 2018 7:35 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 3:01 pm

epoch1970 wrote:
Wed Jul 31, 2019 2:17 pm
EDIT. An since I am more of less specialized into doing the exegesis of that document to newcomers, here are the things that should be improved according to my experience:
1) Make 2 documents. The configs are not compatible. People get confused and mix both parts of the document.
2) Open with a picture or ASCII art showing the target setup, esp. the location of the DHCP server(s)
I agree two separate documents with graphics. Maybe with a landing page showing the graphics and better explaining the differences and applications of the two solutions.

The focus with the NAT solution being first seems wrong to me. I would think 90% of users outside classroom type environments want the second access-point only solution and have no need or desire to complicate things with routing, NAT and dnsmasq. They want to be able to connect to their network and have everything "just work" - including apps/devices that assume a single broadcast domain.

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 3:19 pm

To solve the problem for the moment I have made the following instructions to set up a bridged access point.
(based on https://www.raspberrypi.org/documentati ... s-point.md)
Please let me know if you find any errors.

Using the Raspberry Pi as an access point to share an internet connection (bridge)

The Raspberry Pi can be used as a wireless access point, running a standalone network. This can be done using the inbuilt wireless features of the Raspberry Pi 3 or Raspberry Pi Zero W, or by using a suitable USB wireless dongle that supports access points.

Note that this was tested on a Raspberry Pi 3, and it is possible that some USB dongles may need slight changes to their settings. If you are having trouble with a USB wireless dongle, please check the forums.

Use the following to update your Raspbian installation:

Code: Select all

sudo apt update
sudo apt upgrade
If an updated kernel was installed, reboot before continuing with the setup.

Code: Select all

sudo reboot
One common use of the Raspberry Pi as an access point is to provide wireless connections to a wired Ethernet connection, so that anyone logged into the access point can access the internet, providing of course that the wired Ethernet on the Pi can connect to the internet via some sort of router.

To do this, a 'bridge' needs to put in place between the wireless device and the Ethernet device on the access point Raspberry Pi. This bridge will pass all traffic between the two interfaces. Install the following packages to enable the access point setup and bridging.

Code: Select all

sudo apt install hostapd bridge-utils
Bridging creates a higher-level construct over the two ports being bridged. It is the bridge that is the network device, so we need to stop the eth0 and wlan0 ports being allocated IP addresses by the DHCP client on the Raspberry Pi.

Code: Select all

sudo nano /etc/dhcpcd.conf
Add

Code: Select all

denyinterfaces wlan0 eth0
to the end of the file (but above any other added "interface" lines) and save the file.

Add a new bridge, which in this case is called "br0".

Code: Select all

sudo brctl addbr br0
Connect the network ports. In this case, connect "eth0" to the bridge "br0".

Code: Select all

sudo brctl addif br0 eth0
Now the interfaces file needs to be edited to adjust the various devices to work with bridging. Use "sudo nano /etc/network/interfaces" to add the bridging information at the end of the file.

Code: Select all

# Bridge setup
auto br0
iface br0 inet manual
bridge_ports eth0 wlan0
Create the "/etc/hostapd/hostapd.conf" file, add "bridge=br0" below the "interface=wlan0" line, and remove or comment out the driver line. The passphrase must be between 8 and 64 characters long.

To use the 5 GHz band, you can change the operations mode from 'hw_mode=g' to 'hw_mode=a'. The possible values for hw_mode are:

a = IEEE 802.11a (5 GHz)
b = IEEE 802.11b (2.4 GHz)
g = IEEE 802.11g (2.4 GHz)
ad = IEEE 802.11ad (60 GHz)

/etc/hostapd/hostapd.conf:

Code: Select all

interface=wlan0
bridge=br0
#driver=nl80211
ssid=NameOfNetwork
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
We now need to tell the system where to find this configuration file.

Code: Select all

sudo nano /etc/default/hostapd
Find the line with #DAEMON_CONF, and replace it with this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Now unmask hostapd and reboot the Raspberry Pi

Code: Select all

sudo systemctl unmask hostapd
sudo reboot
If there are any errors in the hostapd.conf file the hostapd service may fail to start.
In this case it can be helpful to start hostapd from the command line with the following command:

Code: Select all

sudo hostapd -B /etc/hostapd/hostapd.conf
Last edited by Ernst on Thu Aug 01, 2019 11:26 am, edited 3 times in total.
The road to insanity is paved with static ip addresses

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 3:41 pm

jerrm wrote:
Wed Jul 31, 2019 3:01 pm
The focus with the NAT solution being first seems wrong to me ... They want to be able to connect to their network and have everything "just work"
That last part is undeniable. But I am no so sure about the first: routed works all the time, bridging does not (e.g. wifi client uplink)
In general this guide is (was?) well written; the configuration is minimalistic and accurate, instructions are clear. So I don't think users suffer much through the install of the extra components routed requires.
Relegating the bridged setup to an obscure part of the user documentation could be a valid option, I'm afraid.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 3:53 pm

Ernst, I am not not picking on you ;)
Ernst wrote:
Wed Jul 31, 2019 3:19 pm
If an updated kernel was installed, consider rebooting:
"Consider rebooting"??? => "If an updated kernel was installed, reboot before continuing with the setup"
denyinterfaces wlan0 eth0
Yes, I think the guide says to "denyinterfaces wlan0" and "denyinterfaces eth0", which IIRC is incorrect (only the last interface gets ignored)
Add a new bridge, which in this case is called "br0". ... Connect the network ports. In this case, connect "eth0" to the bridge "br0".
Does systemd requires the device to be alive at config time? If not, this runtime dance with brctl is completely superfluous.
And I don't think systemd-netwoking requires brctl since that tool is deprecated; perhaps it is possible to save bandwidth and remove "apt-get install bridge-utils"

Thanks!
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 6:50 pm

epoch1970 wrote:
Wed Jul 31, 2019 3:53 pm
Add a new bridge, which in this case is called "br0". ... Connect the network ports. In this case, connect "eth0" to the bridge "br0".
Does systemd requires the device to be alive at config time? If not, this runtime dance with brctl is completely superfluous.
And I don't think systemd-networking requires brctl since that tool is deprecated; perhaps it is possible to save bandwidth and remove "apt-get install bridge-utils"
The "original" guide (after the "last" update) has a seemly confused section concerning the bridge. First it gives the instructions to install hostapd and bridge-utils, a little bit later how to add the new bridge with brctl and how to add the interface eth0 to the bridge.

Then it follows with "If you want to create a Linux bridge (br0) and add a physical interface (eth0) to the bridge, create the following configuration." giving the configuration files for systemd followed with a systemd config file for a static ip address.

A little bit of testing using buster has shown that either brctl or systemd can be used to create the bridge, the static IP address configuration at this point does not make sense.
The road to insanity is paved with static ip addresses

jerrm
Posts: 202
Joined: Wed May 02, 2018 7:35 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 8:02 pm

epoch1970 wrote:
Wed Jul 31, 2019 3:41 pm
That last part is undeniable. But I am no so sure about the first: routed works all the time, bridging does not (e.g. wifi client uplink)7
The guide as posted won't work with the pi as a wifi client anyway. I've never seen any situation where the Pi as a wired access point fails. Double NAT and separate networks break a lot of things and does not "work all the time" for many applications.

If trying to share the WiFi internet to the wired interface, then maybe the routed/double NAT solution makes sense, but I prefer an OpenWRT style pseudobridge with relayd - 99% transparent and easy to implement with a simple short dhcpcd.exit-hook script. No config changes needed for the average setup.

I've never tried the Pi as both wifi host and client - maybe a weekend project if I get bored.

joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 8:24 pm

I tried extracting instruction from your discuss.
results:
$ sudo hostapd -B /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0

/etc/hostapd/hostapd.conf

interface=wlan0
bridge=br0
#driver=nl80211
ssid=RPi4access
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=RPi4access
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 8:36 pm

jerrm wrote:
Wed Jul 31, 2019 8:02 pm
... OpenWRT style pseudobridge with relayd - 99% transparent and easy to implement with a simple short dhcpcd.exit-hook script. No config changes needed for the average setup.

I've never tried the Pi as both wifi host and client - maybe a weekend project if I get bored.
A pseudo bridge is not a bridge, it's usually that last 1% that causes problems... IP-in-IP does work, but it is a little bit involved. I believe a working setup can be achieved with xvlan, which is reasonably standard.
Good luck with AP+STA, esp. under systemd. Choose a quiet weekend.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

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

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 8:38 pm

joep72 wrote:
Wed Jul 31, 2019 8:24 pm
I tried extracting instruction from your discuss.
results:
$ sudo hostapd -B /etc/hostapd/hostapd.conf
The fate of hostapd is relatively unimportant for now. What you should concentrate on is seeing a bridge br0 with a DHCP address (meaning eth0 is attached to the bridge, up and running.) Once that is done hostapd should not be a problem.

EDIT. According to Arch, you want /etc/systemd/network/bridge-br0.network to look like this:

Code: Select all

[Match]
Name=br0

[Network]
DHCP=ipv4
The other unit files look correct (except for using the "slave" denomination, a bridge has no slaves, it has members.)
Last edited by epoch1970 on Wed Jul 31, 2019 8:49 pm, edited 2 times in total.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Wed Jul 31, 2019 8:45 pm

joep72 wrote:
Wed Jul 31, 2019 8:24 pm
I tried extracting instruction from your discuss.
results:
$ sudo hostapd -B /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0

/etc/hostapd/hostapd.conf

interface=wlan0
bridge=br0
#driver=nl80211
ssid=RPi4access
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=RPi4access
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
I think this is normal behaviour, that is if hostapd is running in the background.
I have been able to reproduce this "error" on a Pi4B with hostapd service active.
You can stop hostapd with the service command.

Code: Select all

sudo service hostapd stop
But why stop if it is already running ?

What is the output of
ifconfig
The road to insanity is paved with static ip addresses

joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Thu Aug 01, 2019 1:52 am

I have been trying to get this to work using every thing I could find using google. I got the brige and internet connection to work. :D By working I mean I see the access point on my network. I can connect to it and I can go to the internet using the access point. I can also go to internet locally from Pi.

But....I dont know what made it work and worst yet I cant reproduce it. :oops:

Hopefully someone can see something in the config files. attached are the important config files.
Rpi4bridge.7z
(2.29 KiB) Downloaded 138 times

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Thu Aug 01, 2019 11:17 am

joep72 wrote:
Thu Aug 01, 2019 1:52 am
But....I dont know what made it work and worst yet I cant reproduce it. :oops:
I have problem with your config files to see what you are trying to do. In the corrupt documentation there are two sections, the first is an access point with network address translation (NAT) using a local dhcp server so that only one IP address in the ethernet network. The second section is a bridged access point where every wifi client can request an IP address from a dhcp server in the ethernet network. For a home network the last configuration is the easiest. But there is a problem in the documentation causing the configuration to fail.

I have found the problem in the documentation and corrected my post. I have just now verified that this gives a working solution using the current buster lite release on a Raspberry Pi 3B and a Raspberry Pi 4B/4GB.
The road to insanity is paved with static ip addresses

joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Thu Aug 01, 2019 9:51 pm

Thanks for that update. I gave it a try with and had more success. But still some issue. Some of the problems may be tangential.

Fresh reload of Raspian buster.
Started up on RPi4. Raspian update failed because version compare timed or the substance.
Proceeded to do sudo apt update and sudo apt upgrade and went perfect.
When doing sudo apt install hostapd bridge-utils I got an error somethig about hostapd service failed. Sorry lost the message.
After that all went without incident.
Results of updated post.

Have local Pi access to internet (via eth0 I think)
access point is viable on the network
I can connect to the access point and get internet access. Thru put on the connection is very slow like not usable.
a speed test on the locally on Pi got 12Mbps (my full speed). Speed test on my iPad via access point is 0.8Mbs. The download speed is actually a little slower then the upload.

I dumped some data hopefully it helps

sudo hostapd -B /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver <<<still have this error
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
pi@raspberrypi:~ $ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.184 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::2144:ebed:5a4:3ce6 prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:04:6e:3d txqueuelen 1000 (Ethernet)
RX packets 4626 bytes 5245496 (5.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2541 bytes 217642 (212.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether dc:a6:32:04:6e:3d txqueuelen 1000 (Ethernet)
RX packets 4829 bytes 5379303 (5.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 11
TX packets 2533 bytes 216456 (211.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:04:6e:3e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 571 bytes 84944 (82.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0



$ systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authent
Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset:
Active: active (running) since Thu 2019-08-01 17:07:15 EDT; 3min 25s ago
Process: 527 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPT
Main PID: 543 (hostapd)
Tasks: 1 (limit: 4035)
Memory: 2.2M
CGroup: /system.slice/hostapd.service
└─543 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostap

Aug 01 17:07:15 raspberrypi hostapd[527]: wlan0: interface state UNINITIALIZED->
Aug 01 17:07:15 raspberrypi hostapd[527]: wlan0: AP-ENABLED
Aug 01 17:07:15 raspberrypi systemd[1]: Started Advanced IEEE 802.11 AP and IEEE
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d RADIUS: s
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d WPA: pair
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
...skipping...
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authent
Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset:
Active: active (running) since Thu 2019-08-01 17:07:15 EDT; 3min 25s ago
Process: 527 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPT
Main PID: 543 (hostapd)
Tasks: 1 (limit: 4035)
Memory: 2.2M
CGroup: /system.slice/hostapd.service
└─543 /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostap

Aug 01 17:07:15 raspberrypi hostapd[527]: wlan0: interface state UNINITIALIZED->
Aug 01 17:07:15 raspberrypi hostapd[527]: wlan0: AP-ENABLED
Aug 01 17:07:15 raspberrypi systemd[1]: Started Advanced IEEE 802.11 AP and IEEE
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d RADIUS: s
Aug 01 17:08:41 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d WPA: pair
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
Aug 01 17:10:05 raspberrypi hostapd[543]: wlan0: STA 18:4f:32:f2:14:6d IEEE 802.
~

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Fri Aug 02, 2019 5:43 am

I am glad that you succeeded, there are two points that I need to explain:
joep72 wrote:
Thu Aug 01, 2019 9:51 pm
When doing sudo apt install hostapd bridge-utils I got an error somethig about hostapd service failed.
This is a "normal" message while hostapd is "masked" because the configuration file needs to be updated, later in the procedure hostapd is "unmasked" so that it can start.
joep72 wrote:
Thu Aug 01, 2019 9:51 pm
sudo hostapd -B /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver <<<still have this error
Interface initialization failed
This is normal because hostapd is already running in the background. You should only use this command if hostapd fails to start because it gives more information on the reason, like typing errors in the configuration file.
The road to insanity is paved with static ip addresses

joep72
Posts: 6
Joined: Mon Jul 29, 2019 12:29 pm

Re: RaspberryPi 4 as access point BRIDGE not working

Fri Aug 02, 2019 7:17 pm

Been running on the access point today with no issues. Getting good performance out of it. Works very well over a short distance. But that is fine for my application. SSH works fine and xrdp for a remote desktop works fine

Thank you for resolving this for me so fast.

I consider this resolved Bridge works!

Thanks again :D

spiro
Posts: 2
Joined: Sat Aug 03, 2019 12:32 am

Re: RaspberryPi 4 as access point BRIDGE not working

Sat Aug 03, 2019 11:48 am

Ernst wrote:
Wed Jul 31, 2019 3:19 pm
To solve the problem for the moment I have made the following instructions to set up a bridged access point.
Many thanks Ernst for providing these instructions! I've got my RP4B working as an access point now. Is it also possible to direct all internet traffic through a VPN tunnel?

The tutorials I can find for this (e.g. https://pimylifeup.com/raspberry-pi-wir ... ess-point/ and https://thepi.io/how-to-use-your-raspbe ... pn-router/) which I tried before discovering this thread, require a different access point setup involving fixed IP addresses and dnsmasq, and were written before Buster was released - I so far haven't been able to make them work.

Ernst
Posts: 1386
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: RaspberryPi 4 as access point BRIDGE not working

Sat Aug 03, 2019 11:58 am

spiro wrote:
Sat Aug 03, 2019 11:48 am
Ernst wrote:
Wed Jul 31, 2019 3:19 pm
To solve the problem for the moment I have made the following instructions to set up a bridged access point.
Many thanks Ernst for providing these instructions! I've got my RP4B working as an access point now. Is it also possible to direct all internet traffic through a VPN tunnel?
I do not know. What I did is to provide a correction to the second part of this instruction: https://www.raspberrypi.org/documentati ... s-point.md
spiro wrote:
Sat Aug 03, 2019 11:48 am
The tutorials I can find for this (e.g. https://pimylifeup.com/raspberry-pi-wir ... ess-point/ and https://thepi.io/how-to-use-your-raspbe ... pn-router/) which I tried before discovering this thread, require a different access point setup involving fixed IP addresses and dnsmasq, and were written before Buster was released - I so far haven't been able to make them work.
You could try the first part of the instructions here: https://www.raspberrypi.org/documentati ... s-point.md
The road to insanity is paved with static ip addresses

spiro
Posts: 2
Joined: Sat Aug 03, 2019 12:32 am

Re: RaspberryPi 4 as access point BRIDGE not working

Mon Aug 05, 2019 2:37 pm

Ernst wrote:
Sat Aug 03, 2019 11:58 am
You could try the first part of the instructions here: https://www.raspberrypi.org/documentati ... s-point.md
Ah thanks. I was eventually able to get it working using those instructions (although it's very unstable and far to slow to be usable as a VPN router unfortunately. I agree with the earlier points that having those two sets of instructions on one page is quite confusing!

Return to “Troubleshooting”