2

I have followed the following tutorial to set up an wifi access point:

After configuring hostapd, i've tested the setup with

sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf

and recieved the following error:

Configuration file: /etc/hostapd/hostapd.conf

Failed to create interface mon.wlan0: -95 (Operation not supported)
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:27:eb:3d:60:0c and ssid "Pi3-AP"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 

In my sudo nano /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
    iface lo inet loopback

#iface eth0 inet manual

auto eth0
    allow-hotplug eth0
    iface eth0 inet static
    address 172.16.164.145
    netmask 255.255.255.0
    broadcast 172.16.164.255
    gateway 172.16.164.254
    dns-nameservers 172.22.16.98

allow-hotplug wlan0
    iface wlan0 inet static
    address 172.16.164.1
    netmask 255.255.255.0
    network 172.16.164.0
    broadcast 172.16.164.255

#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#allow-hotplug wlan1
#iface wlan1 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

In my sudo nano /etc/hostapd/hostapd.conf

# This is the name of the WiFi interface we configured above
interface=wlan0

# Use the nl80211 driver with the brcmfmac driver
driver=nl80211

# This is the name of the network
ssid=Pi3-AP

# Use the 2.4GHz band
hw_mode=g

# Use channel 6
channel=6

# Enable 802.11n
ieee80211n=1

# Enable WMM
wmm_enabled=1

# Enable 40MHz channels with 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]

# Accept all MAC addresses
macaddr_acl=0

# Use WPA authentication
auth_algs=1

# Require clients to know the network name
ignore_broadcast_ssid=0

# Use WPA2
wpa=2

# Use a pre-shared key
wpa_key_mgmt=WPA-PSK

# The network passphrase
wpa_passphrase=raspberry

# Use AES, instead of TKIP
rsn_pairwise=CCMP

I would appericate any help to solve this problem. I am a totally beginner in Raspberry Pi and Linux.

Much appreciated

Joe Platano
  • 852
  • 8
  • 19
Nicholas
  • 29
  • 1
  • 4
  • Try using these instructions: https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-routed-wireless-access-point – Dougie Apr 04 '22 at 17:15

3 Answers3

3

Do you see the AP with your phone or laptop? In the raspberry.org forums the same issue (after following the same tutorial) has been discussed. The user allfox mentioned this error is a result of implementation delays...

If you start the hostapd with

sudo /usr/sbin/hostapd -d /etc/hostapd/hostapd.conf

or

sudo /usr/sbin/hostapd -dd /etc/hostapd/hostapd.conf

You should see something like:

nl80211: Driver does not support monitor interface type - try to run without it

but the AP should be visible.

Edit:

Assuming that that the LAN where you connect your eth0 port of your Raspberry already runs a DHCP (which would make a static IP there a source for conflicts) you can configure your Pi like this:

Remove the dnsmasq AND hostapd and all related config files:

sudo apt-get purge dnsmasq hostapd

Install hostapd and bridging tools:

sudo apt-get install hostapd bridge-utils

The interface config should look like this /etc/network/interfaces

# Localhost
auto lo
iface lo inet loopback

# Ethernet
auto eth0
allow-hotplug eth0
iface eth0 inet manual
# Ethernet VLAN for config
auto eth0.1
allow-hotplug eth0.1
iface eth0 inet dhcp

# WLAN
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wireless-power off

# bridge
auto br0
iface br0 inet dhcp
bridge_ports eth0 wlan0
pre-up ifconfig eth0 0.0.0.0 up
pre-up ifconfig wlan0 0.0.0.0 up
pre-up brctl addbr br0
pre-up brctl addif br0 eth0
post-down ifconfig wlan0 0.0.0.0 down
post-down ifconfig eth0 0.0.0.0 down
post-down brctl delif br0 eth0
post-down brctl delbr br0

The bridge will replace the eth0 so you cant access this interface anymore. The eth0.1 will be a virtual interface that get also an IP from the DHCP of your LAN. If you reboot, the pi should be accessible over this eth0.1 interface and the IP address provided by your router. You can check with

brctl show

if the bridge is working.

Your hostapd config in the /etc/hostapd/hostapd.conf file should look like this

bridge=br0

interface=wlan0
#driver=nl80211


ssid=Pi3AP
channel=1
hw_mode=g
ieee80211n=1
ieee80211d=1
wmm_enabled=1


auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=badpassword

Test if the AP comes up:

sudo /usr/sbin/hostapd -dd /etc/hostapd/hostapd.conf

If the AP comes up and you can connect with a device to it, you can daemonize it by editing /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

After rebooting the AP should become visible after less than 3 minutes.

This edit is based on a tutorial of Lawrence on his blog here and here and this answer to a bridging question. I run a similar config on a RPi2.

Joe Platano
  • 852
  • 8
  • 19
  • I am unable to see the AP on my phone. – Nicholas Mar 16 '17 at 04:06
  • I used the command above that you have provided, i did see something like u have mentioned. However the AP is not visible – Nicholas Mar 16 '17 at 04:07
  • i dont have a RPi 3 here at the moment.... i can update my PRi2 AP configuration and post it here...Please type lsusb and post the output – Joe Platano Mar 16 '17 at 04:40
  • pi@raspberrypi:~ $ lsusb Bus 001 Device 005: ID 04ca:002f Lite-On Technology Corp. Bus 001 Device 004: ID 04ca:0061 Lite-On Technology Corp. Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub – Nicholas Mar 16 '17 at 04:47
  • does your LAN has a DHCP on the router or do you have static IP addresses? – Joe Platano Mar 16 '17 at 04:52
  • How do i check whether my LAN has a DHCP on the router? I think i got static IP address in the sudo nano /etc/network/interfaces. – Nicholas Mar 16 '17 at 05:51
  • can you connect with other devices to your router/network? A Laptop or smart phone? If yes and you doesn't need to configure an IP there, a DHCP is running on your router. On Windows it works like here (also on Win10) – Joe Platano Mar 16 '17 at 06:01
  • I am trying to Install hostapd and bridging tools that u have provided me with the command, however it states that i am unable to locate the E: Unable to locate package brutils – Nicholas Mar 16 '17 at 07:00
  • okay my mistake.... the command is sudo apt-get install bridge-utils I will update this above. – Joe Platano Mar 16 '17 at 13:10
  • @Nicholas, did it work? – Joe Platano Mar 18 '17 at 02:10
  • In the /etc/network/interfaces with the commands that u have given me, then i rebooted it, there is no internet. Then i use the command brctl show, this is what i get. bridge name br0, bridge id 8000.b827ebdeadd2, STP enabled no, interfaces eth0 – Nicholas Mar 20 '17 at 04:08
  • there is missing the wlan0 interface in the bridge. please list the interfaces of your RPi: ip link show – Joe Platano Mar 20 '17 at 04:40
  • 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT group default qlen 1000 link/ether b8:27:eb:de:ad:d2 brd ff:ff:ff:ff:ff:ff 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000 link/ether b8:27:eb:8b:f8:87 brd ff:ff:ff:ff:ff:ff

    – Nicholas Mar 20 '17 at 05:35
  • 4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether b8:27:eb:de:ad:d2 brd ff:ff:ff:ff:ff:ff – Nicholas Mar 20 '17 at 05:35
  • seems to be ok. check the content of your /etc/network/interfaces there must be a reason, why wlan0 is not a part of the bridge – Joe Platano Mar 20 '17 at 05:56
  • you can try to kill the bridge brctl delbr br0 then ip addr flush dev eth0 same for wlan0 ip addr flush dev wlan0. then create a new bridge brctl addbr br123 and add there the interfaces brctl addif br123 eth0 wla0 then bring the bridge up ip link set dev br123 up – Joe Platano Mar 20 '17 at 06:02
  • I manage to do until brctl addif br123 eth0 wlan0, however it says that "can't add wlan0 to bridge br123: Operation not supported" – Nicholas Mar 20 '17 at 06:28
  • edit the file /etc/sysctl.conf and remove comment(#) the line net.ipv4.ip_forward=1 – Joe Platano Mar 20 '17 at 10:24
1

Use "pi-ap"- a Github repo which automates the configuration of a Pi 3 (or Pi 4) into a WiFi AP. Really, REALLY simple to use. Just edit variables.sh and change some default values, and then sudo ./install.sh will get you a working Pi Access Point in about 3.5 minutes while you drink your tea.

Only need a Pi 3B+ or a Pi 4, an Ethernet cable and a router with an Internet connection to uplink the Pi to and you're good to go:

https://github.com/f1linux/pi-ap/

The install.sh script calls all the other dependent scripts which source that variables.sh file and a few minutes later a working Access Point comes out the other end of the sausage maker. There's a detailed README.md in the repo and a Wiki for it in Github for support. HTH- T

F1Linux
  • 1,667
  • 1
  • 12
  • 30
0

To Configure an Acess Point out of a Raspberry I've made a Shell-Script for a Student Project. https://github.com/Doriangaensslen/pren1/raspberry_installation_scripts/wlan_activate.sh

Execute it only on a clean Raspberry