How To Flush DNS and Reset TCP/IP with ipconfig /flushdns Command In Windows – POFTUT

How To Flush DNS and Reset TCP/IP with ipconfig /flushdns Command In Windows

DNS is used to translate between a human-readable name like poftut.com and IP address like 45.79.1333.118. DNS can use both UDP and TCP protocols but generally, UDP protocol is preferred. In this tutorial, we will learn how to flush, clear the DNS cache with ipconfig /flushdns command. This tutorial can be applied to the All Windows Operating system versions like Windows XP, Windows 7, Windows 8, Windows 10, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows Server 2019 without a problem. This will not require special privileges like Administrator.

DNS Cache

For every domain name, DNS will query to the DNS Server normally. But this may create a bottleneck in busy times. In order to prevent this bottleneck, DNS services use cache mechanism. Learned DNS records are stored in a cache for some time. If during this period a DNS is queried cache returns if exists.

Print and List Current DNS Cache Entries

We can print or list currently cached DNS entries with the /displaydns option of ipconfig command.

Print and List Current DNS Cache Entries

Print and List Current DNS Cache Entries

As we can see from screenshot domain names are stored in DNS cache with related information. There is the following information

  • Record Name specifies the name of the DNS record
  • Record Type specifies the type of DNS entry
  • Time To Live provides the validity time of the DNS entry
  • Data Length
  • Section

Flush DNS Entries with ipconfig /flushdns Command

In order to clear this DNS cache, we will use ipconfig command with /flushdns parameter. This will remove all DNS entries except localhost because it is a local system DNS record.

LEARN MORE  Nmap Commands Cheat Sheet

Flush DNS

Flush DNS

We can see that flush is completed successfully from the screenshot.

Run Command

In the previous example, we have used a command line which is named cmd.exe. We can also run ipconfig /flushdns command from Run like below. This will open a command line and run the command to clear and delete all DNS cache entries. Then the command line will be closed automatically.

Run Command

Run Command

Check DNS Cache Entries Whether Flushed

We can check whether flush is effective with the ipconfig /displaydns command again like below.

Check DNS Cache Entries Whether Flushed

Check DNS Cache Entries Whether Flushed

As we can see other DNS entries are deleted successfully. There are only localhost and arpa DNS entries which are static.

Flush DNS with PowerShell

PowerShell provides very same of the traditional MS-DOS commands. We can use all of the MS-DOS commands in PowerShell too. We can flush the DNS cache records with the ipconfig /flushdns command like below. First, we will open PowerShell from the start menu by writing powershell like below.

Open PowerShell

Open PowerShell

Then we will type the command like below.

Flush DNS with PowerShell

Flush DNS with PowerShell

Flush DNS with PowerShell Clear-DnsClientCache Cmdlet

Powershell provides a new way to clear DNS client cache or flush DNS with the Clear-DnsClientCache cmdlet. We will just execute the command like below.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)