Ping use another DNS
Seems that Ubuntu 20.10 has two (2) DNS caches:
systemd-resolve
nscd
Flushing the DNS cache with the following command didn't work for me:
sudo systemd-resolve --flush-caches
After disable/enable the network and the wifi connection, or rebooting the system, the problem was still there:
nslookup
, dig
and other commands works
ping
doesn't work
All the system configuration was ok, but some addresses where like fixed somewhere.
After searching on different sites I found the problem: there was another DNS cache and ping
seems to use that.
To clear the second DNS cache just run:
sudo nscd -i hosts
Flush BOTH DNS caches
You can do it alltoghether, just copy and paste on a terminal:
sudo systemd-resolve --flush-caches
sudo nscd -i hosts
Checking DNS cleared
Not sure if this works? Just take a look:
sudo systemd-resolve --statistics
sudo nscd -g
/etc/hosts
. I've just been sure that the old IP address of my domain was being cached, but onlystrace ping example.com
revealed that I forgot to remove the/etc/hosts
record which I added a time ago because of lacking patience for DNS propagation.