Mastering Ipconfig Commands: A Comprehensive Guide

Published:15 December 2020 - 2 min. read

Azure Cloud Labs: these FREE, on‑demand Azure Cloud Labs will get you into a real‑world environment and account, walking you through step‑by‑step how to best protect, secure, and recover Azure data.

The ipconfig command has been around for a long time but somehow most people don’t realize what all of the various ipconfig commands do and how they work. In this Nugget, we’re going to change that by diving into how the ipconfig command works and how it can help you manage your DHCP and DNS client configuration.

Let’s dive right in.

Prerequisites

Running the ipconfig command doesn’t require many prerequisites. As long as you have any recent version of Windows, you’re good to go. This Nugget will also assume you’re on a Windows machine with a dynamically-assigned (DHCP) IP address and DNS client settings.

Viewing Basic IP and DNS Settings with IPConfig Commands

The most basic of ipconfig commands is simply running it without parameters. Open up a command prompt or PowerShell console on your machine and run ipconfig. You will see all of the network interfaces (NICs) installed on your system along with basic IP information.

Take note of the NIC name. The name of the NIC in the below screenshot is called Ethernet.

Viewing basic IP information
Viewing basic IP information

Use the ipconfig /all command and you’ll see an increased amount of information namely each NIC’s DHCP configuration and the DNS servers.

Viewing all IP and DNS configuration
Viewing all IP and DNS configuration

Viewing the DNS Resolver Cache

Another popular ipconfig command is ipconfig /displaydns. Using this command, you can find all of the items in your local DNS resolver cache and any items in your local C:\Windows\System32\etc\drivers\hosts file.

Inspecting the DNS resolver cache
Inspecting the DNS resolver cache

The /displaydns switch is especially helpful for troubleshooting name resolution issues!

Purging the DNS Resolver Cache

Sometimes the DNS resolver cache caches items you’d like to remove. You can clear out all items in the DNS resolver cache by running ipconfig /flushdns. This command is useful to remove any negative cache entries when troubleshooting.

Purging the DNS Resolver Cache
Purging the DNS Resolver Cache

Initiating a Dynamic DNS Registration with an IPconfig Command

Perhaps you need to manually initiate a dynamic DNS registration and refresh DHCP releases. In that case, use ipconfig /registerdns. This ipconfig command is great for troubleshooting DNS name registration issues without rebooting the computer.

Related: Resolve-DnsName: Resolving DNS Names with PowerShell

Be sure you use the /registerdnsswitch in an elevated console.

Initiating a Dynamic DNS Registration
Initiating a Dynamic DNS Registration

Releasing and Renewing DHCP-Assigned IPs

One of the most common ipconfig commands is those that release and renew a dynamically-assigned (DHCP) IP address. To release a DHCP address, you can either do so by running ipconfig /release which will release all NICs bound by TCP/IP.

Releasing a DHCP address for the Ethernet NIC
Releasing a DHCP address for the Ethernet NIC

Do you have more than one NIC with a similar name? No problem. Use a wildcard (*).

Releasing a DHCP address for all NICs that start with Eth
Releasing a DHCP address for all NICs that start with Eth

You can use wildcards for the NIC name on any ipconfig command that allows you to input a NIC’s name. You can also use a ? to represent a single character to match too.

Once the IP is released, you need to pull another one from your DHCP server. To do so, run ipconfig /renew to renew all NICs or specify a specific NIC again.

Getting a new DHCP lease on all NICs
Getting a new DHCP lease on all NICs

Quick tip: You can release and renew dynamically-assigned IP addresses on the same line using double ampersands like ipconfig /release && ipconfig /renew.

If you’d like to limit releasing and renewing only IPv6 NICs, you can also use the /release6 and /renew6 parameters.

Note that ipconfig commands like /showclassid, /setclassid and /allcompartments parameters. These parameters are not covered in this Nugget because they are considered legacy and you will rarely (if ever) need them.

Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

Explore ATA Guidebooks

Looks like you're offline!