I have a pi zero W and I'm wanting to be able to switch it between AP and client mode whenever I want without rebooting.

Neither of these two posts helped.
Switching between AP and Client mode
Switch between AP and client mode

I used the method on the raspberry pi website to configure my pi as an AP (stopping at "add routing and masquerade"), but that assumes I'll never want to switch back. Also, I'm quite restricted in how I use it because I'm relying entirely on SSH to send these commands, so if both AP and client mode get disabled somehow, I'll need to edit the SD card directly to fix it.

Any help is appreciated.

Edit: I'm currently using a workaround where when I want to switch, I enable and disable hostapd and wpa_supplicant respectively, and then copy a /etc/dhcpcd.conf so that it uses in AP mode, and whatever the router wants in client mode. I just want to do this without rebooting and without overwriting config files every time.

1 Answer 1


With Raspbian Jessie and Stretch systemd comes more and more to play. A wifi client connection and an access point are services that can be very good managed with the advanced options of systemd. Look at Switch between wifi client and access point without reboot how to use systemd-networkd for swapping this two services.

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.