Table of Contents
Flush DNS Cache on Windows, Linux, and Mac
If you experience connection problems, you might want to clear your DNS cache. In this article, you will learn about flush DNS and its benefits and how to clear the DNS cache on popular operating systems.
What is DNS Flush?
Every time you type a URL in the address bar, it takes the appropriate IP address to communicate with the webserver (or any type of server). When you repeatedly use the same URL it will only waste network resources to retrieve the appropriate IP address each time because the IP doesn’t change too often.
So your computer stores a combination of domain names and IPs in the local cache to avoid retrieving from the Domain Name Server (DNS) every time you use the same domain name (URL).
DNS also stores another important info called “Timeout” which regulates the valid time for a combination of IP and domain names, when this time is up your computer takes back the combination of DNS and stores it in the local cache again.
Flush DNS is a mechanism where users can manually make all entries in the cache invalid, so your computer retrieves new combinations when needed and is stored in the local cache.
Read More:Â https://ifixmywindows.com/rank-math-vs-yoast-seo/
Why do We Need to Flush DNS Cache Periodically?
Similar to a web browser, the operating system also stores a cache file called the Domain Name System (DNS) cache. The cache file contains information about all the websites visited – the hostname, IP address, and resource record.
Most operating systems do DNS caching to reduce the burden of DNS servers during high traffic. The period of cache validity is determined by Time To Live (TTL). As long as the cache files are still valid, they will respond to content requests without having to go through a DNS server.
However, using corrupted or outdated DNS cache files can cause errors and security vulnerabilities. Therefore, we recommend that you periodically clear your DNS cache.
Here are the reasons why you should clear the DNS cache regularly by flushing the correct DNS.
- Prevents tracking search behavior – saving DNS records makes it easy for hackers to predict your browser history.
- Security – DNS cache files are the main target for DNS spoofing, which jeopardizes user-sensitive information such as login credentials and personal data.
- Resolve technical issues – Forcing the operating system to search for updated DNS records can solve connection problems and incorrectly displayed web content.
How to Flush DNS Cache on Windows 10?
Implementing the DNS flush method can help resolve DNS-related problems in Microsoft Windows 10. Problems that may arise usually include a website that is not found, an error, or cannot see certain web pages that have changed.
Option 1 – Windows command
To reset or flush the DNS resolver cache, complete the following steps.
- Select the “Start” button, then type “cmd”.
- Right-click on the “Command Prompt” menu, then select the “Run as Administrator” menu.
- Type ipconfig / flushdns then press “Enter”. (make sure there is a space before the slash or slash)
The command box will blink on the screen for a split second and the DNS resolver cache is cleared.
Option 2 – Windows PowerShell
By using Windows PowerShell, we can implement the following steps as a way to flush DNS ie.
- Select the “Start” button, then type “PowerShell”.
- Select “Windows PowerShell”, type the following command, Delete-DnsClientCache
- then press “Enter”
How to Flush DNS Cache on Linux?
If on MS-Windows you can use the ipconfig command to clear the DNS cache. However, Linux and UNIX provide various ways to clear the cache. Linux can run nscd or BIND or dnsmasq as a name service caching daemon. Large servers and workgroups can use BIND or dnsmasq as a special caching server to speed up queries.
Flush Nscd DNS Cache
Nscd caches libc-issued requests to the Name Service. If retrieving NSS data is quite expensive, NSC can dramatically speed up successive access to the same data and improve overall system performance. Restart nscd.
$ Sudo /etc/init.d/nscd restart
OR
# service restart nscd
OR
# service nscd reload
This daemon provides a cache for the most common name service requests. The default configuration file, /etc/nscd.conf determines the behavior of the cache daemon.
Flush Dnsmasq DNS Cache
Dnsmasq is a lightweight DNS, TFTP, and DHCP server. This is intended to provide DNS and DHCP services that are integrated into the LAN. Dnsmasq accepts DNS requests and answers them from a small, local cache, or forwards them to a real, and recursive, DNS server. This software also installs many cheap routers to cache DNS requests. Simply restart the dnsmasq service to clear the DNS cache like this: $ Sudo /etc/init.d/dnsmasq restart
Or
# service dnsmasq restart
Flush Caching BIND Server DNS Cache
The BIND caching server gets information from another server (Master Zone) in response to host queries and then caches data locally. All you have to do is restart bind to clear the cache: # /etc/init.d/named restart
You can also use the rndc command as follows:
flush out all cache: # rndc restart
Or
# rndc exec
BIND v9.3.0 and higher will support rinsing all records attached to specific domain names with the rndc flndname command. In this example flush all records released to the cyberciti.biz domain: # rndc flush name cyberciti.biz
It is also possible to delete the BIND display. For example, LAN and WAN displays can be flushed using the following command.
# rndc LAN flush
# rndc flush WAN
How to Flush DNS Cache on Mac OS?
Press the F4 key, then enter the terminal in the Launchpad search field to open a terminal window.
If you are using Mac OS Sierra, X El Capitan, X Mavericks, X Mountain Lion, or X Lion, enter the following command:Â Sudo killall -HUP mDNSResponder
To clear the DNS cache on Mac OS X Yosemite, enter the statement:Â Sudo discovery until udnsflushcaches
If you are running on Mac OS X Snow Leopard, use the command:Â sudo dscacheutil -flushcache
For Mac OS X Leopard and below, enter the following command to clear the DNS cache:Â sudo lookupd -flushcache
Conclusion
When experiencing connection problems or seeing incorrectly displayed web pages, your system may be storing corrupted or outdated DNS cache records. You can quickly solve it by flushing the DNS cache.
This is the tutorial on how to flush the DNS cache that you can use to solve connection problems when browsing the internet. We apologize if the tutorial that we gave is still full of shortcomings. However, we can say that this brief article can be useful to you.
If you have any doubts or queries related to this article or any other queries you can comment below we will get back to you with the solution.