User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Static IP for wlan0 on RPI2 does not work anymore

Thu Oct 15, 2015 4:05 pm

Hello Everybody!

It seems that there have recently been some changes to the way a static IP can be requested by the RPI 2 for itself.
Until now I had the following code in /etc/network/interfaces and it worked perfectly:

Code: Select all

iface wlan0 inet static
        address 192.168.0.122
        netmask 255.255.255.0
        network 192.168.0.1
        broadcast 192.168.0.255
        gateway 192.168.0.0
        wpa-ssid "My network"
        wpa-psk "***"
Well, not since I ran an update today. It seems that from now the static IP has to be requested somehow using /etc/dhcpcd.conf.
I've read every post about this I could find and I wasted hours trying to fix it, but it just won't work. Can somebody please guide me how to transfer my data from /etc/network/interfaces to /etc/dhcpcd.conf? Or any other way to fix this would be greatly appreciated.

My house's heating system relies on two RPIs so now I'm left without heating.
I just can't understand how they could introduce such a major change without backward compatibility and with no clear guide on how to set it up...

PS: the same code that I've shown you in my /etc/network/interfaces still works fine for my older RPI1 devices, but the RPI2 is messed up now.

Thanks!
Andras
http://iqjar.com

User avatar
DougieLawson
Posts: 36544
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Static IP for wlan0 on RPI2 does not work anymore

Thu Oct 15, 2015 8:53 pm

sudo apt-get purge ifplugd raspberrypi-net-mods

That will put it back to the old way.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: Static IP for wlan0 on RPI2 does not work anymore

Thu Oct 15, 2015 8:55 pm

Thank you!
Andras
http://iqjar.com

User avatar
DougieLawson
Posts: 36544
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 12:04 am

I've just spent a lot of time working with dhcpcd and raspberrypi-net-mods to get a static address working. I'll post more details tomorrow.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 5:42 am

It is not the first time when I find useful help in your answers, Dougie! Many thanks! Let us know what you will figure out.
Andras
http://iqjar.com

User avatar
DougieLawson
Posts: 36544
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 7:07 am

Un4Seen wrote:It is not the first time when I find useful help in your answers, Dougie! Many thanks! Let us know what you will figure out.
I've posted the new stuff in the other forum thread. It's quite a simple change.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 6:08 pm

Thank you!
Can't seem to find your answer in the other thread. Can you please link it here?
Andras
http://iqjar.com

User avatar
DougieLawson
Posts: 36544
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 7:49 pm

Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Oct 16, 2015 7:55 pm

Thank you! I saw this one, but I thought there was a more recent one.

I've tried everything, didn't work.
So I tried what you have suggested:

Code: Select all

sudo apt-get purge ifplugd raspberrypi-net-mods
Oddly it removed ifplugd but raspberrypi-net-mods was not installed. Perhaps that's why I couldn't get it to work.

Anyway, now everything is back to normal.
One thing is certain: I've lost my confidence in running apt-get update.
Andras
http://iqjar.com

milanc
Posts: 1
Joined: Fri Mar 24, 2017 5:03 pm

Re: Static IP for wlan0 on RPI2 does not work anymore

Fri Mar 24, 2017 5:31 pm

If you want to use the old way:

# apt-get purge dhcpcd5
# apt-get install isc-dhcp-client ifupdown

configure the /etc/network/interfaces the old way, where 'manual' means 'manual', 'dhcp' means 'dhcp' and 'static' means 'static.

If you use 'the new way' there are couple of things to worry about when configuring /etc/network/interfaces:
- if the interface is configured as 'manual' then ifupdown will not bring the interface automatically - leaving it to dhcpcd5
- if it is configured as 'auto' and/or 'allow-hotplug', and 'dhcp' or 'static' ifupdown will bring it up automatically. And if dhcpcd5.conf does not specify the same interface with 'denyinterfaces', dhcpcd5 will bring it up as well, obtaining the IP address again (and it may be a different one)

Altohugh /etc/network/interfaces belongs to ifupdown package, it seems that dhcpcd5 typically co-exists with ifupdown, and it would be usefull if there was an official documentation in dhcpcd5 how these two can coexist.

Return to “Troubleshooting”