Commands and codes
Windows CMD network commands: the quick reference
The command-prompt commands that diagnose network problems in Windows: ipconfig, ping, tracert, nslookup and netstat - when to use each and what its output tells you.
Last reviewed:
How to open the command prompt
- Press Win + R, type cmd and press Enter.
- Some commands need administrator rights: search for cmd in the Start menu and choose "Run as administrator".
First diagnosis: ipconfig
- ipconfig: shows the IP address and default gateway of every network adapter.
- ipconfig /all: full details including DNS servers and the MAC address.
- ipconfig /release then ipconfig /renew: renew the IP address from the router; useful after a sudden drop.
- ipconfig /flushdns: clear the DNS cache when some sites open and others do not.
Testing connectivity
- ping 8.8.8.8: does your machine reach the internet at all? Steady replies mean connectivity works.
- ping google.com: if the IP works but the name fails, the problem is DNS.
- tracert google.com: traces the route across hops and shows where the path stalls or slows.
- nslookup google.com: tests the DNS server directly and shows the address it returns.
Advanced commands
- netstat -ano: open connections and ports on your machine with each process ID.
- arp -a: the table of known devices on the local network.
- route print: the full routing table.
Sources
- Microsoft Learn: ipconfig · read on
Wording is ours, from the official source. Images and video belong to their owners and are credited with a link to the official page.