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
address 192.168.1.42
gateway 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
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:192.168.1.144 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fe24:90a5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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:127.0.0.1 Mask:255.0.0.0
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 192.168.1.144. 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_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
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
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 08:39