1

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"
}
asked Jan 13, 2016 at 20:04
15
  • what version of Raspbian are you running Commented Jan 13, 2016 at 20:09
  • Latest Jessica 8.0 Commented Jan 13, 2016 at 20:11
  • 1
    Jessie (dyac!)... Commented Jan 13, 2016 at 20:12
  • 2
    raspberrypi.stackexchange.com/q/37920/5538 Commented 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. Commented Jan 13, 2016 at 20:18

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.