Operating systems like Windows, Linux, BSD runs some mechanisms to cache DNS records in the local system. Caching DNS records locally gives less bandwidth and fast internet access to the user. In this post, we will look at how to flush DNS cache in the operating systems like Windows and Linux (Ubuntu, CentOS, Fedora, Debian, etc.)
Windows operating system provides flush operation from the command line with ipconfig tools. Flushing DNS cache required Administrator privileges in Windows operating system from Windows Vista to Windows 10. Windows XP by default provides Administrator privilege. We will use ipconfig flush DNS mechanism for Windows.
Linux operating system provides different tools and mechanisms for DNS caching. We will look most popular and useful two methods to clear DNS cache. These operations require root privileges.
Method 1 is restarting Network Services of the Linux operating system.
方法1是重新启动Linux操作系统的网络服务。
Ubuntu,Debian: (Ubuntu, Debian:)
$ sudo systemctl restart networking.service
CentOS,Fedora: (CentOS, Fedora:)
$ sudo systemctl restart network.service
Flush DNS For Linux
Linux的嵌入式DNS
使用名称服务缓存守护程序刷新DNS (Flush DNS with Name Service Cache Daemon)
Linux operating systems use some cache mechanism for DNS and IP matches. This makes the DNS queries run faster without asking a DNS server every time. Most of the requiring DNS queries will be answered from DNS cache. This may create a problem after some time. We can flush and clear this DNS cache named nscd with the following command. This command will restart nscd daemon.