New Dell 7090 Tower - Installed Ubuntu 20.10, 21.04 and 21.10 - Getting network packet loss until usb thumb drive plugged in

An MTU of 1500 is the default and should be good in most situations. That said, some networks need something smaller, such as 1492, and do not communicate this as part of the initial negotiation. It would be a good idea to do some testing to see whether the MTU setting is the reason for your excessive packet loss.

Here's how:

  1. If you have made any changes to your /etc/dhcp/dhclient.conf file, remove them and reboot the server

  2. Use ping to check for packet loss while changing the MTU setting:

    ping -c 4 -M do -s 1472 151.101.193.69
    

    Definitions:

    Option Definition
    -c 4 Count ⇢ The number of times to iterate
    -M do Set path MTU discovery strategy ⇢ do will not allow fragmentation at any level
    -s 1472 Packet size in bits (1472 + 28 overhead = 1500)
    151.101.193.69 The IP address for AskUbuntu. Feel free to use any address, but avoid Google-owned services as they will not always respond to ping requests.

    You may see output like this:

    ping -c 4 -M do -s 1472 151.101.193.69
    PING 151.101.193.69 (151.101.193.69) 1472(1500) bytes of data.
    From 192.168.0.1 icmp_seq=1 Frag needed and DF set (mtu = 1454)
    ping: local error: message too long, mtu=1454
    ping: local error: message too long, mtu=1454
    ping: local error: message too long, mtu=1454
    
    --- 151.101.193.69 ping statistics ---
    4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3074ms
    
  3. Play with the -s value until you find no fragmentation and no message too long error. For example:

    ping -c 4 -M do -s 1200 151.101.193.69
    PING 151.101.193.69 (151.101.193.69) 1200(1228) bytes of data.
    1208 bytes from 151.101.193.69: icmp_seq=1 ttl=59 time=5.52 ms
    1208 bytes from 151.101.193.69: icmp_seq=2 ttl=59 time=5.72 ms
    1208 bytes from 151.101.193.69: icmp_seq=3 ttl=59 time=5.64 ms
    1208 bytes from 151.101.193.69: icmp_seq=4 ttl=59 time=5.68 ms
    
    --- 151.101.193.69 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3005ms
    rtt min/avg/max/mdev = 5.517/5.640/5.720/0.076 ms
    

    For this example, I found that 1200, which is an MTU of 1228 results in zero packet loss.

    Note: Ideally you would start at 1472 and work your way down in increments of 10 or so. If the MTU value is too low, your transfer speed will suffer.

  4. Set the appropriate MTU value for your network in your /etc/dhcp/dhclient.conf file:

    default interface-mtu 1228;
    supersede interface-mtu 1228;
    

    Note: Be sure to change 1228 to the appropriate MTU size for your network.

    If you have multiple interfaces, you can specify which one(s) should have what MTU value:

    interface "enp0s31f6" {
        default interface-mtu 1228;
        supersede interface-mtu 1228;
    }
    
  5. Restart networking and ensure the interface is up:

    sudo service networking restart
    sudo ifup enp0s31f6
    
  6. Verify the MTU value:

    sudo ifconfig | grep mtu
    

    Which may give you something like:

    docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1228
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    veth43316c1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    veth80786dc: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    vethf40bd74: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    

With this, hopefully your packet loss will be a thing of the past 👍🏻