Guide to Flush DNS in Windows, Linux and Mac OS X

Category : General

Hello,
Sick of Error 404 not found errors on your local machine? While other devices can open the same webpage. This means you have to Flush DNS Cache to fix 404 Errors. In this guide, we will show how you can flush or clean DNS Cache from your local machine.

Requirements

  • A machine which needs to Flush DNS Cache
  • Root Access for Linux and Mac OS X Machines

Procedure

Windows Users

  1. Open Command Prompt using Administrator Privileges
  2. Run the following Command

    ipconfig /flushdns

  3. If you see the following message then it means DNS Cache is successfully removed.Windows IP ConfigurationSuccessfully flushed the DNS Resolver Cache.

Linux

  1. Open Terminal
  2. Install NSCD (Name Service Caching Daemon) to your Linux Machine using following commands
    CentOS users

    yum install -y nscd

    Debian users

    apt install nscd -y

    For other distributions, you can refer their documentation to the package manager.

  3. Run the one of the following commands to Flush DNS Cache

    sudo service nscd restart

    or

    sudo /etc/init.d/nscd restart

MacOS

  1. Open Terminal
  2. Run one of the following commands as per your Mac OS X Version
    Mac OS X versions 10.10.4 and newer:

    dscacheutil -flushcache; sudo killall -HUP mDNSResponder

    Mac OS X versions 10.10-10.10.3:

    sudo discoveryutil mdnsflushcache; sudo discoveryutil udnsflushcaches

    Mac OS X versions 10.9:

    sudo killall -HUP mDNSResponder

    Mac OS X versions 10.6-10.8:

    sudo dscacheutil -flushcache

So with this, we have covered guide to flush DNS for three common platforms.