The Top 10 Ipconfig Commands You Should Learn

Windows

In this article, I’m going to show you how to use the command-line tool ipconfig. If you’re an IT admin, ipconfig is a very useful console application program that can help you troubleshoot network connectivity problems in Windows.

Linux and other operating systems (OS) have similar capabilities, but they often use different commands to achieve them. Ipconfig’s Linux equivalents are considered to be ifconfig and the ip command. However, macOS uses a combination of ipconfig and ifconfig.

What is ipconfig?

Ipconfig is one of the most used command-line tools for analyzing, configuring and troubleshooting your systems’ network settings, both in a home or enterprise environment. It has been one of those bread and butter tools that any sysadmin and network engineer will know and treasure.

Overall, this command-line tool is easy to learn and relatively easy to master. It removes the need to browse multiple different GUI-based utilities, which tend to change with every new release of Windows (annoying people like me).

How to use the ipconfig command

Traditionally, ipconfig is run in a command-line session. On Windows, however, you can launch it using any of the following solutions:

  • Open the Windows Start Menu, click on the Windows System folder, and select Command Prompt.
  • Use the Windows key + R to open the Run box, enter cmd and press the Enter key.
  • Use the Windows key + X to open the Quick Link menu. Command Prompt and Command Prompt (Admin) can be listed there, but this will depend on your edition of Windows.
  • You can also access it in Windows PowerShell, which you can launch with a Start Menu search or in the Windows PowerShell folder in the Start Menu
  • Alternatively, Windows Terminal allows you to have multiple tabs within a single app. So, you can mix and match Command Prompt, PowerShell, Azure Cloud Shell, WSL, and more. Windows Terminal is now preinstalled on Windows 10 and Windows 11. And you can access it from Windows Search or the Start Menu. 

If you don’t set any parameters, the ipconfig command will display the following information for all network adapters in your system:

  • Connection-specific DNS Suffix
  • Link-local IPv6 Address
  • IPv4 Address
  • Subnet Mask
  • Default Gateway

The image below shows the output from my test server, which contains a single (virtual) network adapter. You should see something very similar on your system with the same single Network Interface Controller (NIC) configuration.

without paramaters, the ipconfig command displays information for all network adapters in your system
Figure 1: The output from my test server (Image Credit: Michael Taschler)

How to redirect the output of the ipconfig command to a text file

You may want the output of ipconfig to be saved in a text file. This is handy for documentation. And proving that you didn’t make a mistake that brought your entire infrastructure down (I might exaggerate a tiny bit, but sometimes a small change can have a massive impact).

To output the result to a text file, we’ll simply make use of the “>” (greater than) sign, something that works with many other command-line tools as well.

To save the output of the ipconfig /all command to a file named ipdetailsserver1.txt, you need to run the following command:

ipconfig /all > ipdetailsserver1.txt

To quickly check the contents of the text file you just created, run the type command followed by the name of the file:

type ipdetailsserver1.txt

The image below shows the result of the export command, as well as the content of the ipdetailsserver1.txt file.

we see the export command as well as the content of the ipdetailsserver1.txt file
Figure 2: The result of the export command to a text file (Image Credit: Michael Taschler)

The top 10 ipconfig commands you should learn

You’ll find below the most important ipconfig commands that you should know and understand. As always, using your favorite search engine for help is encouraged. And many operating systems also have built-in help features explaining when and how to best use these commands. Also, I know that there are more than 10 commands but they neatly fit into ten categories.

1. Ipconfig /all

As you might have guessed, the /all parameter we used above will list all of your network adapters’ configuration information. Note that this command will begin with the Windows IP Configuration section, which includes the following six items:

  • Host Name
  • Primary Dns Suffix
  • Node Type
  • IP Routing Enabled
  • WINS Proxy Enabled
  • DNS Suffix Search List

Then, for each of your NICs, it will list all their settings:

  • Connection-specific DNS Suffix
  • Description
  • Physical Address (mac address)
  • DHCP Enabled
  • Autoconfiguration Enabled
  • IPv6 Address
  • Temporary IPv6 Address
  • Link-local IPv6 Address
  • IPv4 Address
  • Subnet Mask
  • Lease Obtained
  • Lease Expires
  • Default Gateway
  • DHCP Server
  • DHCPv6 IAID
  • DHCPv6 Client DUID
  • DNS Servers
  • NetBIOS over Tcpip

Overall, this command supplies a great deal of information for troubleshooting problems. And it’s also very useful for documentation purposes.

2. Ipconfig /allcompartments

A bit of a relic from a long time ago (Windows Vista), the /allcompartments will output the same information as the ipconfig command without any parameters. The image below shows a comparison of the outputs of the two commands.

ipconfig /allcompartments
comparison of the outputs of ipconfig and ipconfig /allcompartments
Figure 3: A comparison of the output of the two commands (Image Credit: Michael Taschler)

3. Ipconfig /displaydns

This /displaydns parameter shows the DNS resolver cache of your system. The cache cuts down on network traffic since it keeps track of IP addresses and website names you have already visited. As well as the contents (if any) of your local Hosts file. Each record contains the following sections:

  • Each section begins with the name of the cached domain and then contains one or more records.
  • Record Name: The name of the remote computer.
  • Record Type: Common ones include 1 for type A (IP4 address), 28 for AAAA (IPv6), 15 for MX (Mail Exchange), 2 for NS (Name Server).
  • Time To Live: displays when the entry will expire (in seconds).
  • Data Length: The length in bytes (e.g., IP4 addresses have a length of four bytes, IPv6 has 16 bytes)
  • Section: typically you’ll find “Answer” listed in there, but it might also be “Additional.”
  • A (Host) Record: The IP address for the record.
ipconfig /Displaydns
the result of the Ipconfig /Displaydns command
Figure 4: This command displays the DNS resolver cache of your system.

4. Ipconfig /flushdns

The /flushdns parameter will flush the DNS resolver cache. This can be useful when you are troubleshooting or when you want to get rid of defective or obsolete DNS records. The cache will be repopulated as you browse the Internet or during normal system activity.

A reboot of your system also flushes the DNS resolver cache. This helps to keep some privacy, but it doesn’t get rid of your browsing history.

The Flushdns parameter flushes the DNS resolver cache
Figure 5: The Flushdns parameter flushes the DNS resolver cache

5. Ipconfig /registerdns

The /registerdns parameter registers (or refreshes) all DHCP leases and re-registers DNS names for all your system’s network adapters. It might take some time for this to happen, but anyway, this can help to resolve problems between your system and the DNS server. Windows also registers or updates your client’s DNS registration during a reboot.

ipconfig /Registerdns
The Registerdns parameter registers the DNS resource records for all your system’s network adapters.
Figure 6: The /registerdns parameter registers the DNS resource records for all your system’s network adapters.

6. Ipconfig /release

This parameter only applies to network adapters that have been assigned via DHCP. The /release parameter sends a request to the DHCP server to abandon the active lease(s) and removes it (or them) from your system.

Please note that if you don’t specify an adapter, then all active DHCP leases will be released. This might not be in your best interest. So, make sure that you get the syntax right. Also, if you connect remotely to a system and then release the IP address of the adapter you’re connected through, then you will terminate your active session.

ipconfig /release

For example, to release the IP address for a network adapter named “Ethernet0” you would need to type the following command:

ipconfig /release “Ethernet0”

You can also release multiple IP addresses at once by using a wildcard. To release the IP addresses of all adapters beginning with “Ether,” you would need to enter the following command:

ipconfig /release Ether*

For all adapters ending with “net” you would use this command:

ipconfig /release *net

For all adapters containing “erne” you would use this command:

ipconfig /release *erne*

Lastly, the /Release6 parameter is the IPv6 equivalent of /release which only releases IPv4 addresses.

ipconfig /release6

7. Ipconfig /renew

This parameter renews an IP4 address. As with the release parameter,  /renew applies to all your system network adapters (DHCP only).

ipconfig /renew

Again, the /renew6 parameter is the IPv6 equivalent of /renew which only renews IP4 addresses.

ipconfig /renew6

8. Ipconfig /showclassid

User classes and vendor classes allow you to assign DHCP options to groups of clients by specifying policies that apply to some users or devices, but not all of them within the same scope. Having different classes within scopes can be useful if you want to separate a group of devices into one segment of a scope while still maintaining dynamic hosting.

Classes tend to be limited to business networks. You will seldomly come across them in a home network. You could apply classes to a set of remote users to facilitate their access. Each class can contain different DNS servers, routers, gateway addresses, a time offset for your users in different time zones and specific lease times. 

The /showclassid parameter will display the DHCP class ID for a specified adapter. This parameter is only available only on computers with adapters that are configured to obtain an IP address automatically.

Ipconfig /showclassid <adapter>

To display the class information for all your systems’ network adapters, you need to enter the following command where the asterisk wildcard character replaces ‘adapter’.

ipconfig /showclassid *

For IPv6 addresses, you can use the /showclassid6 parameter.

ipconfig /showclassid6

9. Ipconfig /setclassid

The /setclassid parameter lets you assign a class ID to one or more of your system’s adapters. To assign a class ID to all network adapters, use the following command. You’ll need to replace ‘classID’ with the actual name of your class:

ipconfig /setclassid * classID

You can also assign a class ID to a specific network adapter. To do so, you’ll need to replace ‘adaptername’ with the name of the specific adapter or use a wildcard, as explained earlier in this article:

ipconfig /setclassid adaptername classID

If no class ID is specified, then the currently assigned one is removed. For IPv6 addresses, you can also use the /setclassid6 parameter.

The figure below shows the class ID named ‘policy1’ being assigned to my network adapter ‘Ethernet1’.

ipconfig /setclassid Ethernet 1 policy1
the class id named policy1 being assigned to my network adapter Ethernet1
Figure 7: The output of the /setclassid command (Image Credit: Michael Taschler)

10. Ipconfig /?

The /? parameter displays all available commands and tips on how to best use them. You can see more details in the image below.

The /? parameter displays all available commands and tips
Figure 8: The /? parameter displays all available commands and tips (Image Credit: Michael Taschler)

Conclusion

From checking your home PC’s local IP address, displaying your DNS cache, renewing your IP address, and setting a class ID, the ipconfig command will help you complete many of your networking analysis, configuration, and troubleshooting tasks and make your life a little easier. It cannot do everything, but it certainly is one of the most useful tools in your software toolbelt.