Lost IPv4 connection on Raspberry

I want to share the following solution because I did not find it on the internet (yet).
Luckily I had made some notes of commands and thought this one might work.

Problem
After a power-dip I lost my IPv4 connection on my OpenHab running on a Raspberry Pi.
First I thought the dip bricked my card but then I noticed the IPv6 connection was still working.
On Internet I did not find my solution, only a temp solution valid for a single session to activate IPv4:

sudo dhclient -4 -v eth0

Solution
Long story short, the solution was simple, remove any existing leases on the PI and reboot:

sudo rm /var/lib/dhcp/*
sudo reboot now

Possible Root cause(s)
Apart from the powerdip, I changed 3 months ago ISP/router (can not remember I needed to reboot PI). The later ISP was cable (ZIGGO) where I used a reserved DHCP in the router for the PI (so no static settings).

TIP
It can be easier (in Putty) to access your device with its IPv6 address

Details
Release = Raspbian GNU/Linux 9 (stretch)
Kernel = Linux 4.19.66-v7+
Platform = Raspberry Pi 3 Model B Plus Rev 1.3
OpenHAB 2.5.10-1 (Release Build)

Hope this is useful for others with similar problems

2 Likes

Thanks for letting us know about your solution.

stretch is pretty old and much has changed since.
Consider moving to openHABian. That should be as easy as to install from image (use clonebranch=stable to get OH2) and to import your config (openhab-cli backup|restore ...).

Thanks for your reply, I am already working with OpenHabian from day 1. did notice I can update, tried this update but this failed. Tried again with the following message:

You are about to install or change to the latest stable openHAB3 release.
Please be aware that downgrading from a newer unstable snapshot build is not
officially supported. Please consult with the documentation or community
forum and be sure to take a full openHAB configuration backup first!

When I continue followed by:

There was an error or interruption during the execution of:
“03 | Install openHAB”
Please try again. If the error persists, please read /opt/openhabian/docs/openhabian-DEBUG.md or
openhabian/docs/openhabian-DEBUG.md at main · openhab/openhabian · GitHub how to proceed.

First I do not ask for support on above, I know I must read, OH is still running fine but so flawlessly during a long time that I need to reboot (=read) my own memory banks.

I also prepared a PI4 for Openhab(ian) with the latest image. Wonder (=question) if I can restore the PI3 backup to the PI4 and have an almost working system (apart from Influx, Graphana and replacing Mosquitto MQTT?)

Pay attention, there’s various levels of what you can update: the OS, the openHABian framework, openHAB itself. Menu 03 for example just updates openHAB.

Starting over (instead of upgrading) is a clever way to leapfrog upgrade issues.
BUT you cannot restore an openHAB2 config to an openHAB3 system.
That’s why you should install a new system with openHAB 2 (see my last post, use clonebranch), restore your config and then upgrade openHAB by choosing the menu option 03.
That’ll migrate your OH config, too.

1 Like

Check to make sure another device hasn’t been issued 192.168.2.97 after the router restarts.

1 Like

Pineda784 welcome to the community

Off topic now: I think you assume I use my RPI with a static IP-address. I prefer to use the DHCP-server of my router and reserve some of the IP-addresses (like NAS and Openhab). Benefit when you ever swap router / IP-range eg 192.168.0.xx to 192.169.2.xx your devices will still be (easier) accessible.

When I found the following statement on the internet:

sudo grep dhcp /var/log/syslog

I realised that your comment was indeed the reason of the problem but checks inside the DHCP-settings of the router and an Android APP called “Net Scan” did not show that the IP-address was already issued. However the output of this statement made it very clear:

openhabian dhcpcd[425]: eth0: probing address 192.168.0.254/24
openhabian dhcpcd[425]: eth0: hardware address 00:00:00:00:00:01 claims 192.168.0.254
openhabian dhcpcd[425]: eth0: DAD detected 192.168.0.254

So thanks.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.