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 *.
Quick reference
| Goal | Command |
|---|---|
| Check your IP address | ipconfig |
| Check the MAC address and DNS servers | ipconfig /all |
| Remove stale name-resolution results | ipconfig /flushdns (administrator) |
| Obtain an IP address from DHCP again | ipconfig /release then ipconfig /renew (administrator) |
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.
Extracting only the MAC address
The MAC address appears on the “Physical Address” line of ipconfig /all. Filtering with findstr makes it easy to find.
ipconfig /all | findstr /i "Physical"
The item names depend on the Windows display language. On a Japanese system, search for 物理アドレス instead.
If you only need a list of MAC addresses, the getmac command also works.
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.
To target only one adapter, specify its name.
ipconfig /release "Wi-Fi"
ipconfig /renew "Wi-Fi"
/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.
When the IP address is 169.254.x.x
If the IPv4 address shown by ipconfig starts with 169.254., the PC could not obtain an address from a DHCP server and Windows assigned an APIPA (Automatic Private IP Address) instead. This address cannot be used to reach the router or the internet.
Check the following in order.
- Check the LAN cable or Wi-Fi connection and the router’s power
- Obtain the address again with
ipconfig /releaseandipconfig /renew - If nothing changes, restart the router or the PC