Flush DNS

A very common issue you may encounter is when your local DNS resolvers cache a domain name to IP mapping. When you're trying to go to the domain, it's actually pulling up an old IP address (cached on your own computer) instead of looking for a new one and finding the correct record.

Jump to a Section:


What is DNS Caching?

Before learning how to flush DNS, you first need to know what the DNS cache is. The DNS cache is your computer’s operating system, browser, or router’s memory of the recent websites you’ve visited. It is like a temporary container of information (DNS records, IP addresses, and hostnames) that your computer or browser uses to access websites quickly. This way, it does not need to start the process of going through the site's actual host server to load the information from there all over again every time you visit a website. This process of DNS caching allows the browser to load a website quickly the next time you visit it.

To clear your browser’s cache, please refer to this article, How Do I Clear My Web Browser's Cache?


What Does DNS Flushing Do?

Please note that while DNS caching may seem very useful for ease of website access and less traffic, it has its disadvantages. Among them is a security vulnerability and incorrectly displayed website content. Clearing or flushing your DNS regularly will prevent these issues.

This article will give you the steps required to clear or flush your cached DNS.


How Do You Flush DNS in Different Operating Systems?

Microsoft Windows 8
  1. Close the application you're currently working with, such as an internet browser or email client. 
  2. Press the Windows Logo + R keys together simultaneously. This will cause the Run dialogue window to appear. 
  3. Type cmd in the text box and select OK.
  4. When the black screen appears, type the following command and hit enter:
    ipconfig /flushdns
  5. Restart your application (browser or email client). 
Microsoft Windows Vista and Windows 7
  1. Close the application you're currently working with, such as an internet browser or email client. 
  2. Click the Start orb and follow All Programs > Accessories, look for Command Prompt.
  3. Right-click on Command Prompt and select Run as Administrator
  4. When the black screen appears, type the following command and hit enter:
    ipconfig /flushdns
  5. Restart your application (browser or email client). 
Microsoft Windows XP
  1. Close the application you're currently working with, such as an internet browser or email client. 
  2. Go to the Start menu and click Run. 
  3. Type cmd in the text box and select OK.
  4. When the black screen appears, type the following command and hit enter:
    ipconfig /flushdns
  5. Restart your application (browser or email client). 
Mac OS X

It is important to note before following these instructions that the command in step 4 is specific to Mac OX 10.10 Yosemite and will not work on prior versions of Mac OSX as this command changes between versions. It is advised that you follow Apple's instructions to check your version number, and look for the command specific to your version of OSX.

  1. Close the application you're currently working with, such as an internet browser or email client. 
  2. Navigate to your Applications folder. 
  3. Open Utilities and double click on Terminal
  4. Type the following command and hit enter: 
    sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed
  5. Enter the admin username and password when prompted.
  6. Restart your application (browser or email client). 

    Don't worry if either command says something like "Not found", and continue to restart your application. 

OSX Daily has excellent lists of prior OSX versions and commands:

Linux

Note: Different distributions and versions of Linux may have slightly different commands due to differences in configuration. One of the commands below will probably work.

  1. Open up a root terminal window (Ctrl+T in Gnome).
  2. Type the following command and hit enter:
    /etc/init.d/nscd restart


    You may need to use sudo depending on your installation instead:

    sudo /etc/init.d/nscd restart


    Some distributions support this command:

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


    Or support this command:

    sudo service nscd restart


    Some installations may have NSDS located in another directory, like the following example. You may need to locate where it is installed to be able to execute the correct command.

    /etc/rc.d/init.d/nscd restart
  3. Restart your application (browser or email client).

Related Topic

What Happens When You Change Your DNS Settings to Point Somewhere Else?

There are instances when you point your DNS to third-party providers, for example, to improve your website’s speed or as an optimization strategy. You can definitely do that by setting up an account with them and pointing your DNS records to their servers. However, please be advised that any changes in the DNS records will require a little time to sync-in, which is known as propagation.