IPCONFIG - CMD
Overview
The IPCONFIG
command in Windows Command Prompt is a utility used to display all current TCP/IP network configuration values and refresh DHCP and DNS settings. This command is particularly useful for network diagnostics and troubleshooting connectivity issues. Administrators and users utilize IPCONFIG to obtain network adapter information, including IP addresses, subnet masks, and default gateway.
Syntax
The basic syntax for IPCONFIG
is:
ipconfig [/all] [/renew [adapter]] [/release [adapter]] [/flushdns] [/displaydns] [/registerdns] [/showclassid adapter] [/setclassid adapter [classid]]
- adapter is the name or wildcard pattern matching the name of the interface.
Optional Parameters:
- /all: Display the full configuration information.
- /renew: Renew the IP address for the specified adapter.
- /release: Release the IP address for the specified adapter.
- /flushdns: Purges the DNS Resolver cache.
- /displaydns: Display the contents of the DNS Resolver cache.
- /registerdns: Refreshes all DHCP leases and re-registers DNS names.
- /showclassid: Displays all the DHCP class IDs allowed for adapter.
- /setclassid: Modifies the DHCP class id.
Options/Flags
- /all: Extends the display to include additional configuration details like DNS and WINS servers.
- /renew [adapter]: Restarts DHCP configuration for all adapters or a specific one if the adapter name is provided.
- /release [adapter]: Sends a DHCP release notification to the network server to remove the current DHCP configuration from an adapter.
- /flushdns: Clears any cached DNS lookup results, often useful in troubleshooting erroneous IP addresses in cached websites.
- /displaydns: Useful for viewing the DNS lookup results. This can help understand how DNS names are resolved.
- /registerdns: Initiates a manual dynamic update of the client DNS records in DNS, useful when DNS entries are messed up.
- /showclassid, /setclassid: Manage DHCP class IDs used for network configuration scenarios involving multiple DHCP servers.
Examples
Example 1: Display all configuration information:
ipconfig /all
Example 2: Renew the IP address for all adapters:
ipconfig /renew
Example 3: Release the IP address for the adapter named “Ethernet1”:
ipconfig /release Ethernet1
Example 4: Flush the DNS resolver cache:
ipconfig /flushdns
Common Issues
- Error on /renew or /release without admin rights: Ensure Command Prompt is run as Administrator.
- No adapters are available for operation: Usually indicates a problem with network adapter drivers or permissions.
- Failure to release/renew in use network: This can be due to the adapter being disconnected, disabled, or the DHCP server not responding.
Integration
IPCONFIG
is often used in conjunction with scripting to automate network troubleshooting or configuration, such as batch files that clear DNS, renew IP and then ping a server to check connectivity:
@echo off
ipconfig /release
ipconfig /renew
ipconfig /flushdns
ping google.com
Related Commands
- PING: Sends ICMP requests to network hosts.
- TRACERT: Traces route packets take to a network host.
- NETSTAT: Displays network statistics.
- NSLOOKUP: Queries DNS to obtain domain name or IP address mapping.
For more detailed information, you can check out the Microsoft documentation on IPCONFIG here.