I'm not sure exactly what is causing this bug. It could be hardware, the Linux driver, or Raspbian Lite's driver integration/version, so I'm posting it here.
I've tested this behavior on multiple Pi 3B+'s using the latest version of Raspbian Stretch Lite fully updated, and on three different LAN's. I also tried the new Raspbian Buster Lite one time and it showed the same problem.
Here's the bug:
If an Ethernet cable is connected and gets a valid connection at boot time, then there is only a 50/50 chance that a cable disconnect will trigger a Linux disconnect (eth0: carrier lost).
Simple test procedure:
Boot up a Pi 3B+ with a wired Ethernet connection
1. Check connection status (ifconfig eth0) connection must be running and have IP address
2. Disconnect Ethernet cable.
3. Wait a few seconds
4. Check connection status and record result
5. Reconnect cable
6. Wait a few seconds
7. Make sure connection is running and has IP address
Repeat steps 1 through 7
If there is no Ethernet connection at boot time, future cable disconnects correctly trigger the Linux disconnect. (tested to 99.99% certainty, 14 OK results in a row)
The link/activity LED always goes out when the cable disconnects (green 10/100 and yellow 1000 both verified).
The bug is truly random, I've recorded an overall result of about 50/50 but have seen runs of five in a row all OK and the same for all bad.
This does NOT happen on multiple Raspberry Pi 3B's that I tried, they always respond correctly to cable disconnects.
My workaround is to always make sure that the cable is disconnected at boot time or have console access to the Pi 3B+ so that I can recover without pulling the plug on a running system.
I believe there have been two other people who saw this bug and posted about it.
https://www.raspberrypi.org/forums/view ... p?t=219614
https://superuser.com/questions/1383238 ... -unplugged