Posts: 1
Joined: Thu Aug 08, 2019 11:22 pm

Static IP if wifi not found.

Thu Aug 08, 2019 11:25 pm

I am using the code below for two locations that I regularly have my pi, my question is I also take the pi to maker faires and run the pi headless. Is there a way to set up the wifi on the pi so if it does not find the two networks below it will assign an add hoc IP address (192.168.*.*) so I can still control my 3d printer if there is no access to the local wifi AP .

Code: Select all



ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

Posts: 5380
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Static IP if wifi not found.

Fri Aug 09, 2019 10:47 am

I think you have 2 options.
One would be to switch from client mode to AP mode, stopping wpa_supplicant and launching hostapd+dnsmasq as required. There is a recent thread about that.
The other would be to use wpa_supplicant in AP mode and let its network selection algorithm decide whether to start a client configuration or an AP configuration (mode=2). Then rely on autoipv4/v6 for IP address distribution and mDNS for the name service (in the .local) domain.

The second option is lighter as it relies on wpa_supplicant in any circumstance. It should work ok, the only part I haven’t tried myself is actually letting wpa_supplicant autoselect between a client and a “mode=2” network block.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Posts: 383
Joined: Mon Mar 19, 2018 1:18 pm

Re: Static IP if wifi not found.

Sun Aug 11, 2019 12:29 am

Comitup worked on my pi zero w

There-s also a bootable sd image with it installed and enabled.

Posts: 713
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: Static IP if wifi not found.

Sun Aug 11, 2019 2:46 pm

A simple, easy-to-install and use implementation of the second method epoch1970 mentioned (using wpa_supplicant only) can be found at
Pi tools:
Easily and quickly build customized-just-for-you SD Cards:
Free your network from your router's DHCP/DNS:
Easy strongSwan VPN installer/manager:
Lightweight Virtual VNC Config:

Return to “Networking and servers”