Flush Your Computer DNS Cache

Flushing your DNS cache is separate from flushing your Browser cache.

Your computer’s operating system will save DNS information for sites you’ve recently visited, to load them faster. Sometimes that old information can conflict with the site’s most recent version

If your computer’s DNS cache is old or bad, some sites might just “not load”. They load on other computers, just not on yours.

Where I’ve seen this most, is when I use a notebook that hasn’t been used for a while. I mainly work on my desktop computer; the notebook I might not use for many weeks.

If a website hosting company changes the IP address of the server a site is on, the DNS records need to be updated. Normally that update happens seamlessly (probably with a “change of address” notice, for a while). If it doesn’t happen seamlessly, you can manually clear your DNS cache, so all DNS entries will be queried anew.

Types of Errors That Have Pages Not Load

Preloader

You might simply see the “loading” icon spinning endlessly. This could be a JavaScript error in the page preloader, not a DNS error. Try right clicking in your page, select the Inspector. Find the element that has “preloader”

<div id="si-preloader">
...<!-- Probably stuff here -->	
</div><!-- END .si-preloader-1 -->

Change this to not display the preloader, like this:

<div id="si-preloader" style="display:none;" >

DNS Propagation

You would see errors like “This site’s domain name is either not yet pointed or is still propagating. Propagation may take up to 72 hours. Please check back later.”

400 Bad Request

You might get a “400: Bad Request” error in your browser (similar to how when you attempt to visit a page that doesn’t exist, you get a “404 Not Found” error).

There are other problems that can give you a 400 error, including illegal characters in the URL. So check on that first, before you clear your DNS cache.
For example, spaces aren’t supposed to be in a URL, you’re supposed to replace a space character with %20. Instead of “somesite.com/error code.html” you should have “somesite.com/error%20code.html“.
Another problem would be a % sign in the URL that isn’t followed by one of the valid characters it can be paired with (for example a two-digit hexadecimal number).
Clearing your browser cache is another easy thing to do, that can eliminate a 400 Bad Request error.

Flush DNS Cache In Windows

open the command prompt (tap the Windows key, type cmd and press Enter).

ipconfig /flushdns

Flush DNS Cache In OS/X

open Terminal.

sudo killall -HUP mDNSResponder

If that doesn’t work, try

sudo discoveryutil udnsflushcaches

For more on mDNSResponder, http://manpagez.com/man/8/mDNSResponder/

Flush DNS Cache In Linux Mint and Ubuntu

https://www.techrepublic.com/article/how-to-flush-the-dns-cache-on-linux/

sudo systemctl is-active systemd-resolved

Responds “active”

sudo systemd-resolve --statistics

Responds with output like this:

"DNSSEC supported by current servers: no"
Transactions
Current Transactions: 0
Total Transactions: 924990

Cache
Current Cache Size: 74
Cache Hits: 16066
Cache Misses: 3662

DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0

use this command to flush your DNS cache:

sudo /etc/init.d/dns-clean start

Troubleshoot DNS — DIG Command

https://phoenixnap.com/kb/linux-dig-command-examples

The dig command in Linux is used to gather DNS information. It stands for Domain Information Groper, and it collects data about Domain Name Servers. The dig command is helpful for troubleshooting DNS problems, but is also used to display DNS information.

dig -v                      confirm you have it installed
dig google.com

The most important section is the ANSWER section:

The first column in the Answer section, lists the name of the server that was queried

The second column is the Time to Live, a set timeframe after which the record is refreshed

The third column shows the class of query – in this case, “IN” stands for Internet

The fourth column displays the type of query – in this case, “A” stands for an A (address) record

The final column displays the IP address associated with the domain name

Example:

; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38377
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		114	IN	A	142.250.68.110

;; Query time: 158 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Wed Jan 12 16:33:56 MST 2022
;; MSG SIZE  rcvd: 55

If a new domain name shows no IP address

dig preludemusicstudio.com

; <<>> DiG 9.16.1-Ubuntu <<>> preludemusicstudio.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47922
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;preludemusicstudio.com.		IN	A

;; Query time: 244 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jul 25 10:58:35 MST 2022
;; MSG SIZE  rcvd: 51

Notice there is no “Answer Section” after “Question Section”? That tells you that the DNS record for the domain name hasn’t propagated to wherever your computer gets the DNS information from.

If you have moved the hosting for the domain name to a different hosting company, look to see the new server IP address showing.

When new domain propagated to the host

See IP address of the host, in the Answer section? (IN A 34.125.9.164)

dig preludemusicstudio.com

; <<>> DiG 9.16.1-Ubuntu <<>> preludemusicstudio.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19329
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;preludemusicstudio.com.		IN	A

;; ANSWER SECTION:
preludemusicstudio.com.	5401	IN	A	34.125.9.164

;; Query time: 3 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jul 25 12:07:21 MST 2022
;; MSG SIZE  rcvd: 67

Long delay on web pages that use Google Fonts

dig fonts.google.com

Other Resources

TecAdmin — https://tecadmin.net/flush-dns-cache-ubuntu/

“Our systems keep a cache of DNS records, which allows for faster resolution of IP address. After changing of IP address of any domain, it takes time to update local cache. In the meantime, you may get a broken page error. In this situation, you need to flush the local DNS cache.”

In terminal, use this command to flush your DNS cache:

sudo /etc/init.d/dns-clean start

For other operating systems and a full rundown of DNS caching as a whole, you can check out Kinsta’s excellent guide: How to Flush DNS Cache (Windows, Mac, Chrome)


Posted

in

by

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.