PracticeBlogFlashcardsEspañol

Command-Line Tools: ping, traceroute, nslookup, dig, ipconfig, ifconfig, ip, arp, netstat, ss, and route

Key Takeaways

  • ping tests reachability with ICMP, but a blocked ping does not always mean the host or service is down.
  • traceroute and tracert show the path toward a destination and can reveal routing or hop-related loss.
  • nslookup and dig test DNS resolution, record types, authoritative answers, and resolver behavior.
  • ipconfig, ifconfig, and ip show local addressing, interface state, gateways, DNS settings, and lease information.
  • arp, netstat, ss, and route help inspect neighbor resolution, active connections, listening ports, and routing tables.
Last updated: April 2026

Command-Line Troubleshooting Tools

Command-line tools help isolate where a problem exists: local host, name resolution, default gateway, routing path, remote service, or policy enforcement. The exam often asks for the best next tool based on a symptom.

Reachability and Path

ToolCommon platformsWhat it tests
pingWindows, Linux, macOSICMP reachability, latency, packet loss
tracerouteLinux, macOSPath toward a destination using TTL behavior
tracertWindowsWindows path tracing
pathpingWindowsCombines path discovery with packet loss statistics

Ping is useful but limited. A host or firewall may block ICMP while the application still works. Traceroute can show where packets stop, but routers may rate-limit or block traceroute responses. Use these tools as evidence, not absolute proof.

DNS Tools

ToolBest use
nslookupQuick DNS lookup and resolver testing
digDetailed DNS queries, record types, authoritative servers, TTLs
hostSimple hostname lookup on many Unix-like systems

DNS symptoms include users reaching an application by IP address but not by name, wrong records after a change, split-horizon DNS issues, expired TTL expectations, and only one resolver returning a bad answer.

Example decision: If https://portal.example.com fails but https://203.0.113.50 works, test DNS with nslookup or dig before replacing network hardware.

Interface and Address Tools

ToolCommon platformUseful output
ipconfigWindowsIP address, mask, gateway, DNS, DHCP lease details
ipconfig /allWindowsDetailed adapter configuration
ipconfig /release and /renewWindowsDHCP lease release and renewal
ifconfigOlder Unix-like systemsInterface addresses and basic state
ip addrLinuxInterface addresses and status
ip linkLinuxLink state, MAC address, MTU
ip routeLinuxRouting table and default gateway

If one workstation cannot connect, check whether it has a valid IP address, subnet mask, default gateway, DNS server, and link state. An APIPA address in 169.254.0.0/16 on Windows usually suggests DHCP failure for that host or segment.

Neighbor, Socket, and Route Tools

ToolWhat it showsScenario
arp -aARP cacheCheck IP-to-MAC resolution on local subnet
ip neighLinux neighbor tableModern Linux equivalent for ARP and neighbor entries
netstatConnections, listening ports, routes, interface statsFind whether a service is listening or sessions exist
ssModern Linux socket statisticsFaster replacement for many netstat uses
route printWindows routing tableConfirm default route or static routes
routeUnix-like routing table commandInspect or change routes depending on platform

When a client and server are on the same subnet, ARP matters. If a default gateway MAC address cannot be resolved, off-subnet traffic will fail. When a service is unreachable, netstat or ss can show whether the service is listening on the expected port and interface.

Symptom-to-Tool Matrix

SymptomFirst useful command
User has no IP address or wrong gatewayipconfig /all, ip addr, or ip route
Hostname fails but IP worksnslookup or dig
Need to see where path stopstraceroute or tracert
Need to verify local neighbor resolutionarp -a or ip neigh
Need to see listening TCP portsnetstat or ss
Need to inspect default routeroute print or ip route

Common Traps

  • Successful ping to a server does not prove the application port is open.
  • Failed ping does not prove the server is down if ICMP is blocked.
  • DNS cache can make one client behave differently from another.
  • A correct IP address with the wrong subnet mask can still break local communication.
  • Multiple default gateways on one host can create unpredictable routing.
Test Your Knowledge

A user can reach a web application by IP address but not by hostname. Which tool should be used first?

A
B
C
D
Test Your KnowledgeMatching

Match each command-line tool to its common troubleshooting use.

Match each item on the left with the correct item on the right

1
ping
2
traceroute or tracert
3
arp -a
4
ss or netstat
Test Your Knowledge

A Windows workstation has a 169.254.x.x address and cannot reach network services. What is the most likely direction to investigate?

A
B
C
D