I've upgraded my motherboard from an "MSI B450 Tomahawk Max" to an "MSI Mag X570S Torpedo Max". I did not reinstall Ubuntu and initially, on the first boot, everything seemed to be working fine.
From the second restart onwards, my wired internet has slowed to a crawl. It seems there is a long delay when initially trying to create connections, but once the connection has been made, the speed is reasonable.
For example, I am able to download packages using apt-get and using tools like wget and curl work reasonably well. However, I can't install snaps though, they always fail with "unexpected HTTP status code 408 via POST to 'https://api.snapcraft.io/v2/snaps/refresh". Both Firefox and Chrome take a very long time to load everything. We are talking multiple minutes with several refreshes just to bring up the google home page. I can see in the network panel that many resources are just failing to load because it is taking so long to connect and by refreshing, I am serving up the successful ones from a local cache allowing more connections to succeed next time. Once they do connect, they download quite fast.
I have tried running speedtest-cli and regularly get "Cannot retrieve speedtest configuration ERROR: The read operation timed out". When it does manage to do so, the download speeds measured vary wildly and are sometimes terrible and sometimes okay. I have a ~100MB connection and the fastest I've measured is 103.81MB but it will often measure 80, 60 and even as low as 2MB, quite often.
I have tried the following with no change in behavior:
- Running an Ubuntu live USB.
- Downgrading from r8169 to r8168.
- Switching to a different Ethernet port (the motherboard has 2: 1GB and 2.5GB)
- Setting network.dns.disableIPv6 to true in Firefox.
- Switching ethernet cables
- Switching back to the original motherboard
Update Fixed it. It was my router. See my answer.