Post

Windows DNS & ARP

This page contains information and commands about viewing and clearing the DNS and ARP caches on Windows computers, as well as the hosts file.

  1. Hosts File
  2. DNS Cache (CMD)
  3. DNS Cache (PowerShell)
  4. ARP Table

Hosts File

When performing a DNS query to lookup the IP for a hostname, the hosts file is first checked to see if an entry exists. If it does, the IP in the host file is used. If not, a query is sent to the configured DNS server.

The hosts file on Windows should be located here:

  • C:\Windows\System32\drivers\etc\hosts


DNS Cache (CMD)

View DNS Cache (CMD)

1
ipconfig /displaydns

Clear DNS Cache (CMD)

1
ipconfig /flushdns


DNS Cache (PowerShell)

View DNS Cache (PowerShell)

1
Get-DnsClientCache

Clear DNS Cache (PowerShell)

1
Clear-DnsClientCache


ARP Table

The below can be used in either CMD or PowerShell

View ARP Cache

1
arp -a

Clear ARP Cache

For a specific IP:

1

Clear all ARP entries:

1
arp –d
This post is licensed under CC BY 4.0 by the author.