0

I configured my Raspi (3B+, Raspbian Stretch) as a WLAN Access Point, as described here: https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

Now I want to switch my Raspi back to a normal WLAN configuration where it connects to a WLAN where I provide SSID + PSK - but it seems I somewhere got lost between configuration of access point mode and other configuration steps.

What is the minimum set of services to shut down, to make it a normal WLAN client again? I don't want to uninstall anything, but disable configurations in the end via shell scripts. Goal is that I can easily switch between AccessPoint mode and Client of a stationary WLAN. Note that AdHocWifi is no option for me; Android Clients must be able to connect while in AccessPoint mode.

I did already configure network/interfaces to disable "static" mode, and and also tried to disable config in but id did not work.

Then I tried, according to Switch between AP and client mode, to stop the unneeded services and start wpa_supplicant:

xxx@coneCube:~ $ sudo service hostapd stop
xxx@coneCube:~ $ sudo service udhcpd stop
xxx@coneCube:~ $ sudo service wpa_supplicant start
xxx@coneCube:~ $ ifconfig
[...]
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    ether b8:27:eb:5c:7f:f7  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 72  bytes 14234 (13.9 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

xxx@coneCube:~ $ sudo ifdown wlan0
Killed old client process
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/b8:27:eb:5c:7f:f7
Sending on   LPF/wlan0/b8:27:eb:5c:7f:f7
Sending on   Socket/fallback
xxx@coneCube:~ $ sudo ifup wlan0
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/b8:27:eb:5c:7f:f7
Sending on   LPF/wlan0/b8:27:eb:5c:7f:f7
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7

As you see, it doesn't get a connection to the DHCP of the WLAN.

My /etc/network/interfaces.d/wlan0 configuration:

auto wlan0
allow-hotplug wlan0

#WLAN-AP BEGIN
#iface wlan0 inet static
#   address 192.168.5.1
#   netmask 255.255.255.0
#   post-up route add default gw 192.168.5.1
#   pre-down route del default gw 192.168.5.1
##wireless-essid coneCube34f214a0
##wireless-channel 1
#WLAN-AP END

#WLAN-CONNECTED BEGIN
iface wlan0 inet dhcp
wpa-ssid "MyWlanSSID"
wpa-psk "MyHighlyConfidentalPSK"
#WLAN-CONNECTED END

When I enter a wrong key for the psk (typo: woa-psk instead of wpa-psk) I didn't get ANY error that the config was wrong!

My dhcpcd.conf is fully commented-out because no local DHCP server in use when using wpa_supplicant (this is at least the goal)

Currently running services (overview):

xxx@coneCube:~ $ sudo service  --status-all
 [ - ]  alsa-utils
 [ + ]  avahi-daemon
 [ + ]  bluetooth
 [ - ]  console-setup.sh
 [ + ]  cron
 [ + ]  dbus
 [ + ]  dhcpcd
 [ + ]  dnsmasq
 [ + ]  dphys-swapfile
 [ + ]  fake-hwclock
 [ - ]  hostapd
 [ - ]  hwclock.sh
 [ - ]  keyboard-setup.sh
 [ + ]  kmod
 [ - ]  networking
 [ - ]  nfs-common
 [ - ]  paxctld
 [ - ]  plymouth
 [ - ]  plymouth-log
 [ + ]  procps
 [ + ]  raspi-config
 [ - ]  rpcbind
 [ - ]  rsync
 [ + ]  rsyslog
 [ + ]  ssh
 [ - ]  sudo
 [ + ]  triggerhappy
 [ + ]  udev
 [ - ]  udhcpd
 [ - ]  x11-common

1 Answer 1

1

You can use systemd-networkd that is able to manage services with dependencies. You can simply make two independent services, one for the access point and one for the client connection. This can all be done with wpa_supplicant. Now you can stop one service and start the other. How to do it you can look at Switch between wifi client and access point without reboot.

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.