The ipconfig command is used to display information about your network configuration and refresh DHCP and DNS Settings. By default, the ipconfig command displays your IP Address, Subnet Mask, and default gateway. But with correct parameters, you can get a lot more information out of it.
In this article, I will explain the ipconfig command and the different options that you can use.
How to use ipconfig command
So let’s first start with something simple, how to use the ipconfig command.
1. Press Windows key + X or Right Click on the start menuTo use the IP config command we will need to open Command Prompt or PowerShell
2. Select Windows PowerShell or Command Prompt
3. Type ipconfig and press enter
This will show you the basic network information from your network adapters
As you can see in the screenshot above, the command will return information about each network adapter on your computer. In this case, we have an ethernet adapter (for our wired network connection) and a wireless network adapter.
If you are using a VPN client, then this will also be listed as a network adapter.
Ipconfig /all command
Without the use of any parameter, the command shows only the basic network information. But information about the DNS and DHCP servers isn’t displayed by default. To show all the information about your network adapter, you will need to use the
1. ipconfig /all
This will return the following information for each network adapter in your device:
|Physical Address||This is the MAC address of your network adapter.|
|DHCP Enabled||Indicates if the network connection is using DHCP or Static IP Address|
|IPv4 Address||The IP Address of your computer|
|Default Gateway||The router to which your computer is connected|
|DHCP Server||Router/server that hands out IP Addresses in your network|
|DNS Servers||Servers used to translate domain names to IP Addresses|
|Link-Local IPv6 Address||IPv6 address of your computer (often not used)|
|Lease Obtained||Date-time when your computer received the IP Address|
The ipconfig /all command is often used to troubleshoot network connection problems. But which information is important and do you need to look at?
If we take a closer look at the results of ipconfig /all then we can indicate 4 items that are important to look at:
- IPv4 Address – This is your IP Address
- Default Gateway – The router or modem to which you network package are sent
- DNS servers – Used to translate domain names to IP Addresses
- DHCP Enabled – Needs to be Yes in most cases. No means that you have manually enter an IP Address
Ipconfig /release Command
The ipconfig command doesn’t only show your information about your network settings, but it can also be used to reset or refresh your network settings. When you have DHCP enabled on your network card, you can request a new IP Address from the DHCP server.
Learn more about DHCPIf you want to know more about how DHCP works, then make sure you read this article.
The first step to do this is to release the current IP Address. This means that we will inform the DHCP server that we don’t want to use the assigned IP Address any longer.
1. ipconfig /release
By default, the command will release the IP Addresses for all network adapters. You can also specify a single network adapter. To do this you will need to enter the name of the adapter that you find here in the results of ipconfig:
For example, if you only want to release the IP Address of your wireless network adapter, you can type:
1. ipconfig /release Wireless*
This will release the IP Address of all adapters where the name starts with “Wireless”.
Ipconfig /renew Command
After you have released the IP Address you will need to request a new one from the DHCP Server. We can do this with the
Ipconfig /renew command:
1. ipconfig /renew
When the renew was successful you will see the same output as the ipconfig command, an overview of your new IP Address, subnet mask, and gateway.
Again, we can specify a single network adapter by specifying the name of the adapter.
1. ipconfig /renew Wireless*
Your computer keeps a local cache of all DNS records that it’s has visited. This cache is used to quickly translate the domain names to the correct IP Address. This way your computer doesn’t have to contact the DNS server every time when you visit Google.com for example.
To view the content of the DNS cache you can use the command
1. ipconfig /displaydns
This will show every DNS record in your DNS cache:
You often don’t need to go through the records, but let me explain a little bit about what we are seeing here:
|Records Name||The DNS name of the records|
|Record Type||The number indicates if it’s an A (1) record, or CNAME (5) for example|
|Time To Live||Time in seconds that the records are valid. After that, the records are purged|
|Date Length||The length in bytes of the record in your memory|
|Section||Can be Answer or Additional. The latter are related answers that|
your computer did not ask for it but is given anyway by the DNS server.
|Record||The actual value of the record|
Flush DNS Command
Sometimes your DNS Cache contains outdated records, which can result in DNS-related errors (unable to reach websites for example). You can solve this often by using the flush dns command:
1. # Flush DNS Command 2. ipconfig /flushdns
The command ipconfig /flushdns clears out your DNS Cache. You can do this without any risk, your computer will simply request new, and up-to-date DNS records from the DNS servers.
Ipconfig on Linux
The equivalent for ipconfig on Linux is the ifconfig command. Ifconfig will show you the basic network information of your adapters in Linux.
View DNS servers on Linux
The ifconfig command doesn’t show the DNS servers that are used. To view the DNS servers on Linux we need to open a configuration file.
1. cat /etc/resolv.conf 2. 3. # Result: 4. # Generated by resolvconf 5. nameserver 192.168.1.1 6. nameserver 184.108.40.206 7. nameserver fd51:42f8:caae:d92e::1
This will give you an idea of which DNS servers are used on your Linux machine.
Renew IP Address on Linux
On Linux, you can’t use the ifconfig command to renew or release your IP Address just like with Ipconfig. To renew your IP Address on Linux you will need to use the following command:
1. # Renew IP Address on Linux 2. dhclient eth0
The ipconfig command is the most used command on Windows to troubleshoot network issues. It gives you information about your current network configuration and it has the ability to renew your Ip addresses and DNS cache.
If you have any questions, just drop a comment below.