Here is a guide to fundamental Windows networking commands, providing descriptions and examples for use in Command Prompt (CMD) or PowerShell. These tools help diagnose connectivity issues, view network configurations, and verify network performance.
Essential Windows Networking Commands Guide
1. ipconfig
The ipconfig (Internet Protocol Configuration) command is used to display all current TCP/IP network configuration values of the system. This is often the first command used when troubleshooting a network issue.
Command
Description
ipconfig
Displays basic configuration for all adapters.
ipconfig /all
Displays full configuration details, including MAC address, DHCP status, and DNS servers.
ipconfig /release
Releases the current IP address from the DHCP server (adapter loses connectivity).
ipconfig /renew
Requests a new IP address from the DHCP server. Must follow /release.
ipconfig /flushdns
🌐Clears the local DNS resolver cache, useful if a website's IP address has recently changed.
Examples:
C:\> ipconfig
C:\> ipconfig /all
C:\> ipconfig /release && ipconfig /renew
2. ping
The ping command sends Internet Control Message Protocol (ICMP) echo request packets to a target destination IP address or domain name to test connectivity and measure response time.
Command
Description
ping [destination]
Sends four packets to the destination.
ping -t [destination]
Continuously pings the destination until stopped (Ctrl + C).
ping -n [count] [destination]
Specifies the number of echo requests to send.
Examples:
C:\> ping 192.168.1.1 :: Ping a local router
C:\> ping google.com :: Ping a domain name to test internet connectivity
C:\> ping -n 10 localhost :: Send 10 pings to the local machine (127.0.0.1)
3. tracert
The tracert (Trace Route) command maps the path a packet takes to reach a destination by displaying a list of routers (hops) it passes through along the way. This helps identify where network latency or connection failure occurs.
Command
Description
tracert [destination]
Traces the route to the destination.
tracert -h [max_hops]
Sets the maximum number of hops to search for the destination.
Examples:
C:\> tracert google.com
C:\> tracert 8.8.8.8
🌐C:\> tracert -d 8.8.8.8
Diagnosing DNS Issues: If you suspect a problem with your DNS server, using tracert -d can help determine if the connectivity issue is network-related (the trace fails mid-route) or a name-resolution problem (the trace completes with IPs, but the standard tracert fails)
4. netstat
The netstat (Network Statistics) command displays active network connections, routing tables, and a variety of network interface statistics. It is crucial for security monitoring and troubleshooting unexpected connections.
Command
Description
netstat
Displays all active TCP connections.
netstat -a
Displays all connections and listening ports (TCP and UDP).
netstat -n
Displays addresses and port numbers in numerical form (avoids slow DNS lookups).
netstat -ano
The most common combination: shows all connections (a), numerical form (n), and the Process ID (PID) of the application using the connection (o).
Examples:
C:\> netstat -ano
🌐C:\> netstat -ano | findstr "80" :: Find processes communicating on port 80 (HTTP)
5. nslookup
The nslookup (Name Server Lookup) command is used to query Internet domain name servers to obtain domain name or IP address mapping or other DNS records. It helps diagnose DNS resolution issues independently of other network services.
Command
Description
nslookup [domain]
Looks up the IP address for the specified domain using the default DNS server.
nslookup [domain] [server]
Looks up the domain using a specific DNS server (e.g., Google's 8.8.8.8).
Examples:
C:\> nslookup google.com
🌐C:\> nslookup microsoft.com 8.8.8.8 :: Use Google's DNS server for the lookup
6. Get-NetAdapter (PowerShell specific)
While the previous commands work in both CMD and PowerShell, PowerShell offers cmdlets that provide richer, object-oriented data. Get-NetAdapter provides detailed information about your physical network interfaces.
Examples:
powershell
PS C:\> Get-NetAdapter :: List all network adapters
PS C:\> Get-NetAdapter -Name "Ethernet"
PS C:\> Get-NetAdapter | Format-List :: Display properties in a list format
6. telnet Command
The telnet command is a classic networking utility used to establish a connection to a remote host using the Telnet protocol, typically over TCP port 23. It can be used to test connectivity to specific ports on remote servers or to interact with text-based services directly.
The basic syntax is:
telnet [HostName or IP Address] [Port]
Common Examples:
Test if a web server is listening on port 80 (HTTP):
🌐 telnet example.com 80
If successful, the screen will likely go blank or display an error message from the server, indicating a connection was made.
If unsuccessful, you will see an error like "Could not open connection to the host, on port 80: Connect failed".
Test connectivity to a mail server on port 25 (SMTP):
telnet mailserver.example.com 25
Connect to the default Telnet port (23):
If you omit the port number, telnet defaults to port 23.
telnet 192.168.1.1
Enabling the Telnet Client in Windows
By default, the Telnet Client is not installed in modern Windows versions (Windows 10/11, Server 2016+). You must install it before you can use the command.
Option 1: Via the Command Line (CMD or PowerShell)
Run this command in an elevated Command Prompt or PowerShell session:
🌎 dism /online /Enable-Feature /FeatureName:TelnetClient