The Top 10 Ipconfig Commands You Should Learn
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.
Table of Contents
- What is ipconfig?
- The top 10 ipconfig commands you should learn
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.
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:
The image below shows the result of the export command, as well as the content of the ipdetailsserver1.txt file.
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
- 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.
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.
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.
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.
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.
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.
7. Ipconfig /renew
This parameter renews an IP4 address. As with the release parameter, /renew applies to all your system network adapters (DHCP only).
Again, the /renew6 parameter is the IPv6 equivalent of /renew which only renews IP4 addresses.
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.
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
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.
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.
More in Windows Client OS
How to Enable Windows 11 Config Lock on Secured-Core PCs
Dec 2, 2022 | Dean Ellerby
How to Install Google Drive for Desktop (Install & Set Up)
Nov 23, 2022 | Rabia Noureen
How to Use LAPS to Manage Local Admin Account Passwords in Active Directory and Azure AD
Nov 14, 2022 | Michael Reinders
Microsoft's November Patch Tuesday Updates Fix 69 Windows Flaws
Nov 9, 2022 | Laurent Giret
What Are the Different Windows Logon Types?
Oct 31, 2022 | Michael Reinders
October 2022 Patch Tuesday Updates Fix 85 Windows Vulnerabilities
Oct 12, 2022 | Laurent Giret
Most popular on petri