tl;dr: After my local network addressing scheme changed from 192.168.1.X to 192.168.21.X, my RPi failed to adapt and was still accessible via 192.168.1.2. When I added iface eth0 inet dhcp
as the last line of /etc/network/interfaces
file and rebooted my RPi, it stopped being accessible on any IP. What can I do to regain access to my box?
0. Intro
I have Raspberry Pi 3 B+ WiFi BT with 1GB RAM QuadCore 1,4 GHz and with Flightradar24 image. Previously I have reserved, on my router, a static DHCP assignment for my RPi, via MAC address, so I can access it all the time through 192.168.1.2 address. My Windows 10 is connected to the same network and also receives DHCP-based IP address, but it has no router-side reservation.
My previous router died and the new one, that I have received from my ISP, had some configuration problems so I was ultimately forced to use 192.168.21.X instead of 192.168.1.X addressing pool. All the DHCP-based devices adapted to this change, but not RPi.
I have configured my new router to always assign 192.168.21.41 this time to my RPi.
1. Old IP address
The original documentation says that RPi always uses DHCP by default. I doubt that Flightradar24 engineers has changed this when compiling their own image for RPi. But, in my case this seemed to be untrue, because I couldn't find my RPi's MAC address among list of clients connected to my new router (after replacing it and after local network addressing scheme changed from 192.168.1.X to 192.168.21.X).
Because I was aware that my old router was always assigning 192.168.1.2 to my RPi, I have temporarily forced my Windows 10 to use 192.168.1.3 IP address and 192.168.1.1 gateway and... bingo! I found my RPi at that address.
The ifconfig
has confirmed this:
pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255
ether b8:27:eb:13:bd:7f txqueuelen 1000 (Ethernet)
RX packets 4227 bytes 352722 (344.4 KiB)
RX errors 0 dropped 1100 overruns 0 frame 0
TX packets 2377 bytes 382278 (373.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 11265 bytes 1287027 (1.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11265 bytes 1287027 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:46:e8:2a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2. Not accessible at all?
I have found this cool guide which told me that after I execute cat /etc/network/interfaces
on my RPi, I will see iface eth0 inet
in the last line on-screen and either dhcp
or static
at the end, denoting the way my RPi connects to the network.
That also turned out to be not true, because in my case cat /etc/network/interfaces
revealed nearly an empty file:
pi@raspberrypi:~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
Please note that this file is written to be used with dhcpcd
For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
Following the same guide I have added missing iface eth0 inet dhcp
line to the end of /etc/network/interfaces
:
sudo cp /etc/network/interfaces /etc/network/interfaces.backup
sudo nano /etc/network/interfaces
iface eth0 inet dhcp
Ctrl+O (write file) / Enter (confirm filename) / "Wrote 11 lines" / Ctrl+X (Exit)
sudo shutdown -r now
After reboot, my RPi become completely not accessible:
- not under previous / old of 192.168.1.2
- not under auto-assigned by router of 192.168.21.41
- and not even under fallback 169.254.0.0 IP address
- it MAC (B8:27:EB:13:BD:7F) again doesn't appear on router's connected clients list.
(of course, I was changing my local PC with Windows 10's IP configuration each time, to match the one that I expected to have in RPi)
What should I do next? What can I do to get access to my box back?