When troubleshooting network issues on a Windows system, there are several built-in command-line tools that can help you diagnose and resolve problems. Below are some of the most commonly used networking commands:
1. ping
Purpose: Tests connectivity between your computer and a target IP address or hostname.
- Usage: ping
<IP_address_or_hostname>
- Example: ping
google.com
- Useful
Options:
- -t: Continuous ping (use Ctrl+C to stop).
- -n
<count>: Number of echo requests to
send.
- -l
<size>: Size of the packet to send.
2. ipconfig
Purpose: Displays the current TCP/IP network configuration, including IP address, subnet mask, and default gateway.
- Usage: ipconfig
- Useful
Options:
- /all: Displays detailed information.
- /release: Releases the IP address for the specified adapter.
- /renew: Renews the IP address for the specified adapter.
- /flushdns: Clears the DNS resolver cache.
3. tracert
Purpose: Traces the route packets take to reach a destination, showing each hop along the way.
- Usage: tracert
<IP_address_or_hostname>
- Example: tracert
google.com
- Useful
Options:
- -d: Prevents resolution of IP addresses to hostnames
(speeds up the trace).
4. netstat
Purpose: Displays active connections, listening ports, and network statistics.
- Usage: netstat
- Useful
Options:
- -a: Displays all connections and listening ports.
- -n: Displays addresses and port numbers in numerical
form.
- -b: Displays the executable involved in creating each
connection.
- -r: Displays the routing table.
5. nslookup
Purpose: Queries DNS to obtain domain name or IP address mapping.
- Usage: nslookup
<domain_name_or_IP_address>
- Example: nslookup
google.com
- Useful
Options:
- -type=<record_type>: Queries a specific DNS record type (e.g., MX, A, CNAME).
6. pathping
Purpose: Combines the functionality of ping and tracert to provide more detailed information about network latency and packet loss.
- Usage: pathping
<IP_address_or_hostname>
- Example: pathping
google.com
7. arp
Purpose: Displays and modifies the IP-to-Physical address translation tables used by the Address Resolution Protocol (ARP).
- Usage: arp
-a
- Useful
Options:
- -a: Displays current ARP entries.
- -d: Deletes a specific ARP entry.
- -s: Adds a static ARP entry.
8. route
Purpose: Displays and modifies the local IP routing table.
- Usage: route
print
- Useful
Options:
- print: Displays the routing table.
- add: Adds a route.
- delete: Deletes a route.
- change: Modifies an existing route.
9. netsh
Purpose: A powerful command-line scripting utility that allows you to display or modify the network configuration of a computer.
- Usage: netsh
- Common
Commands:
- netsh
interface ip show config:
Displays IP configuration.
- netsh
interface ip set address: Sets a
static IP address.
- netsh
winsock reset: Resets the Winsock catalog
(useful for fixing network connectivity issues).
10. getmac
Purpose: Displays the MAC address of all network adapters on the system.
- Usage: getmac
- Useful
Options:
- /v: Displays detailed information.
11. telnet
Purpose: Tests connectivity to a specific port on a remote host.
- Usage: telnet
<IP_address_or_hostname> <port>
- Example: telnet
google.com 80
- Note:
Telnet client may need to be enabled via "Turn Windows features on or
off."
12. ftp
Purpose: Transfers files to and from a remote FTP server.
- Usage: ftp
<IP_address_or_hostname>
- Example: ftp
ftp.example.com
13. ssh
Purpose: Connects to a remote system using the Secure Shell (SSH) protocol.
- Usage: ssh
<username>@<IP_address_or_hostname>
- Example: ssh
user@192.168.1.1
14. scp
Purpose: Securely copies files between hosts over SSH.
- Usage: scp
<source> <destination>
- Example: scp
file.txt user@192.168.1.1:/path/to/destination
15. systeminfo
Purpose: Displays detailed system information, including network information.
- Usage: systeminfo
16. tasklist
Purpose: Displays a list of currently running processes.
- Usage: tasklist
- Useful
Options:
- /svc: Displays services hosted in each process.
17. taskkill
Purpose: Terminates tasks by process ID (PID) or image name.
- Usage: taskkill
/PID <process_id> or taskkill
/IM <image_name>
- Example: taskkill
/IM notepad.exe
18. wmic
Purpose: Windows Management Instrumentation Command-line utility for system information and management.
- Usage: wmic
- Example: wmic
nic get netconnectionid (lists
network adapters)
19. powershell
Purpose: Advanced scripting and command-line tool for Windows.
- Usage: powershell
- Example: Test-NetConnection
<IP_address_or_hostname> -Port <port> (tests connectivity to a specific port)
20. Test-NetConnection (PowerShell)
Purpose: Tests network connectivity, including port availability.
- Usage: Test-NetConnection
<IP_address_or_hostname> -Port <port>
- Example: Test-NetConnection
google.com -Port 80
These commands can be
used in combination to diagnose and resolve a wide range of network issues on a
Windows system. Always run the Command Prompt or PowerShell as an administrator
for full functionality.