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"
}