Ethernet has very slow speeds and timeouts every 20 minutes until I restart NetworkManager

Modems (or rather, usually Routers) have the ability to set DNS.
And, if you have never actively set your DNS on your computer system … thats likely the DNS it is using.
I generally encourage people to set it to something other than whatever the ISP provides.
For speed and security reasons.
There are a number of factors when deciding what DNS to use, and a number of ways to implement that decision.
For now I will assume you can and will use your router to do this …
but if you are interested I wrote a quick setup of how I use systemd-resolved here:
After laptop resumes from Standby I lose DNS - #2 by cscs

Anyways moving on … heres a little script to test and rank some popular DNS providers:
(Edit - added in link to dedicated thread)

Old pasted script
#!/usr/bin/env bash
#
# dns speed test
#
if [[ -z "$DOMAIN" ]]; then
    DOMAIN=wikipedia.org
fi;
CURRENTDNS=$(dig "$DOMAIN" | grep SERVER | awk -F'[)(]' '{print $2}')
if [[ -z "$SKIP" ]]; then
    echo
    echo " Test common resolvers by calculating average response times of 3 queries."
    echo
    annc() {
        echo
        echo " DNS Primary  Secondary"
        echo
        echo " Adguard 94.140.14.14 94.140.15.15"
        echo " CleanBrowsing 185.228.168.9 185.228.169.9"
        echo " Comodo 8.26.56.26 8.20.247.20"
        echo " Control-D 76.76.2.2 76.76.10.2"
        echo " Cloudflare 1.1.1.1 1.0.0.1"
        echo " Google 8.8.8.8 8.8.4.4"
        echo " Neustar 156.154.70.2 156.154.71.2"
        echo " NextDNS 45.90.28.97 45.90.30.97"
        echo " OpenDNS 208.67.222.222 208.67.220.220"
        echo " Quad9 9.9.9.9 149.112.112.112"
        echo
    }
    printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
    annc | column -tL
fi;
if [[ -n "$TESTDNS" ]]; then
    echo "Custom Test DNS $TESTDNS"
fi
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo
while true; do
    read -p " Do you wish to flush the DNS cache? " yn
    case $yn in
        [Yy]* ) resolvectl flush-caches; break ;;
        [Nn]* ) break ;;
        * ) echo -e "\n Please answer yes or no.\n" ;;
    esac
done
echo
echo "Current DNS $CURRENTDNS"
for reps in {1..3}
do
    dig "$DOMAIN" | awk '/time/ {print $4 " ms"}'
    sleep 1
done | awk '/ms/ {sum+=$1} END {print "Avg time: ",sum/3, " ms"}'
echo
if [[ -z "$SKIP" ]]; then
    rank() {
        for resolver in "Adguard 94.140.14.14" "CleanBrowsing 185.228.168.9" "Comodo 8.26.56.26" "Control-D 76.76.2.2" "Cloudflare 1.1.1.1" "Google 8.8.8.8" "Neustar 156.154.70.2" "NextDNS 45.90.28.97" "OpenDNS 208.67.222.222" "Quad9 9.9.9.9";
        do
            echo "$resolver"
            for reps in {1..3}
            do
                dig "$DOMAIN" "@${resolver#* }" | awk '/time/ {print $4 " ms"}'
                sleep 1
            done | awk '/ms/ {sum+=$1} END {print "Avg time: ",sum/3, " ms"}'
            echo
        done
    }
    rank;
fi;
if [[ -n "$TESTDNS" ]]; then
    echo "Custom Test DNS $TESTDNS"
    for reps in {1..3}
    do
        dig "$DOMAIN" "@$TESTDNS" | awk '/time/ {print $4 " ms"}'
        sleep 1
    done | awk '/ms/ {sum+=$1} END {print "Avg time: ",sum/3, " ms"}'
    echo
fi
exit

(save, mark executable, run … it will give you an average response time for each)
Note: It uses dig which is provided by the package bind.

2 Likes