What is the DNS cache?
DNS is the phone book of the internet. It turns a site name, like example.com, into a number called an IP address. A cache is a short-term memory. Your computer saves each answer so it does not have to ask again. This is fast. But after you move a site, the saved answer can be old. Clearing the cache makes your computer ask again.
Before you start
Open a terminal. The terminal is the window where you type commands. You need admin rights, so most commands start with sudo. Sudo means "run as the boss user".
Linux has several ways to do DNS. The right command depends on what your system uses. Try the ones below until one works.
Steps
- Check if you use systemd-resolved:
If it printssystemctl is-active systemd-resolvedactive, use step 2. - Clear the cache:
On older systems use this instead:sudo resolvectl flush-cachessudo systemd-resolve --flush-caches - Check that it worked:
The cache size should show 0 entries.resolvectl statistics
Other DNS programs
- nscd: run
sudo systemctl restart nscd. - dnsmasq: run
sudo systemctl restart dnsmasq. - BIND (named): run
sudo rndc flush.
Each command either empties the saved answers or restarts the program that holds them.
If it does not help
- Clear your browser cache. Browsers keep their own saved addresses.
- Close and reopen the browser.
- Wait. Changes to DNS can take a few hours to spread across the internet.
- Ask Hostvento support if the site still points to the wrong place.
nslookup yourdomain.com to see which IP address your computer gets. Use your own domain name.Quick recap
- DNS cache is your computer's memory of site addresses.
- Old memory can show an old site.
- Most systems use
sudo resolvectl flush-caches. - Other programs need a restart.
- Clear your browser cache too.