I saw intermittent success DNS query resolution with numerous failures. Giving one of the following errors.
;; Got bad packet: bad label type
78 bytes
;; Got bad packet: FORMERR
94 bytes
;; Got bad packet: bad compression pointer
78 bytes
In my case, it was a bad resolver in my resolv.conf. I actually saw a number of issues with my dig. This was a miss configured resolver on my local wifi router.
Trying switching it off and on again. In my case, they had hardcoded it to use the ISP networks name servers which were also not resolving IP address correctly.
I had a combination of problems. First, my Huawei wifi / LTE router was set as the default resolv.conf via DHCP.
I need to disable this being set via DHCP in network manager. nameserver 192.168.8.1. And force it to use the open DNS resolvers from google / Cloudflare.
cat /etc/resolv.conf
# Generated by NetworkManager
search one.one.one.one google-public-dns-a.google.com
nameserver 192.168.8.1
nameserver 1.1.1.1
nameserver 1.0.0.1
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 8.8.8.8
nameserver 8.8.4.4
My second issues were that I had included a search domain of search one.one.one.one google-public-dns-a.google.com. I had not used this wifi connection on this laptop in a long time and the setting I had put there was from so experimenting I was doing. Which added to the problems I was seeing. bad label type
I need to change my network in the network manager.
Under IPv4 settings -> Method -> Automatic (DHCP) addresses only.
This must not be Automatic (DHCP). As this includes whatever your DHCP server sets. Including a local network DNS server, from ther routers IP 192.168.8.1.
I put in two of the best open DNS resolvers on the internet googles public dns and cloudflares public dns
Save your settings and reconnect to your network.
My resolv.conf looked like this afterwards.
cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 8.8.8.8
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 8.8.4.4
My DNS resolution was working correctly after that point.