Rather frequently, my iMac with a 1Gb ethernet drops to 100Mb/s connection speed. I can unplug the cable, plug back in a second later, and the speed restores to 1000Mb/s. I recently discovered that I can get the same positive effect by executing:
sudo ifconfig en0 down
sudo ifconfig en0 up
In either case, it's very annoying and not a problem I've experienced on my MacBook or older iMac. I've also tried re-installing the entire OS from scratch, replacing cables, and replacing network switches and routers. So, all things point to the iMac ethernet adapter or macOS. Oh, and restarting the system also corrects it. So, it loses speed over time and I haven't correlated it to any particular application or event.
What could be happening and how do I fix it?