Unstable IP address on Raspberry PI

Viewed 20

We have a PI 4 running lastest 64 OS. The PI is connected to another device with a network cable. When a 3rd party App starts up on the PI, it setup the eth0 interface on the PI with:

sudo ifconfig eth0 up
sudo ifconfig eth0 192.168.140.2 netmask 255.255.0.0

(the IP and mask are sent from the device via gpio but that is not relevant here)

After that the two devices can communicate via the network cable. Everything works fine except that the IP address on the eth0 is very flaky. For example, if the devices are moving around and switch from one wifi network to another, or lose wifi completely, the IP on the eth0 may change to some default IP address. We talked to the manufacture of the device and they said that should not happen and maybe something is wrong with our PI. But we have tried three different PI's and the result is the same. Furthermore, we set a static IP address in the file /etc/dhcpcd.conf and still the IP would drop once in a while. When we position the mouse on the Network icon at the top-right corner, the popup window shows that eth0 is configured to the static IP address, but when we run "ifconfig eth0", the output shows only the IPv6 and no IPv4 address.

Any ideas what could be the culprits here? Thanks.

0 Answers
Related