After scouring for ages looking for this fix. I’ve decided to document it.
It comes form a number of sources. Kudos to the individual people.
Problem
Rebooting from windows into Linux renders the NIC unusable. the classic “lights are on but no one is home”
Some people advice disabling PXE etc in the bios. There is a better solution
Identify the NIC
root@dave-pc:/lib/systemd/system# lspci | grep Ether
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-V (rev 04)
Create a systemd oneshot service file
cat <> /lib/systemd/system/intelnicreset.service
[Unit]
Description=Reset Intel Nic on Boot before it comes up
Before=NetworkManager.service
Wants=NetworkManager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/resetintelnic
RemainAfterExit=no
[Install]
WantedBy=multi-user.target
EOT
Reset NIC bash file
cat <> /usr/bin/resetintelnic
#!/bin/bash
#Get the PCI-Address of network card (Caution: This works ONLY with ONE NIC)
PCI=`/usr/bin/lspci | /bin/egrep -i 'network|ethernet' | /usr/bin/cut -d' ' -f1`
PCIPATH=`/usr/bin/find /sys -name *\${PCI} | /bin/egrep -i *pci0000*`
/usr/bin/logger -t "ResetNIC" "Resetting PCI NIC ${PCIPATH}"
#Reset the PCI Device completely (like Power-ON/Off)
echo 1 >${PCIPATH}/reset
EOT
Make it executable
chmod +x /usr/bin/resetintelnic