Raspberry pi loses network on restart

Technical Problem

I'm trying to figure out this problem.

Whenever the pi (a pi 4) restarts, it loses network connectivity. The way that I have found around this is to log in manually and do sudo dhclient -r, which releases the lease. I then do sudo dhclient, which obtains a fresh IP address. Sometimes it's the same IP, sometimes its different.

So, what did I break and how do I fix it?

Edit for the solution:

I didn't break anything, this is actually a known bug in the linux system. Gist is that if you have too many network interfaces, dhcpcd crashes.

Adding denyinterfaces veth* to /etc/dhcpcd.conf works, as does shutting down your containers prior to restart. I chose the former.

Github discussion.

I finally caught it because I was able to track down the issue to dhcpcd.service, which had a single line in there about 'route socket overflowed'.

Posted Apr 8, 2022, 12:28 PM UTC · edited

116
alzee76•

Check the logs (grep -i dhcp /var/log/syslog | more) or get a screen or serial console hooked up and watch what it's doing during bootup.

4
iaalaughlinOP•

I appreciate that! It looks like what is happening is that the pi is querying for an IP using the wrong netmask (255.255.255.255 instead of 255.255.255.0).

1
alzee76•

What gives you that impression? 255.255.255.255 is not necessarily a netmask, it is also the broadcast address.

2
iaalaughlinOP•

It's running DHCPDISCOVER on 255.255.255.255 and then having No DHCPOFFERS received.

When I look at the actual connection, the netmask is 255.255.255.0

1
alzee76•

It's running DHCPDISCOVER on 255.255.255.255 and then having No DHCPOFFERS received.

That's what I suspected, and is perfectly normal. That isn't an netmask, it's a network address. Specifically it's the broadcast address. Every machine on the network receives traffic sent to it. This is how it searches for the DHCP server, which it can't find.

Netmasks are unrelated.

1
CodeNameRebel•

So in theory if you wanted to be lazy (and not find the true culprit) couldn’t you just script those commands to run after start up?

1
iaalaughlinOP•

Yes. But I want to find the true culprit.

1
tschloss•

Maybe it is a timing issue?

Here is an article about troubleshooting DHCP - maybe you find sth. https://www.redhat.com/sysadmin/troubleshoot-network-dhcp-configuration

1
boondogglekeychain•

I know it’s not the answer you’re after but you could just assign it a static IP

1
iaalaughlinOP•

I have considered that. I think after I make a good evaluation of what is on it and what I need to keep, I’m just gonna nuke it and start over. If that doesn’t fix the issue, I’ll set a static IP.

1
[deleted]•

[removed]

1