I've got an RPi and it has been running with a static IP for about 2 years. In /etc/network/interfaces I have the following:

auto lo

iface lo inet loopback
#iface eth0 inet dhcp

iface eth0 inet static

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

It has been set like this for a long time. The IP address chosen is within the static IP range set on the router. However, just recently it hasn't been getting that IP address. When I run ifconfig, I get this:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:24:90:a5
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::ba27:ebff:fe24:90a5/64 Scope:Link
          RX packets:52387 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42659 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6278878 (5.9 MiB)  TX bytes:7276493 (6.9 MiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:680640 (664.6 KiB)  TX bytes:680640 (664.6 KiB)

It's picking up Why would this suddenly happen? I've tried restarting networking and rebooting it but it still gets that IP address.

I'm using jessie:

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION="8 (jessie)"

Output from journalctl -b -u dhcpcd.service is:

-- Logs begin at Mon 2018-07-16 02:02:21 BST, end at Tue 2018-07-17 10:39:02 BST
  • Curious - maybe it gets a dynamic ip address now? Have you done an update last time? And please edit your question and add the output from journalctl -b -u dhcpcd.service. I haven't jessie running, only stretch and don't know if the command works with jessie. But maybe we can see if dhcpcd gets a new ip address. – Ingo Jul 17 '18 at 8:39
  • Updated the question with the output but there wasn't anything. It's weird as it has been running with a static IP for a couple of years. I run apt to update it every now and then. It is poised to upgrade to stretch but I'd rather get this sorted first. – snert Jul 17 '18 at 9:45
  • Hang on. I didn't notice that at the bottom of etc/network.interfaces there as a line that now says iface default inet dhcp. That looks like it could be the culprit! I'll have a look. – snert Jul 17 '18 at 9:47
  • Ok, not sure how that line got added to the interfaces file. Commented that out and did a restart. Cleared the lease on that IP on the router and now it has come back up with the right static IP as it should – snert Jul 17 '18 at 10:01

An update had added a line to the /etc/network/interfaces at some point. It had added:

iface default inet dhcp

despite my removing that a long time ago by commenting it out earlier in the file. Commenting out the new addition, rebooting the pi and clearing the DHCP lease on the pi on the router allowed it to pick its static IP up again.

I still have no idea what updated that file because it wasn't me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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