As one of the most useful command-line tools out there, ipconfig quickly analyzes and displays your network configuration values and refreshes your settings.
Below, we go over the best ipconfig commands for Windows that will help you manage your networking configuration straight from a command-line utility.
Let’s get to it!
What Is ipconfig?
This staple networking tool is regularly used by system administrators who need to troubleshoot computer network issues, as in Microsoft’s words, it “[d]isplays all current TCP/IP network configuration values and refreshes DHCP and DNS settings”.
In addition to allowing users to analyze and set up their networking systems, this Internet Protocol Configuration (ipconfig) tool can also export the output to a text file that can be used to document the issue and present it as proof if and when necessary.
All in all, ipconfig is extremely easy to use and will not require installing and navigating different GUI-based programs, which may change now and then.
📝Note While it can be used in most OSes out there, including Linux and macOS, this article focuses on its usage in the Windows operating system environment. |
👍You might be interested in: What is IP? |
How to Use the ipconfig Command?
Using ipconfig is fairly straightforward, and you only need to launch your preferred command-line utility. Most operating systems come with such tools pre-installed. For instance, on Windows, you can run ipconfig via Command Prompt or PowerShell.
To start it, simply press the ‘Windows key’, type Command Prompt or PowerShell, and open either interface. Then, you can enter the specific ipconfig command you need.
If you simply type in [ipconfig] without any parameters, you’ll see your IPv4 and IPv6 addresses, along with your subnet mask and default gateway of all your network adapters, including ethernet and wireless LAN adapters. If you add [/all] next to the main command, you’ll see the full configuration list of each NIC in your system.
However, you can also add [/?] next to [ipconfig] to see a complete list of all the parameters that you can use to specify the usage of this command.
📝Note The latest versions of Windows come with Windows Terminal—a modern interface for both Command Prompt and PowerShell that makes it much easier to use either of them with features such as multiple tabs and different character support. |
Top 10 Windows ipconfig Commands
Let’s see what ipconfig can do once you modify it by adding several parameters.
1. ipconfig /release
One of the most used ipconfig commands includes the [/release] parameter, which effectively discards your current DHCP configuration for all or some network adapters.
In effect, this command disables the TCP/IP for the adapters that automatically obtain your IP addresses. To specify the adapter(s), you have to add the [<adapter>] parameter:
ipconfig /release Ethernet |
Finally, you can use the [/release6] parameter to release all IPv6 configurations for your network adapters since the original command only releases the IPv4 addresses.
📝Note This command disregards adapters with manually set addresses. |
2. ipconfig /renew
With [ipconfig /renew], you achieve the opposite effect of the one above as it renews your DHCP configuration for all adapters (if left unmodified). That said, you can always add the [<adapter>] parameter to specify which adapter will get a new IP address.
Similar to before, entering [ipconfig /renew6] will renew your IPv6 configurations.
3. ipconfig /displaydns
If you want to view the contents of your DNS client resolver cache, you can use the [ipconfig /displaydns] command, which will list all the websites you have visited and the contents of your local ‘Hosts’ file.
Each entry will show the record name (the domain), record type (IPv4, IPv6, mail exchange, or name server), time to live (when the entry expires), data length (4 or 16 bytes), section type (Answer or Additional), and the host’s IP address.
4. ipconfig /flushdns
If you ever want to reset your DNS resolver cache, you can use the [ipconfig /flushdns] command, which deletes all locally stored DNS records. Then, your DNS cache will be repopulated once again as you continue browsing the web.
📝Note If you are unsure what is a Domain Name System (DNS), go through our refresher course—aptly called: “What Is DNS and Why It Matters?” |
5. ipconfig /registerdns
Instead of flushing your DNS cache and repopulating it later on, you can also refresh all DNS entries connected to your network adapters, which may ultimately help you resolve issues between your IP address and the DNS server and final IP address.
With the [ipconfig /registerdns] command, you can troubleshoot, re-register, and resolve your DNS problems without restarting your computer.
6. ipconfig /showclassid
By using the [ipconfig /showclassid <adapter>] command, you’ll generate the specific DHCP class ID for a particular network adapter, as long as it is set for automatic IP addresses.
If you want to see the class information for all adapters, use the following command:
ipconfig /showclassid * |
You can also modify this command to show you the class ID for IPv6 addresses:
ipconfig /showclassid6 <adapter> |
7. ipconfig /setclassid
Connected to the previous parameter, [ipconfig /setclassid] lets you set the DHCP class ID for a specific or all network adapters in your machine.
If you want to assign a class IC to all NICs, use this command:
ipconfig /setclassid * <classID> |
You can also assign a class ID to a specific NIC by writing:
ipconfig /setclassid <adaptername> <classID> |
Note: If you don’t specify a class ID, then the current one is removed. Also, for IPv6 addresses, you can also use the /setclassid6 parameter.
How to Save Your ipconfig Output to a Text File?
If you want to save the results of your ipconfig queries for whatever reason, you can easily export the output to a text file with a single line:
ipconfig [/command] > [name of file].txt |
You can use this command to see if your save was successful:
type [name of the file].txt |
While the above procedure is rather quick and straightforward, there’s a better way to save your results to a text file and store it wherever you want on your local disk:
- Right-click on your current tab and select ‘Export Text’;
- Navigate to your save location, type in a file name, and click ‘Save’.
Completing these two steps takes only 10 seconds, after which you’ll have a handy text file to use for whatever purpose you need.
Bottom Line
From checking your IP address to flushing your DNS resolver cache, using ipconfig commands in Windows is a simple yet crucial step when analyzing and troubleshooting your networking issues. While it cannot do everything you need or want, ipconfig is still an excellent addition to the toolkit of any system admin and network engineer out there.
Timeline Of The Article
Aditya is an Azure DevOps and Infrastructure Virtualization Architect with experience in automation, infrastructure management, and designing and implementing virtualization solutions. His expertise encompasses both on-premise and cloud-based systems. Aditya's articles on TechJury serve as a reliable resource for individuals and organizations looking to harness the power of cloud computing, embrace automation, and leverage infrastructure-as-code practices.