EMZETT.
Login

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

CommandShows or checksLinux/macOS
[[ipconfigipconfig]]own IP configuration, DNS cache, renew DHCP
[[pingping]]reachability and round-trip time via [[icmp
[[nslookupnslookup]][[dns
[[tracerttracert]]path of the packets across all routers
[[netstatnetstat]]open ports and connections
[[arparp -a]]mapping of IP address to MAC address
hostnamename of your own computerhostname
getmacMAC addresses of the network cardsip link
route printrouting tableip route
pathpingping and tracert combined with loss per hopmtr
netshread and change network settingsnmcli

Procedure for “no internet”

  1. ipconfig: Does the computer have a sensible address (not 169.254.x.x) and a default gateway?
  2. ping 127.0.0.1: Does your own network stack work?
  3. ping <gateway>: Is the router reachable in the local network?
  4. ping 8.8.8.8: Can you reach the internet (without name resolution)?
  5. ping emzett-digital.com: Does it work with a name? If 4 works and 5 does not, the problem is DNS; then use nslookup.
  6. tracert: Where does the path break off?
  7. 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 /release or netstat -b).
  • See also problem diagnosis and command line.

See also: CMD, Command Line, Ping, ICMP, ARP, DNS, TCP/IP Model, Troubleshooting (Networking), PowerShell