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.
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).
Traditionally, ipconfig is run in a command-line session. On Windows, however, you can launch it using any of the following solutions:
If you don’t set any parameters, the ipconfig command will display the following information for all network adapters in your system:
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.
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.
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.
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:
Then, for each of your NICs, it will list all their settings:
Overall, this command supplies a great deal of information for troubleshooting problems. And it’s also very useful for documentation purposes.
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
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:
ipconfig /Displaydns
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 /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
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
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
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
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 /? parameter displays all available commands and tips on how to best use them. You can see more details in the image below.
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.