
Windows IP and DNS commands: Use built-in Windows tools to review DNS configuration, clear stale local cache entries and query specific record types. This guide explains what each command does, its syntax, practical examples, useful options, and common mistakes. Commands are shown for typical installations; flags can vary across operating-system and tool versions.
Before you start
Open a terminal appropriate for the operating system shown in the examples. Check that the required tool is installed and that you are running it with the permissions needed for your task. Replace sample names, paths, hostnames and IDs with values from your own environment.
Syntax at a glance
Square brackets usually indicate optional arguments, while uppercase words such as FILE, HOST and PACKAGE are placeholders that you replace. Keep quotes around paths or text that contains spaces. Commands should be tested on a safe sample before being used in production.
Quick command reference
| Command | What it does | Example | Useful options |
|---|---|---|---|
ipconfig /all | Inspect adapters, gateways and configured DNS servers | ipconfig /all | /all expands adapter details; redact MAC and internal addresses before sharing |
ipconfig /flushdns | Clear the local DNS resolver cache | ipconfig /flushdns | Run in an elevated terminal if your environment requires it |
ipconfig /displaydns | Display cached DNS entries | ipconfig /displaydns | more | Pipe to more to browse long output |
nslookup | Query a DNS name or server | nslookup toolxon.com 1.1.1.1 | Enter interactive mode by running nslookup without arguments |
Resolve-DnsName | Query DNS records in PowerShell | Resolve-DnsName example.com -Type A | -Server selects a resolver; -Type can be A, AAAA, MX, TXT and more |
Command syntax and examples explained
1. ipconfig /all
Purpose: Inspect adapters, gateways and configured DNS servers.
Syntax
ipconfig /allExample
ipconfig /allOptions and notes: /all expands adapter details; redact MAC and internal addresses before sharing.
Check whether the adapter received the expected gateway and DNS server.
2. ipconfig /flushdns
Purpose: Clear the local DNS resolver cache.
Syntax
ipconfig /flushdnsExample
ipconfig /flushdnsOptions and notes: Run in an elevated terminal if your environment requires it.
This clears local cached records; it does not change authoritative DNS.
3. ipconfig /displaydns
Purpose: Display cached DNS entries.
Syntax
ipconfig /displaydnsExample
ipconfig /displaydns | moreOptions and notes: Pipe to more to browse long output.
The cache can help explain why a machine still resolves an old address.
4. nslookup
Purpose: Query a DNS name or server.
Syntax
nslookup NAME [SERVER]Example
nslookup toolxon.com 1.1.1.1Options and notes: Enter interactive mode by running nslookup without arguments.
Querying a public resolver can compare results, but corporate split DNS may intentionally differ.
5. Resolve-DnsName
Purpose: Query DNS records in PowerShell.
Syntax
Resolve-DnsName NAME -Type TYPEExample
Resolve-DnsName example.com -Type AOptions and notes: -Server selects a resolver; -Type can be A, AAAA, MX, TXT and more.
Use TXT lookups for verification records, taking care not to expose sensitive values.
Common mistakes and troubleshooting
- Command not found: confirm the tool is installed and available on your PATH; open a new terminal after changing PATH.
- Permission denied: verify the current account, file permissions and target path. Use administrator/root privileges only when genuinely required.
- Unexpected output: check the command version, quoting, current directory and exact arguments. Consult the local help or manual for options supported by your build.
- Destructive operations: preview the target and keep a backup before deleting data, rewriting history, flashing a partition or changing system configuration.
Safety tips
Review every command before running it, especially commands that delete files, change permissions, flash firmware, alter a database or expose a network service. For network scanning and remote administration, work only on devices and systems you own or are authorized to test. Keep credentials, private keys, access tokens and log files private.
Frequently asked questions
Do these commands work on every system?
Not always. Some commands are specific to Windows, Linux, Android, a particular package manager or an installed tool version. Use the syntax shown for your platform and check local help when a flag is unavailable.
Can I copy and run every example exactly?
Use the examples as templates. Replace placeholders such as filenames, package IDs, hostnames and paths with your own values, and verify the effect before executing a command that changes data or system state.
Conclusion
Use this reference as a starting point, then confirm flags in the tool’s official help or manual for your installed version. A clear understanding of syntax, options and side effects makes command-line work more reliable.