cheat sheet

ipconfig

Display and manage TCP/IP network configuration for all adapters on a Windows machine — covers full adapter details, DNS cache operations, and DHCP lease management.

ipconfig — IP Configuration

What it is

ipconfig is a built-in Windows command that displays the TCP/IP configuration of every network adapter installed on the machine. Its extended form (/all) adds MAC addresses, DHCP lease details, DNS suffixes, and gateway information. Beyond display, ipconfig can release and renew DHCP leases (/release, /renew) and manipulate the DNS resolver cache (/flushdns, /displaydns, /registerdns) — making it the first-stop diagnostic for network connectivity issues. The PowerShell equivalent is Get-NetIPAddress / Get-NetAdapter.

Availability

ipconfig ships as C:\Windows\System32\ipconfig.exe on every Windows version since 95. No installation required.

cmd
ipconfig /?

Output:

bash
USAGE:
    ipconfig [/allcompartments] [/? | /all |
                                 /renew [adapter] | /release [adapter] |
                                 /renew6 [adapter] | /release6 [adapter] |
                                 /flushdns | /displaydns | /registerdns |
                                 /showclassid adapter |
                                 /setclassid adapter [classid] ]

Syntax

cmd
ipconfig [/all] [/release [adapter]] [/renew [adapter]] [/flushdns] [/displaydns] [/registerdns]

Output: (network configuration report)

Essential options

SwitchMeaning
(none)IP address, subnet mask, and default gateway per adapter
/allFull details: MAC, DHCP, DNS servers, lease times, suffixes
/release [adapter]Release DHCP lease for adapter (or all if omitted)
/renew [adapter]Request a new DHCP lease
/release6 [adapter]Release IPv6 DHCP lease
/renew6 [adapter]Renew IPv6 DHCP lease
/flushdnsClear the DNS resolver cache
/displaydnsShow cached DNS records
/registerdnsRe-register DNS names with the DNS server

Basic output

Running ipconfig without arguments shows the essential IP information for every adapter.

cmd
ipconfig

Output:

yaml
Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::1a2b:3c4d:5e6f:7a8b%5
   IPv4 Address. . . . . . . . . . . : 192.168.1.100
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Ethernet adapter VPN:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Full details (/all)

/all adds the MAC address, DHCP enabled/server, lease obtained/expires, DNS server list, and connection-specific suffix search list for every adapter.

cmd
ipconfig /all

Output:

yaml
Windows IP Configuration

   Host Name . . . . . . . . . . . . : myhost
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Ethernet Controller
   Physical Address. . . . . . . . . : 00-1A-2B-3C-4D-5E
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 192.168.1.100(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, April 28, 2026 6:00:00 AM
   Lease Expires . . . . . . . . . . : Tuesday, April 29, 2026 6:00:00 AM
   Default Gateway . . . . . . . . . : 192.168.1.1
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DNS Servers . . . . . . . . . . . : 8.8.8.8
                                       8.8.4.4
   NetBIOS over Tcpip. . . . . . . . : Enabled

Releasing and renewing DHCP leases

/release drops the current DHCP lease (setting the IP to 0.0.0.0); /renew requests a fresh assignment from the DHCP server. Both can target a specific adapter by partial name match.

cmd
rem Release and renew all adapters
ipconfig /release
ipconfig /renew

Output:

yaml
Windows IP Configuration

No operation can be performed on Loopback Pseudo-Interface 1 while it has its media disconnected.

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.1.100
   ...
cmd
rem Target a specific adapter by name fragment
ipconfig /release "Ethernet"
ipconfig /renew "Ethernet"

Output:

python-repl
Windows IP Configuration
...

DNS cache operations

/flushdns clears the local DNS resolver cache — the first step when a name resolves to a stale or wrong IP. /displaydns shows what is currently cached. /registerdns forces the machine to re-register its DNS records with the configured DNS server (useful after a hostname change).

cmd
ipconfig /flushdns

Output:

code
Windows IP Configuration

Successfully flushed the DNS Resolver Cache.
cmd
ipconfig /displaydns

Output:

yaml
Windows IP Configuration

    myhost
    ----------------------------------------
    Record Name . . . . . : myhost
    Record Type . . . . . : 1
    Time To Live  . . . . : 86400
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . : 192.168.1.100
    ...
cmd
ipconfig /registerdns

Output:

kotlin
Windows IP Configuration

Registration of the DNS resource records for all adapters of this computer has been initiated. Any errors will be reported in the Event Viewer in 15 minutes.

DNS-over-HTTPS (DoH) on Windows 11

Windows 11 24H2 ships with DNS-over-HTTPS enabled in Auto mode for any well-known resolver in Microsoft's encrypted-DNS list (Cloudflare 1.1.1.1, Google 8.8.8.8, Quad9 9.9.9.9, and others). ipconfig /all does not show the encryption state — use Get-DnsClientDohServerAddress to confirm what's actually encrypted, and netsh dns show encryption for per-server detail. ipconfig /flushdns still flushes the local cache regardless of whether queries leave the machine plaintext (UDP 53) or as HTTPS (TCP 443).

powershell
Get-DnsClientDohServerAddress | Format-Table ServerAddress, DohTemplate, AutoUpgrade, AllowFallbackToUdp -AutoSize

Output:

graphql
ServerAddress  DohTemplate                              AutoUpgrade AllowFallbackToUdp
-------------  -----------                              ----------- ------------------
1.1.1.1        https://cloudflare-dns.com/dns-query           True              False
8.8.8.8        https://dns.google/dns-query                   True              False
9.9.9.9        https://dns.quad9.net/dns-query                True              False

To register a custom DoH resolver that is not in the built-in list (PowerShell 5.1+):

powershell
Add-DnsClientDohServerAddress -ServerAddress '94.140.14.14' `
    -DohTemplate 'https://dns.adguard-dns.com/dns-query' `
    -AllowFallbackToUdp $false -AutoUpgrade $true

Output:

sql
(none — registration persists in HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers)

Then opt an interface into encryption-required mode (Windows 11 24H2+ only):

powershell
Set-DnsClientDohServerAddress -InterfaceAlias 'Ethernet' -DohFlags Required

Output:

csharp
(none — exits 0 on success)

Confirm the resolver is actually using DoH by inspecting the resolver state:

cmd
netsh dns show encryption server=1.1.1.1

Output:

yaml
Server: 1.1.1.1
DoH template: https://cloudflare-dns.com/dns-query
Auto upgrade: yes
UDP fallback: no

Extracting just the IPv4 address with findstr

Pipe ipconfig into findstr to pull a specific line without parsing the full report.

cmd
ipconfig | findstr /C:"IPv4 Address"

Output:

css
   IPv4 Address. . . . . . . . . . . : 192.168.1.100
cmd
rem Default gateway only
ipconfig | findstr /C:"Default Gateway"

Output:

rust
   Default Gateway . . . . . . . . . : 192.168.1.1

Saving output to a file

Redirect ipconfig /all to a file for a network inventory or support ticket.

cmd
ipconfig /all > C:\Audit\netconfig_%COMPUTERNAME%.txt
echo Saved.

Output:

code
Saved.

IPv6 operations

ipconfig has dedicated switches for IPv6 DHCP — /release6, /renew6 — that mirror their IPv4 counterparts. They are necessary on dual-stack networks because the v4 and v6 leases are issued by independent DHCP services (DHCPv4 and DHCPv6 / SLAAC).

cmd
ipconfig /release6 "Ethernet"
ipconfig /renew6 "Ethernet"

Output:

arduino
Windows IP Configuration

Ethernet adapter Ethernet:
   ...
   IPv6 Address. . . . . . . . . . . : 2001:db8::abcd
   ...

Inspecting just the IPv6 picture:

powershell
Get-NetIPAddress -AddressFamily IPv6 |
    Where-Object { $_.SuffixOrigin -ne 'Link' } |
    Select-Object InterfaceAlias, IPAddress, PrefixOrigin, ValidLifetime

Output:

arduino
InterfaceAlias IPAddress              PrefixOrigin   ValidLifetime
-------------- ---------              ------------   -------------
Ethernet       2001:db8::abcd         RouterAdv      29.23:59:42
Ethernet       fd12:3456:789a::5      Dhcp           7.00:00:00

All compartments

/allcompartments shows every network compartment on the machine — each VPN, container, or Hyper-V network gets its own compartment with isolated routing tables. Without /allcompartments, ipconfig only shows the default (compartment 1).

cmd
ipconfig /allcompartments /all

Output:

markdown
Windows IP Configuration

==============================================================================
Network Information for *Compartment 1*
==============================================================================
   Host Name . . . . . . . . . . . . : MYHOST
   ...

==============================================================================
Network Information for *Compartment 2*
==============================================================================
   Host Name . . . . . . . . . . . . : MYHOST
   ...

DNS class IDs

DHCP class IDs allow a DHCP server to hand out different options to different classes of client (e.g. printers vs laptops). /showclassid lists the class IDs currently set on an adapter; /setclassid registers a new one.

cmd
ipconfig /showclassid "Ethernet"

Output:

vbnet
DHCP Class ID for Adapter "Ethernet":

   DHCP ClassID Name        :  Default Routing and Remote Access Class
   DHCP ClassID Description :  User class for remote access clients
cmd
rem Set a custom DHCP class ID — used by some enterprise DHCP scopes
ipconfig /setclassid "Ethernet" KIOSK_CLASS

Output:

rust
DHCP ClassId successfully modified for adapter "Ethernet"

PowerShell equivalents

The NetTCPIP and NetAdapter PowerShell modules supersede ipconfig on Windows 8+/Server 2012+. They return structured objects, integrate with the pipeline, and expose every setting that ipconfig shows plus many it does not (RDNSS, MTU, link-local zones, prefix policies).

Get-NetIPConfiguration is the closest one-shot equivalent of ipconfig — it composes adapter, address, gateway, and DNS info into a single view.

powershell
Get-NetIPConfiguration -Detailed

Output:

yaml
InterfaceAlias       : Ethernet
InterfaceIndex       : 12
InterfaceDescription : Intel(R) Ethernet Connection
NetAdapter.Status    : Up
NetProfile.Name      : corp.example.com
IPv4Address          : 192.168.1.100
IPv6Address          : 2001:db8::abcd
IPv4DefaultGateway   : 192.168.1.1
DNSServer            : 8.8.8.8
                       8.8.4.4

Individual building blocks for finer-grained queries:

powershell
Get-NetAdapter -Physical | Select-Object Name, Status, LinkSpeed, MacAddress
Get-NetIPAddress -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress, PrefixLength
Get-NetRoute -AddressFamily IPv4 -DestinationPrefix 0.0.0.0/0
Get-DnsClientServerAddress -AddressFamily IPv4

Output:

arduino
Name      Status  LinkSpeed   MacAddress
----      ------  ---------   ----------
Ethernet  Up      1 Gbps      00-1A-2B-3C-4D-5E

InterfaceAlias   IPAddress       PrefixLength
--------------   ---------       ------------
Ethernet         192.168.1.100   24

ifIndex DestinationPrefix    NextHop        RouteMetric
------- -----------------    -------        -----------
12      0.0.0.0/0            192.168.1.1    25

InterfaceAlias  AddressFamily  ServerAddresses
--------------  -------------  ---------------
Ethernet        IPv4           {8.8.8.8, 8.8.4.4}

DHCP lease via PowerShell

Get-DhcpClientV4Lease (on a DHCP-configured adapter) gives the same lease detail as ipconfig /all in object form, plus the lease state machine. Invoke-DhcpClientV4Renew is the structured equivalent of ipconfig /renew.

powershell
Get-DhcpClientV4Lease | Format-List

Output:

yaml
InterfaceAlias  : Ethernet
IPAddress       : 192.168.1.100
SubnetMask      : 255.255.255.0
DhcpServer      : 192.168.1.1
T1Expiration    : 5/25/2026 6:00:00 AM
T2Expiration    : 5/25/2026 9:00:00 AM
LeaseExpiration : 5/25/2026 12:00:00 PM
State           : Bound

Static configuration via PowerShell (replacement for netsh interface ip set address):

powershell
New-NetIPAddress -InterfaceAlias 'Ethernet' `
    -IPAddress 192.168.1.50 `
    -PrefixLength 24 `
    -DefaultGateway 192.168.1.1
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses 8.8.8.8,8.8.4.4

Output:

yaml
IPAddress         : 192.168.1.50
InterfaceIndex    : 12
InterfaceAlias    : Ethernet
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Tentative

Revert to DHCP:

powershell
Set-NetIPInterface -InterfaceAlias 'Ethernet' -Dhcp Enabled
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ResetServerAddresses
Restart-NetAdapter -Name 'Ethernet'

Output:

css
(none — adapter restarts and pulls DHCP lease)

Output parsing

Parsing the human-readable ipconfig output is brittle (localized strings, line wrapping). For automation, prefer PowerShell objects. When stuck with ipconfig text, anchor on the : separator and trim dots.

powershell
ipconfig | Select-String -Pattern 'IPv4 Address' |
    ForEach-Object { ($_ -split ':')[-1].Trim() }

Output:

code
192.168.1.100

A fully-parsed approach when you genuinely cannot use PowerShell:

cmd
@echo off
setlocal enabledelayedexpansion
for /f "tokens=2 delims=:" %%I in ('ipconfig ^| findstr /C:"IPv4 Address"') do (
    set IP=%%I
    set IP=!IP: =!
    echo IPv4: !IP!
)

Output:

makefile
IPv4: 192.168.1.100

Common pitfalls

  1. /release drops connectivity — releasing DHCP on a remote session cuts the connection; always have a backup access path before releasing on a remote machine.
  2. Loopback adapter clutteripconfig lists every virtual adapter including Hyper-V, WSL, and VPN adapters; use findstr /C:"IPv4" to filter signal from noise.
  3. /flushdns requires elevation on some versions — run from an elevated cmd.exe if it reports access denied.
  4. /registerdns may not take effect immediately — DNS propagation can take up to 15 minutes; check the Event Viewer for errors.
  5. APIPA addresses (169.254.x.x) — an APIPA address means DHCP failed; check the DHCP server, cable, or VLAN configuration rather than re-running ipconfig /renew in a loop.
  6. Localized output — on non-English Windows the field labels are translated (e.g. Adresse IPv4); scripts relying on findstr /C:"IPv4 Address" break. Prefer PowerShell on multilingual fleets.
  7. /displaydns shows the DNS Client cache only — entries cached at the application layer (browser, Java JVM, Node DNS) are not visible; restarting the app may still hit a stale lookup.
  8. DNS Client service disabled — if the Dnscache service is stopped, /flushdns and /displaydns both report "Could not display the DNS Resolver Cache"; restart with sc start dnscache.
  9. Loopback 127.x.x.x and APIPA show as Preferredipconfig /all marks every active address as Preferred whether it's reachable or not; don't infer connectivity from the label alone.
  10. VPN adapters reorderipconfig lists adapters in interface metric order; a freshly connected VPN can shuffle the output and confuse scripts that hard-code position.
  11. 24H2 WcmSvc/DNS startup regression — under specific driver combinations Windows 11 24H2 has shipped builds where WcmSvc / Dnscache / WLAN AutoConfig fail to start, surfacing as event 7001 and the "some settings are managed by your organization" banner. ipconfig /all will show an APIPA address and no DNS servers; restart the Dnscache service or apply the latest 2026 cumulative update to clear it.
  12. ipconfig does not reveal DoH state — even with Windows 11 24H2 sending queries over HTTPS, /all still prints the resolver as 8.8.8.8 with no marker that traffic is encrypted; use Get-DnsClientDohServerAddress or netsh dns show encryption to confirm.

Real-world recipes

Quick connectivity diagnostic

cmd
@echo off
echo --- IP ---
ipconfig | findstr /C:"IPv4 Address"
echo --- Gateway ---
ipconfig | findstr /C:"Default Gateway"
echo --- DNS ---
ipconfig /all | findstr /C:"DNS Servers"

Output:

sql
--- IP ---
   IPv4 Address. . . . . . . . . . . : 192.168.1.100
--- Gateway ---
   Default Gateway . . . . . . . . . : 192.168.1.1
--- DNS ---
   DNS Servers . . . . . . . . . . . : 8.8.8.8

Reset network adapter (release + flush + renew)

cmd
ipconfig /release
ipconfig /flushdns
ipconfig /renew
echo Network reset complete.

Output:

python-repl
...
Successfully flushed the DNS Resolver Cache.
...
Network reset complete.

Capture network info for a support ticket

cmd
(
    echo ===== ipconfig /all =====
    ipconfig /all
    echo.
    echo ===== DNS cache =====
    ipconfig /displaydns
) > %TEMP%\net_%COMPUTERNAME%.txt
echo Report saved to %TEMP%\net_%COMPUTERNAME%.txt

Output:

css
Report saved to C:\Users\alicedev\AppData\Local\Temp\net_MYHOST.txt

Wait for a DHCP lease to come up

A common provisioning step is to wait until DHCP hands out a real IP (not APIPA) before continuing. Polling ipconfig from a batch script keeps the boot script linear.

cmd
@echo off
:waitdhcp
ipconfig | findstr /C:"169.254" >nul && (
    echo Waiting for DHCP lease...
    timeout /t 5 /nobreak >nul
    goto waitdhcp
)
echo DHCP lease acquired.
ipconfig | findstr /C:"IPv4 Address"

Output:

rust
Waiting for DHCP lease...
Waiting for DHCP lease...
DHCP lease acquired.
   IPv4 Address. . . . . . . . . . . : 10.0.0.50

PowerShell — connectivity health check

A one-liner version of the diagnostic recipe above, but returning structured data fit for Export-Csv, JSON, or a monitoring agent.

powershell
Get-NetIPConfiguration | ForEach-Object {
    [PSCustomObject]@{
        Interface = $_.InterfaceAlias
        IPv4      = $_.IPv4Address.IPAddress
        Gateway   = $_.IPv4DefaultGateway.NextHop
        DNS       = ($_.DNSServer | Where-Object AddressFamily -eq 2).ServerAddresses -join ','
        Profile   = $_.NetProfile.Name
    }
} | Format-Table -AutoSize

Output:

arduino
Interface  IPv4           Gateway      DNS                Profile
---------  ----           -------      ---                -------
Ethernet   192.168.1.100  192.168.1.1  8.8.8.8,8.8.4.4    corp.example.com
Wi-Fi

Flush DNS + clear connection cache + re-register

When troubleshooting DNS-related outages, do all four invalidations in sequence rather than one at a time.

powershell
ipconfig /flushdns
Clear-DnsClientCache
Clear-DnsServerCache -Force -ErrorAction SilentlyContinue  # only on servers
ipconfig /registerdns

Output:

kotlin
Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

Windows IP Configuration

Registration of the DNS resource records for all adapters of this computer has been initiated. Any errors will be reported in the Event Viewer in 15 minutes.

Discover what's on a NIC with no IP

When ipconfig shows Media disconnected but the cable looks plugged in, dig into the adapter state.

powershell
$nic = 'Ethernet'
Get-NetAdapter -Name $nic | Format-List Name, Status, MediaConnectionState, LinkSpeed, MtuSize, DriverDescription
Get-NetAdapterStatistics -Name $nic | Format-List ReceivedBytes, SentBytes, ReceivedDiscardedPackets

Output:

yaml
Name                  : Ethernet
Status                : Disconnected
MediaConnectionState  : Disconnected
LinkSpeed             : 0 bps
MtuSize               : 1500
DriverDescription     : Intel(R) Ethernet Connection

ReceivedBytes            : 0
SentBytes                : 0
ReceivedDiscardedPackets : 0

Zero bytes plus Disconnected confirms a Layer-1 problem (cable, switch port, NIC hardware) — no amount of ipconfig /renew will help.

ToolPurpose
Get-NetIPConfigurationModern PowerShell replacement (recommended)
Get-NetAdapterAdapter status, MAC, link speed
Get-NetIPAddressPer-address detail
Get-NetRouteRouting table
Get-DnsClientServerAddressPer-adapter DNS servers
Get-DnsClientCacheDNS resolver cache as objects (replaces /displaydns)
netsh interface ipStatic IP configuration (write side)
getmacMAC address only — much shorter output
route printRouting table only
arp -aMAC ↔ IP cache (other machines)

Sources

  • Microsoft Learn — ipconfig — official syntax reference.
  • Microsoft Learn — Get-DnsClientDohServerAddress — PowerShell view of the DoH registration list.
  • Microsoft Learn — DNS-over-HTTPS client support on Windows — covers Auto/Required modes shipped in 24H2.
  • Microsoft Q&A — Windows 11 24H2 network access regression — documented WcmSvc/Dnscache failure pattern referenced in pitfalls.