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
.
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 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.
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.
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
/registerdns
switch in an elevated console.
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.
Do you have more than one NIC with a similar name? No problem. Use a wildcard (*
).
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.
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.