I’m having intermittent problems with my ethernet not connecting or limited connectivity after resuming from sleep. I usually have to reboot to correct the issue. I replaced my ethernet cable from router to my pc
I have this problem on a ThinkPad T450s, which uses an I218-LM ethernet device. I fixed this by writing a systemd script that unloads/reloads NetworkManager and the e1000e device driver on suspend/resume.
As root, I created the file /usr/lib/systemd/system-sleep/network with the following contents:
#!/bin/sh
if [ "$1" = "pre" ] ; then
/bin/systemctl stop NetworkManager.service
/bin/ip link set enp0s25 down
/sbin/modprobe -r e1000e
else
/sbin/modprobe e1000e
/bin/sleep 1s
/bin/ip link set enp0s25 up
/bin/systemctl start NetworkManager.service
fi
exit 0
I used the ip a command to determine the device name for ip link, and the lspci -v command to determine the driver name for the modprobe.
Make the script executable using:
sudo chmod +x /usr/lib/systemd/system-sleep/network
I’d have thought that you should put that file into /etc, but I cannot find a man page saying where in to put it odd…
This has the details about where to put the sleep scripts and how systemd calls them:
man systemd-sleep
I do not is it does identify a location outside of /etc. Where as all the system conf can be overridden in /etc.