Network Commands in the CMD
In short: The most important commands of the Windows command prompt for network diagnosis: ipconfig, ping, nslookup, tracert, netstat and arp.
In more detail: In the CMD (command prompt) network problems can be narrowed down without extra programs. Each command checks a different layer of the TCP/IP model. On Linux and macOS there are usually equivalent commands with other names.
In Depth
Overview
| Command | Shows or checks | Linux/macOS |
|---|---|---|
| [[ipconfig | ipconfig]] | own IP configuration, DNS cache, renew DHCP |
| [[ping | ping]] | reachability and round-trip time via [[icmp |
| [[nslookup | nslookup]] | [[dns |
| [[tracert | tracert]] | path of the packets across all routers |
| [[netstat | netstat]] | open ports and connections |
| [[arp | arp -a]] | mapping of IP address to MAC address |
hostname | name of your own computer | hostname |
getmac | MAC addresses of the network cards | ip link |
route print | routing table | ip route |
pathping | ping and tracert combined with loss per hop | mtr |
netsh | read and change network settings | nmcli |
Procedure for “no internet”
ipconfig: Does the computer have a sensible address (not169.254.x.x) and a default gateway?ping 127.0.0.1: Does your own network stack work?ping <gateway>: Is the router reachable in the local network?ping 8.8.8.8: Can you reach the internet (without name resolution)?ping emzett-digital.com: Does it work with a name? If 4 works and 5 does not, the problem is DNS; then usenslookup.tracert: Where does the path break off?netstat -an: Is the service listening on the expected port at all?
Tips
command /?shows the help with all options.- With
>the output can be written to a file:ipconfig /all > net.txt. - Some commands need administrator rights (for example
ipconfig /releaseornetstat -b). - See also problem diagnosis and command line.
See also: CMD, Command Line, Ping, ICMP, ARP, DNS, TCP/IP Model, Troubleshooting (Networking), PowerShell