# Check and Troubleshoot DNS Here are a collection of Windows Command Prompt commands for working with an troubleshooting DNS #### ipconfig /displaydns ```powershell ipconfig /displaydns ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/mn9image.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/mn9image.png) #### Output of DNS Cache Explained
OutputDescription
Record NameThis is the name that was queried for and resolved via a DNS request
Record Type1 = A record for IPv4 5 = CNAME record 15 = MX record 16 = Text record 28 = AAAA record for IPV6 12 = PTR (pointer) record These are just a few of the DNS resource types with their associated numbers. For more check this [Wikipedia article](https://en.wikipedia.org/wiki/List_of_DNS_record_types).
Time to LiveThe time in seconds after which the cached DNS entry will expire.
Data LengthThe data length refers to the size of the data stored in the cache for a particular domain name. This data can include information such as the IP address associated with the domain name, the time to live (TTL) for the record, and other details about the DNS query. The data length is typically measured in bytes, and is used by the DNS resolver to determine how much space to allocate for the record in its cache.
SectionThis is a header designating the 'Answer', which is what follows as the A (Host) Record
A (Host) RecordThis is the corresponding resolved IPv4 address for the domain name.
Adding the pipe with clip to the command copies the output to the clipboard and you can copy that into a text editor to make it easier to search and filter the results. ```powershell ipconfig /displaydns | clip ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/AfEimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/AfEimage.png) #### ipconfig /flushdns ```powershell ipconfig /flushdns ``` This command clears the DNS cache [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/Ad1image.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/Ad1image.png) #### nslookup <domain name> ```powershell nslookup ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/fQNimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/fQNimage.png) You can add the DNS server you want to query to the end of the command. ```powershell nslookup ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/oyoimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/oyoimage.png) [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/604image.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/604image.png) If there are specific DNS records like mail, text, or pointer records you can add type to the query. ```powershell nslookup -type=mx ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/5uBimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/5uBimage.png) ```powershell nslookup -type=txt ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/1kTimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/1kTimage.png) ```powershell nslookup -type=ptr ``` [![image.png](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/scaled-1680-/Wgsimage.png)](https://bookstack.taylorhome.run/uploads/images/gallery/2023-01/Wgsimage.png)