ipconfig - Check IP Address
The ipconfig command is a basic Windows command for checking network settings and performing DHCP- and DNS-related operations.
Because it shows the IP address, subnet mask, default gateway, DNS cache and more, it is often the first command to run when narrowing down a network problem.
ipconfig command syntax
ipconfig
ipconfig [/allcompartments] [/all] [/renew [<adapter>]] [/release [<adapter>]] [/renew6 [<adapter>]] [/release6 [<adapter>]] [/flushdns] [/displaydns] [/registerdns] [/showclassid <adapter>] [/setclassid <adapter> [<class ID>]]
If the adapter name contains spaces, enclose it in quotation marks, such as "Ethernet 2".
Some options also accept the wildcard *.
Start by running ipconfig
ipconfig
This output alone usually gives you an overview of the network you are currently connected to.
ipconfig shows local settings such as the private IP address assigned to your PC.
To find the global IP address visible from the internet, check your router’s admin page or an external lookup service.
Extracting only the IPv4 address
When the output is long, combine it with the findstr command to show only the lines you need.
ipconfig | findstr /i "IPv4"
The | (pipe) passes the output of the command to findstr, which filters it.
Common options
| Option | Description |
|---|---|
/all | Shows detailed information for all adapters |
/displaydns | Shows the DNS client resolver cache |
/flushdns | Clears the DNS client resolver cache |
/registerdns | Re-runs dynamic registration of DNS names and IPs |
/release | Releases the IP configuration obtained via DHCP |
/renew | Renews the IP configuration obtained via DHCP |
/all - Show detailed information
ipconfig /all
With /all, the output also includes the MAC address (“Physical Address”), whether DHCP is enabled, DNS servers and the lease times. It is also handy for finding a MAC address.
/displaydns - Check the DNS cache
ipconfig /displaydns
Useful when you want to see which IP address a DNS name has been resolved to.
/flushdns - Clear the DNS cache
ipconfig /flushdns
Use it when outdated name resolution results may be cached. On success, “Successfully flushed the DNS Resolver Cache.” is displayed.
Options that change settings, such as /flushdns, /registerdns, /release and /renew, must be run in a Command Prompt opened as administrator.
Without privileges, an error is displayed.
/registerdns - Re-register with DNS
ipconfig /registerdns
This is not a command that refreshes the DNS client cache. It re-runs the dynamic registration of the DNS name and IP address configured on the PC.
/release / /renew - Obtain a DHCP address again
ipconfig /release
ipconfig /renew
Use these when you want to obtain an IP address again in a DHCP environment. /release temporarily disconnects the network, so do not run it on a PC you are connected to remotely.
/release and /renew are for adapters that obtain their address automatically via DHCP.
They do not behave as expected on adapters with a fixed IP.
Using it for troubleshooting
1. Check the current settings first
ipconfig /all
Check that the IP address, gateway and DNS servers are what you expect.
2. If name resolution looks wrong, check / clear the DNS cache
ipconfig /displaydns
ipconfig /flushdns
3. If DHCP seems to be the problem, obtain the address again
ipconfig /release
ipconfig /renew
After checking the settings with ipconfig, use ping to check reachability of the gateway or an external host, and netstat to check connection status, to narrow down the cause.