My Pi Zero has a USB WiFi Adapter attached.
I want it to automatically connect to my home wifi network using a static IP. When I take it out and about... for walks, or whatever... I want to have it automatically connect to my iPhone hotspot.
At the moment, the Pi Zero automatically connects to my hotspot, so that's good. But, when I bring it home, it is given a random IP, rather than the Static IP I assigned it.
This is what I have so far:
In /etc/network/interfaces I have:
auto lo
iface lo inet loopback
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface phone inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface home inet static
address 192.168.1.123
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
and in /etc/wpa_supplicant/wpa_supplicant.conf I have:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MY SSID"
scan_ssid=1
psk="MY PSK"
id_str="home"
priority=15
}
network={
ssid="MY HOTSPOT NAME"
psk="HOTSPOT PSK"
id_str="phone"
}
-
what version of Raspbian are you runningSteve Robillard– Steve Robillard2016年01月13日 20:09:12 +00:00Commented Jan 13, 2016 at 20:09
-
Latest Jessica 8.0RPi user– RPi user2016年01月13日 20:11:50 +00:00Commented Jan 13, 2016 at 20:11
-
1Jessie (dyac!)...RPi user– RPi user2016年01月13日 20:12:27 +00:00Commented Jan 13, 2016 at 20:12
-
2raspberrypi.stackexchange.com/q/37920/5538goldilocks– goldilocks2016年01月13日 20:18:46 +00:00Commented Jan 13, 2016 at 20:18
-
the network settings and files have changed for Raspbian recently the short version only the ssid and psk go in the wpa_supplicant.conf file and the static details go in /rtc/dhcpcd.conf file more info can be found in my answer here. Especially the link for further info at the bottom. If that solution works let me know and I will mark this question as a dupe.Steve Robillard– Steve Robillard2016年01月13日 20:18:54 +00:00Commented Jan 13, 2016 at 20:18