My Pi is set to a static IP. But after a few hours or days it is suddenly no longer reachable on this IP. I now figured out that when this happens the wlan0 interface is no longer on this static IP but on a different one...

This is my interfaces file

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

auto wlan0
iface wlan0 inet static

This morning it was on, but now it is on How can this happen?

  • I always advise against setting the IP static in the PI, do so in your router if possible. What version of raspbian are you running? I had wifi issues with Wheezy in the past, moving to Jessie has resolved that for me. (Pi2)
    – Havnar
    Feb 18, 2016 at 14:51
  • Unfortunately my router does not support static IP... I am on wheezy...
    – Reto
    Feb 18, 2016 at 14:59
  • are you perhaps using the retropie image?
    – Havnar
    Feb 18, 2016 at 15:35
  • I am using the wheezy image from raspberrypi.org
    – Reto
    Feb 18, 2016 at 15:43
  • You have both auto wlan0 and allow-hotplug wlan0. Could it be that your usb draw too much power, the usb disconnects (maybe just for a few seconds). Then it falls back to eth0 which gets a new IP via DHCP. Then you're wlan0 card comes back up and your connection changes. In other words: is probably eth0 not wlan0. Try sudo ifconfig to check
    – kba
    Feb 18, 2016 at 15:45

1 Answer 1


"My Pi is set to a static IP" - No it isn't! You have 2 different settings for wlan0. It is unpredictable what would happen.

See https://raspberrypi.stackexchange.com/a/37921/8697 for a tutorial on how to setup.

  • Thank you for the link to your tutorial. But I cannot see why I have two different settings. Because of manual and static? Can I correct this without changing everything do dhcpcd?
    – Reto
    Feb 19, 2016 at 8:15
  • iface wlan0 inet manual and iface wlan0 inet static are attempting to configure wlan0 in different ways. Pick one or the other. If you really want static I recommend the method in the tutorial. If you want to use the older (less robust) method you should disable dhcpcd . This is disabled because you invoke dhcp.
    – Milliways
    Feb 19, 2016 at 8:41
  • I removed iface wlan0 inet manualbut now I have no more connection. So I will have to try the new method.
    – Reto
    Feb 19, 2016 at 12:18
  • Where do netmask, broadcast etc. go? Is this not needed here? Compared with the above, is this what I should have in dhcpcd.conf? interface wlan0 static ip_address= static routers= static domain_name_servers=
    – Reto
    Feb 19, 2016 at 13:02
  • @Reto NOTE You should have removed iface wlan0 inet static and all reference to dhcp (as per the tutotial) NOT iface wlan0 inet manual. You have a choice to use dhcpcd or not. If not you should disable it.
    – Milliways
    Feb 19, 2016 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.