ipconfig
ipconfig is the built-in Windows tool to see an adapter's IP, mask and gateway, control its DHCP lease and manage the DNS client cache. macOS has a different ipconfig for DHCP debugging, and Linux has none (use ip addr and resolvectl).
15.1 Where it runs
| OS | ipconfig? | Notes |
|---|---|---|
| Windows | Built-in | Works in CMD and PowerShell |
| macOS | Different tool | /usr/sbin/ipconfig, talks to the IPConfiguration agent; for testing/debugging DHCP |
| Linux | Not available | Use ip addr, resolvectl |
15.2 Windows: display information
- Plain ipconfig: IPv4 address 192.168.1.3, mask 255.255.255.0, default gateway 192.168.1.1 (the router to leave the LAN).
- /all: DHCP Enabled Yes = IP came from DHCP; Lease Obtained / Lease Expires show the lease window.
- DHCP Server and DNS Servers are both 192.168.1.1, so the home router does both jobs; Physical Address (MAC) also appears (hidden here).
ipconfigipconfig /all$ ipconfigWireless LAN adapter Wi-Fi: IPv4 Address. . . . . . . . . . . : 192.168.1.3 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : [IPv6 hidden] 192.168.1.1$ ipconfig /allWireless LAN adapter Wi-Fi: DHCP Enabled. . . . . . . . . . . : Yes IPv4 Address. . . . . . . . . . . : 192.168.1.3(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Friday, November 6, 2026 10:12:54 PM Lease Expires . . . . . . . . . . : Monday, November 9, 2026 5:43:07 PM Default Gateway . . . . . . . . . : [IPv6 hidden] 192.168.1.1 DHCP Server . . . . . . . . . . . : 192.168.1.1 DNS Servers . . . . . . . . . . . : [IPv6 hidden] 192.168.1.1| Option | Shows |
|---|---|
| ipconfig | IP, mask, gateway per adapter |
| ipconfig /all | Full detail: DHCP, lease times, DNS servers, MAC |
| /allcompartments | All network compartments, not only the default |
| /allcompartments /all | All compartments, in detail |
| ipconfig /? | Help with every option |
$ ipconfig /?USAGE: ipconfig [/allcompartments] [/? | /all | /? Display this help message /all Display full configuration information. /release Release the IPv4 address for the specified adapter. /renew Renew the IPv4 address for the specified adapter. /flushdns Purges the DNS Resolver cache. /displaydns Display the contents of the DNS Resolver Cache.15.3 Windows: DHCP lease control
- Step 1
1./release: laptop sends DHCPRELEASE via the switch to the router/DHCP server
- Step 2
2.Server frees the lease; laptop has no IPv4, internet stops
- Step 3
3./renew: Discover broadcast from the laptop
- Step 4
4.Server sends Offer: 192.168.1.10
- Step 5
5.Laptop sends Request for that IP
- Step 6
6.Server confirms with Ack: 192.168.1.10, lease 24h
DORA = Discover, Offer, Request, Ack
- No adapter name = all adapters; a name in quotes = only that adapter; * is a wildcard on the name.
- The 6 versions do the same for DHCPv6 / IPv6.
- Not run on the office PC: /release drops the connection immediately.
/release all adapters, IPv4/release "Ethernet" one adapter only/release *Con* name has Con (wildcard)/renew all adapters, new IP/renew "Ethernet" one adapter only/renew EL* name starts with EL/release6 all adapters, IPv6/release6 "Ethernet" one adapter, IPv6/renew6 all adapters, DHCPv6/renew6 "Ethernet" one adapter, IPv615.4 Windows: DNS client cache and registration
- Windows checks its own DNS cache first; first time = miss, so the query goes via the router to 8.8.8.8.
- The answer is cached until its TTL runs out; next lookups of the same name are answered from the cache with no network query.
- /displaydns shows the cache (A record example.com = 172.66.147.243, TTL 73 s left).
- /flushdns clears the whole cache (useful after a DNS record changed).
- /registerdns refreshes the DHCP leases and re-registers the PC's name in DNS.
- Step 1
1.Browser asks for example.com
- Step 2
2.Windows DNS Client cache: miss
- Step 3
3.Query via router to DNS server 8.8.8.8
- Step 4
4.Answer cached: example.com 172.66.147.243, TTL 73
- Step 5
5.Next lookup: cache hit, no packet on the network
Resolve-DnsName example.com -Type Aipconfig /displaydnsipconfig /flushdnsipconfig /registerdns$ Resolve-DnsName example.com -Type AName Type TTL IPAddressexample.com A 73 172.66.147.243example.com A 73 104.20.23.154$ ipconfig /displaydns example.com Record Name . . . . . : example.com Record Type . . . . . : 1 Time To Live . . . . : 73 Section . . . . . . . : Answer A (Host) Record . . . : 172.66.147.24315.5 Windows: DHCP class ID
- Class ID = a label the client sends to the DHCP server, so the server can give a group (e.g. laptops) different settings.
- /showclassid lists the allowed classes; /setclassid "Wi-Fi" TEST sets one, without a value it removes it.
- The 6 versions do the same for DHCPv6; * in place of the adapter targets all adapters.
ipconfig /showclassid "Wi-Fi"ipconfig /showclassid Local*ipconfig /setclassid "Wi-Fi" TESTipconfig /setclassid "Wi-Fi"ipconfig /showclassid6 "Wi-Fi"ipconfig /setclassid6 "Wi-Fi" TESTipconfig /setclassid6 "Wi-Fi"$ ipconfig /showclassid "Wi-Fi"Windows IP ConfigurationThere are no DHCPv4 classes defined for Wi-Fi.15.6 macOS: query commands
- macOS ipconfig talks to the IPConfiguration agent; Apple recommends it only for testing/debugging (syntax only, no Mac in the lab).
- Most useful: getifaddr en0 (IPv4 only), getoption en0 router (gateway from DHCP), getpacket en0 (whole DHCP Ack).
waitall wait for all servicesgetifaddr en0 IPv4 address onlyifcount how many interfacesgetoption en0 router gateway from DHCPgetoption en0 domain_name_server DNSgetoption en0 3 code 3 = routergetpacket en0 whole DHCP packetgetv6packet en0 latest DHCPv6 packetgetra en0 IPv6 Router Advertgetsummary en0 interface summarygetdhcpduid DHCP DUIDgetdhcpiaid en0 DHCP IA_ID15.7 macOS: temporary services and logging
- set creates a temporary service on an interface until the next network change; needs sudo (root).
- DHCP = automatic IP, NONE = remove IPv4 services, MANUAL = static IP + mask, INFORM = static IP + other options from DHCP.
- -V6 options are for IPv6; set BOOTP then DHCP is a common trick to force a DHCP renew on a Mac.
- setverbose 1 turns on detailed logging (survives reboot), 0 goes back to default; filter logs by com.apple.IPConfiguration.
set en0 NONEset en0 DHCPset en0 BOOTPset en0 MANUAL 192.168.1.10 255.255.255.0set en0 INFORM 192.168.1.10 255.255.255.0set en0 NONE-V6set en0 AUTOMATIC-V6set en0 MANUAL-V6 2001:db8::10 64set stf0 6TO4sudo ipconfig setverbose 1 verbose ONsudo ipconfig setverbose 0 default OFF log subsystem:com.apple.IPConfiguration15.8 Common mistakes
- IPv4 169.254.x.x in /all = DHCP failed (APIPA); check cable/Wi-Fi first, then /release + /renew.
- Thinking /release + /renew changes the public IP: renew runs only between laptop and router; the public IP comes from the ISP to the router and stays the same.
- Running /release over a remote session: you lose the connection immediately.
- Expecting Windows ipconfig options on macOS or Linux.
15.9 Interview tips
- Troubleshooting order: ipconfig /all (IP, gateway, DHCP server, DNS) -> /release + /renew -> /flushdns.
- 169.254 or wrong IP: get a fresh lease; IP fine but names fail: clear the DNS cache.
- /renew runs DHCP DORA; /displaydns shows cached records with their TTL.
- macOS ipconfig is a separate DHCP debugging tool (getifaddr, getoption, set).