0

I try to use my pi (Raspberry Pi 4, Model B, running latest Raspberry Pi OS bookworm) as a WLAN Access Point which also provides a website.

I installed and configured hostapd, dnsmasq, dhcpcd & nginix.

It all worked out and i was able to access the wifi and then my webservice.

After a Reboot, the WLAN was not available anymore.

The AP is not discoverable by other Devices via Wifi and when i try to add/access it manually it also does not work.

I can still connect via SSH if i am in the same network (connected via cable) and then access teh website as well.

When i check the servies, they all seem fine:

● hostapd.service - Access point and authentication server for Wi-Fi and Ethernet
     Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-03-05 11:47:51 CET; 7min ago
       Docs: man:hostapd(8)
    Process: 716 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid $DAEMON_OPTS ${DAEMON_CONF} (cod>
   Main PID: 742 (hostapd)
      Tasks: 1 (limit: 8741)
        CPU: 57ms
     CGroup: /system.slice/hostapd.service
             └─742 /usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf

Mar 05 11:47:50 rennleitung systemd[1]: Starting hostapd.service - Access point and authentication s>
Mar 05 11:47:50 rennleitung hostapd[716]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Mar 05 11:47:51 rennleitung hostapd[716]: wlan0: interface state COUNTRY_UPDATE->ENABLED
Mar 05 11:47:51 rennleitung hostapd[716]: wlan0: AP-ENABLED
Mar 05 11:47:51 rennleitung systemd[1]: Started hostapd.service - Access point and authentication se>
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-03-05 11:47:51 CET; 7min ago
    Process: 715 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
    Process: 735 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
    Process: 747 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/S>
   Main PID: 746 (dnsmasq)
      Tasks: 1 (limit: 8741)
        CPU: 128ms
     CGroup: /system.slice/dnsmasq.service
             └─746 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg->

Mar 05 11:47:50 rennleitung systemd[1]: Starting dnsmasq.service - dnsmasq - A lightweight DHCP and >
Mar 05 11:47:51 rennleitung dnsmasq[746]: started, version 2.89 cachesize 150
Mar 05 11:47:51 rennleitung dnsmasq[746]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n ID>
Mar 05 11:47:51 rennleitung dnsmasq-dhcp[746]: DHCP, IP range 192.168.1.100 -- 192.168.1.200, lease >
Mar 05 11:47:51 rennleitung dnsmasq[746]: no servers found in /etc/resolv.conf, will retry
Mar 05 11:47:51 rennleitung dnsmasq[746]: read /etc/hosts - 7 names
Mar 05 11:47:51 rennleitung systemd[1]: Started dnsmasq.service - dnsmasq - A lightweight DHCP and c>
Mar 05 11:47:56 rennleitung dnsmasq[746]: reading /etc/resolv.conf
Mar 05 11:47:56 rennleitung dnsmasq[746]: using nameserver 192.168.178.1#53

The only issue i can see is that wlan0 is down, but i do not know why, or how to fix this

$ ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    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 mq state UP mode DEFAULT group default qlen 1000
    link/ether d8:3a:dd:46:e7:14 brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DORMANT group default qlen 1000
    link/ether d8:3a:dd:46:e7:15 brd ff:ff:ff:ff:ff:ff

For Reference, those are my config files:

/etc/default/hostapd:

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

/etc/hostapd/hostapd.conf:

interface=wlan0
ssid=myAP
channel=1
hw_mode=g
ieee80211n=1
ieee80211d=1
country_code=DE
wmm_enabled=1
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=*******

/etc/dhcpcd.conf:

interface wlan0
static ip_address=192.168.1.1/24
nohook wpa_supplicant

duid
persistent
vendorclassid
option domain_name_servers, domain_name, domain_search
option classless_static_routes
option interface_mtu
option host_name
option rapid_commit
require dhcp_server_identifier
slaac private
5
  • 1
    What Pi? What OS? Don't expect anyone to translate a foreign language tutorial to work out WHAT YOU DID - explain.
    – Milliways
    Commented Mar 5 at 11:51
  • @Milliways you're absolutely right. Sorry. I added more information now. Commented Mar 5 at 15:06
  • 1
    Have you disabled NetworkManager and enabled dhcpcd? By default Bookworm uses NetworkManager which includes AP functionality and should be simpler to setup (no additional software required). See raspberrypi.stackexchange.com/q/145593/8697
    – Milliways
    Commented Mar 5 at 21:43
  • @Milliways That was it? If you write that as an Answer i would mark it as accepted. Otherwise i'll write the Answer. Thanks a lot! Commented Mar 8 at 13:06
  • Which suggestion - disabling network manager (not recommended) or using it to create a hotspot?
    – Milliways
    Commented Mar 8 at 21:41

1 Answer 1

1

By default Bookworm uses NetworkManager

If you want to use dhcpcd you should enable this in raspi-confug.

NetworkManager is the new Raspberry Pi OS default network manager (and is used by most Linux distros)

NetworkManager includes AP functionality and is simpler to setup (no additional software required). See How do I set up networking on Raspberry Pi OS - Bookworm

sudo nmcli device wifi hotspot ssid 'RaspberryPiNet' password '…' will setup a basic hotspot but it can be done through the GUI menu and additional configuration is possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.