Network Troubleshooting Commands

Every network fault gets the same first questions: do I have an address, can I reach the gateway, can I reach beyond it, does the name resolve, is the port open. Each question has a command on each platform, and the differences between them are exactly what the exams ask about.

Addresses and interfaces

QuestionWindowsLinuxmacOS
What is my address?ipconfigip addr (or ip a)ifconfig
Full detail, DNS and leaseipconfig /allip addr; resolvectl statusifconfig; scutil --dns
Renew the DHCP leaseipconfig /release then /renewdhclient -r; dhclientsudo ipconfig set en0 DHCP
Interface stateipconfigip linkifconfig

Reachability and path

QuestionWindowsLinuxmacOS
Can I reach it?ping hostping host (Ctrl+C to stop)ping host
Which hops does it cross?tracert hosttraceroute hosttraceroute host
Loss per hop over timepathping hostmtr hostmtr host (installed separately)
Is the path MTU too small?ping -f -l 1472 hostping -M do -s 1472 hostping -D -s 1472 host

Name resolution

QuestionWindowsLinuxmacOS
Resolve a namenslookup hostdig host (or host, nslookup)dig host
Ask a specific servernslookup host 8.8.8.8dig @8.8.8.8 hostdig @8.8.8.8 host
A specific record typenslookup -type=MX domaindig domain MXdig domain MX
Clear the resolver cacheipconfig /flushdnsresolvectl flush-cachessudo dscacheutil -flushcache
Show the cacheipconfig /displaydnsresolvectl statisticsNot exposed

ARP, routes and sockets

QuestionWindowsLinuxmacOS
Who has this address on my segment?arp -aip neigharp -a
Routing tableroute printip routenetstat -rn
Add a static routeroute add 10.0.0.0 mask 255.0.0.0 192.168.1.1ip route add 10.0.0.0/8 via 192.168.1.1sudo route -n add 10.0.0.0/8 192.168.1.1
Listening ports and connectionsnetstat -anoss -tulpnnetstat -an; lsof -i
Which process owns the port?netstat -ano then tasklist /fi "pid eq N"ss -tulpn (shows the process)lsof -i :443

Ports, captures and throughput

QuestionCommandNote
Is a TCP port open?Test-NetConnection host -Port 443PowerShell; nc -zv host 443 on Linux and macOS
Which ports are open on a host?nmap hostScan only what you are authorized to scan
Capture packetstcpdump -i eth0 port 53Wireshark for the same on any platform, with a display filter
Measure throughputiperf3 -s on one end, iperf3 -c host on the otherTests the path, not the internet
Check a web endpointcurl -I https://hostHeaders and status without the body

Try it here

Three verified practice questions on this material. Answer one, and see the official page behind the answer.

3-2Network Operations

A switch sends unsolicited alerts to the manager when a link drops. Which UDP port receives those?

Five free questions on every practice exam. No account, no card.