This chapter covers four essential command-line interface (CLI) tools: ping, tracert (and traceroute), nslookup, and netstat. For the N10-009 exam, these tools are tested under Domain 5.0 (Network Troubleshooting), Objective 5.6: 'Given a scenario, use appropriate network software tools and commands.' Approximately 10-15% of exam questions involve interpreting output from these tools to diagnose connectivity, name resolution, or performance issues. Mastering their syntax, options, and output interpretation is critical for both the exam and real-world network troubleshooting.
Jump to a section
Imagine you are a detective investigating a network crime. Your tools are like a detective's kit: ping is your 'voice call' to check if a suspect is home—you shout 'Are you there?' and wait for an echo. If you get a reply, you know the suspect is alive and reachable. tracert is your 'footstep tracker'—you follow the path the suspect took, noting every street corner (router) they passed, and how long they lingered at each corner. nslookup is your 'phone book'—you look up a name (domain) to find an address (IP), or reverse-look up an address to find a name. netstat is your 'surveillance camera'—you watch all active conversations (connections) happening on your network, seeing who is talking to whom, on which port, and whether the conversation is established or just starting. Each tool gives you a different piece of the puzzle to diagnose why the network is slow, unreachable, or compromised. Just as a detective uses the right tool for the right clue, a network engineer uses these CLI tools to pinpoint the exact layer of the OSI model where a fault lies.
Ping (Packet Internet Groper)
Ping is the most fundamental network connectivity test tool. It works by sending Internet Control Message Protocol (ICMP) Echo Request packets to a target host and waiting for ICMP Echo Reply packets. The tool measures round-trip time (RTT) and packet loss, giving immediate insight into whether a host is reachable and how responsive the path is.
ICMP Echo Mechanism: - Ping sends an ICMP type 8 (Echo Request) to the destination IP address. - The destination, if reachable and configured to respond, replies with ICMP type 0 (Echo Reply). - Each packet has a sequence number and timestamp to track individual responses. - Default payload size is 32 bytes (Windows) or 56 bytes (Linux/macOS). Total packet size is 84 bytes (including 20 bytes IP header + 8 bytes ICMP header).
Default Behavior and Options:
- Windows: sends 4 Echo Requests by default, waits 4 seconds for each reply.
- Linux/macOS: sends continuous Echo Requests until interrupted (Ctrl+C).
- Key options:
- -n count (Windows) or -c count (Linux): specify number of packets.
- -t (Windows): ping continuously until interrupted.
- -l size (Windows) or -s size (Linux): specify packet size.
- -i TTL (Linux) or -h TTL (Windows? Actually -i on Windows sets TTL? Windows uses -i for TTL, but -h is not used. Windows: -i TTL sets Time to Live. Linux: -t TTL sets TTL.)
- -f (Linux): set Don't Fragment flag to test MTU.
Interpreting Ping Output: - Success: Replies show source IP, sequence number, TTL, and RTT in milliseconds. - Timeout: Request timed out indicates no Echo Reply received within timeout. - Destination Host Unreachable: An intermediate router could not forward the packet (no route). - TTL Exceeded: A router decremented TTL to 0 and discarded the packet, sending ICMP Time Exceeded. - Packet Loss: Percentage of packets not replied. High loss indicates congestion or link issues. - RTT variations: High jitter (variance in RTT) suggests network congestion or path changes.
Ping is Layer 3 (Network Layer) tool. It does not test higher-layer services (e.g., web server running). A successful ping only proves IP connectivity and ICMP response.
Tracert (Windows) / Traceroute (Linux/macOS)
Tracert maps the path packets take from source to destination, listing each hop (router) along the way. It exploits the TTL field in the IP header.
How Traceroute Works:
1. Sends packets with TTL=1. The first router decrements TTL to 0, discards the packet, and sends ICMP Time Exceeded (type 11) back to source. The source records the router's IP address and RTT.
2. Sends packets with TTL=2. The first router decrements to 1, forwards; second router decrements to 0, sends Time Exceeded. Source records second hop.
3. Continues incrementing TTL until the destination is reached or a maximum hop count (default 30).
- Windows tracert uses ICMP Echo Requests; Linux traceroute uses UDP packets to high ports (default 33434-33534) by default, or ICMP with -I option.
Output Interpretation: - Each line shows hop number, router IP/hostname, and three RTT measurements (if three probes per hop; default). - Asterisks (* * *) indicate no response from that hop (router may not send Time Exceeded, or it's filtered). - High RTT at a hop suggests congestion or slow link. - Changes in path (different IPs) indicate asymmetric routing or load balancing.
Common Options:
- -d (Windows): do not resolve IP addresses to hostnames (speeds up).
- -h maximum_hops (Windows) or -m max_ttl (Linux): set max hops.
- -w timeout (Windows): set wait time per reply.
- -I (Linux): use ICMP Echo instead of UDP.
- -T (Linux): use TCP SYN to port 80 (useful when ICMP/UDP blocked).
Limitations: - Many routers are configured not to send ICMP Time Exceeded, resulting in asterisks. - Load-balanced paths may show multiple IPs per hop or inconsistent paths. - Firewalls may block ICMP or UDP probes entirely.
Nslookup (Name Server Lookup)
Nslookup queries Domain Name System (DNS) servers to resolve domain names to IP addresses or perform reverse lookups (IP to name). It operates in two modes: interactive and non-interactive.
Non-Interactive Mode:
nslookup domain_name returns the IP address(es) associated with that domain, using the system's default DNS server.
nslookup IP_address performs a reverse DNS lookup (PTR record).
Interactive Mode:
Type nslookup alone to enter interactive mode. Then set options:
- server <DNS_server_IP>: query a specific DNS server.
- set type=<record_type>: query specific record types (A, AAAA, MX, NS, CNAME, PTR, SOA, etc.).
- set debug: show detailed query and response messages.
- ls -d domain: list all records in a zone (often restricted).
Common Record Types for Exam: - A: IPv4 address - AAAA: IPv6 address - CNAME: canonical name (alias) - MX: mail exchange server - NS: authoritative name server - PTR: pointer for reverse lookup - SOA: start of authority (zone metadata) - TXT: text records (SPF, DKIM, etc.)
Interpreting Output: - Non-authoritative answer: The responding server is not authoritative for the domain; it cached the record. - Authoritative answer: The server is the authoritative source. - Server: Address: shows which DNS server answered. - *** Can't find domain: Non-existent domain (NXDOMAIN) or no record of requested type. - DNS request timed out: Server did not respond.
Nslookup vs. Dig: On Linux/macOS, dig is more powerful. nslookup is deprecated on some systems but still widely used and exam-relevant.
Netstat (Network Statistics)
Netstat displays network connections, routing tables, interface statistics, and protocol-specific information. It is used to monitor active connections, listening ports, and network performance.
Common Options:
- -a: show all connections and listening ports.
- -n: show IP addresses and port numbers numerically (no name resolution).
- -o: show owning process ID (Windows).
- -p protocol: filter by protocol (TCP, UDP, etc.).
- -r: display routing table.
- -s: per-protocol statistics.
- -e: Ethernet statistics.
- -b (Windows): show executable name (requires admin).
Output Fields (for active connections):
- Proto: protocol (TCP, UDP).
- Local Address: local IP and port.
- Foreign Address: remote IP and port.
- State: TCP connection state (LISTENING, ESTABLISHED, TIME_WAIT, CLOSE_WAIT, etc.).
- PID: process ID (with -o).
Common TCP States (Exam Relevance): - LISTENING: Server is waiting for incoming connection. - ESTABLISHED: Active connection established. - TIME_WAIT: Connection closing, waiting for final packets. - CLOSE_WAIT: Remote side closed, local waiting to close. - SYN_SENT: Actively trying to establish connection.
Use Cases:
- Check if a service is listening on expected port (e.g., netstat -an | findstr :80).
- Identify suspicious connections (unusual foreign addresses).
- View routing table (netstat -r or route print).
- Monitor interface statistics (netstat -e) for errors and collisions.
Limitations:
- On modern systems, ss (socket statistics) on Linux is faster and more detailed.
- Netstat output can be overwhelming on busy servers; use filters.
Interaction with Other Technologies
These tools work at different OSI layers:
Ping and tracert: Layer 3 (Network) and Layer 4 (Transport) for ICMP.
Nslookup: Layer 7 (Application) for DNS.
Netstat: Layer 4 (Transport) and Layer 3 (Network) for connection state and routing.
In troubleshooting, you combine them: ping to test basic connectivity, tracert to find where packets drop, nslookup to verify DNS resolution, and netstat to check if local services are listening or if connections are established.
Ping to Test Basic Connectivity
Use ping to verify that the destination host is reachable at the network layer. Send four ICMP Echo Requests (default on Windows) and observe replies. If all succeed, Layer 3 connectivity is working. If any fail, note packet loss percentage and RTT. High loss suggests congestion or link issues; 100% loss indicates no route or host down. Check for 'Destination Host Unreachable' (local route problem) vs 'Request Timed Out' (no response, possibly firewall). Always ping the default gateway first to isolate local vs remote issue.
Tracert to Map Path and Identify Hops
Run tracert (Windows) or traceroute (Linux) to the destination. The tool sends probes with incrementing TTL. Each responding router sends ICMP Time Exceeded. Examine each hop: asterisks indicate no response (possible filtering). Note RTT per hop; a sudden spike in RTT at a specific hop suggests congestion or a slow link. If tracert stops at a hop before destination, that router is likely dropping packets or not responding. Use -d to skip DNS resolution for faster results. On Linux, use -I for ICMP probes if UDP is blocked.
Nslookup to Verify DNS Resolution
Use nslookup to confirm that DNS is resolving the domain name correctly. Query the default DNS server by typing nslookup domain.com. If it returns an IP, record type A (IPv4) or AAAA (IPv6). If it fails, try querying a specific DNS server (e.g., 8.8.8.8) to isolate if the issue is with the local DNS server. Use set type=MX to check mail records, set type=NS for authoritative servers. Reverse lookup with nslookup IP_address to verify PTR records. NXDOMAIN means the domain does not exist; no answer means no record of that type.
Netstat to Inspect Active Connections
Run netstat -an to list all active TCP and UDP connections with numeric addresses. Look for expected listening ports (e.g., :80 for HTTP, :443 for HTTPS). If a service is not listening, it may be down. Check for unexpected connections to foreign addresses that could indicate malware. Use netstat -o to find process IDs (Windows) and netstat -b for executable names (admin). On Linux, use netstat -tulpn for listening ports with process names. Also check routing table with netstat -r for incorrect routes.
Correlate Findings to Isolate Fault
Combine outputs from all tools to pinpoint the problem layer. Example: If ping to a web server fails but nslookup resolves the name, the issue is at Layer 3 (routing/firewall) or Layer 2 (switch). If ping succeeds but netstat shows no connection on port 80, the web server may be down. If tracert shows path stops at a specific router, that router may be misconfigured or blocking ICMP. Always start from Layer 1 (physical) and move up. Use the OSI model: ping tests Layer 3, nslookup tests Layer 7, netstat tests Layer 4.
In a large enterprise with multiple branch offices, a network engineer uses ping to verify connectivity to remote sites. A common scenario is when users report slow application performance. The engineer pings the application server and notices high RTT (e.g., 300 ms vs baseline 20 ms). Then runs tracert and discovers a specific hop with high latency (e.g., an MPLS router experiencing congestion). This identifies the need to upgrade the WAN link or implement QoS. In another scenario, a website is unreachable. Ping to the IP works but nslookup returns 'Non-existent domain'. This indicates a DNS issue—the domain's A record was deleted or the authoritative server is misconfigured. The engineer uses nslookup with set type=SOA to check the SOA record and finds the zone is expired. The fix is to update the DNS zone on the primary DNS server. For security monitoring, netstat is used daily to detect unauthorized connections. A server administrator runs netstat -anb (Windows) and sees an unknown process connecting to a foreign IP on port 4444. This triggers an incident response. The admin terminates the process and blocks the IP. In cloud environments (AWS/Azure), these tools are used from bastion hosts because direct ICMP may be blocked. Engineers use traceroute with TCP (-T) to bypass firewalls. In DevOps, netstat is used in scripts to verify that containers are listening on expected ports after deployment. Performance considerations: Ping with large packets (-l 1472) can test MTU issues. Tracert with -w 5000 (5 sec timeout) prevents long waits. Nslookup with timeout=5 prevents hangs. Netstat on high-traffic servers may consume CPU; use ss instead on Linux for efficiency. Misconfigurations: Forgetting to allow ICMP in firewall rules causes ping to fail, leading to false alarms. Using tracert without -d on slow links wastes time on reverse DNS. Nslookup without specifying a server may use a misconfigured local DNS, giving false negatives. Netstat without -n may take long to resolve names, and missing -b may not show process names, hindering malware detection.
The N10-009 exam tests Objective 5.6: 'Given a scenario, use appropriate network software tools and commands.' This includes interpreting output, selecting the correct tool for a given symptom, and understanding default behaviors and options. Common exam traps:
Ping vs Tracert for path discovery: Many candidates choose ping to find where packets drop. Wrong—ping only tells you if the destination is reachable, not the path. Tracert reveals each hop. The exam will ask: 'Which tool shows the path packets take?' Answer: tracert/traceroute.
Nslookup vs Netstat for service listening: A question: 'Users cannot connect to a web server. Which tool checks if the server is listening on port 80?' Wrong answer: nslookup (DNS resolution) or ping (connectivity). Correct: netstat -an | findstr :80 to see if LISTENING state exists.
ICMP filtering: The exam loves scenarios where ping fails but tracert succeeds partially. Many think ping failure means host down, but actually routers/firewalls may block ICMP Echo Requests while allowing other traffic. Tracert may still get ICMP Time Exceeded from intermediate routers if they allow that type.
DNS resolution order: Nslookup returns 'Non-authoritative answer'—candidates confuse this with error. It's normal for cached responses. The exam tests understanding of authoritative vs non-authoritative.
Netstat states: Questions ask 'Which state indicates a connection waiting for remote side to close?' Answer: CLOSE_WAIT. Common wrong: TIME_WAIT (local side waiting). Memorize: ESTABLISHED (active), LISTENING (waiting for connection), TIME_WAIT (local closing), CLOSE_WAIT (remote closed).
Tracert default protocol: Windows uses ICMP, Linux uses UDP. The exam may ask: 'Which protocol does traceroute use by default on Linux?' Answer: UDP. Or 'On Windows, tracert uses _____ packets.' Answer: ICMP Echo Requests.
Ping packet size: Default payload is 32 bytes (Windows) vs 56 bytes (Linux). The exam may test 'Which tool can test MTU using Don't Fragment flag?' Ping -f -l size on Linux or -f on Windows? Actually Windows ping -f -l size.
Nslookup interactive mode: Questions about 'set type=' commands. Know that 'set type=MX' queries mail exchange records.
Edge Cases:
Ping to loopback (127.0.0.1) tests local TCP/IP stack; if fails, stack is corrupt.
Tracert with -6 for IPv6.
Netstat -s shows per-protocol statistics; useful for identifying packet loss at transport layer.
Nslookup with debug shows full query/response; useful for exam simulation.
How to eliminate wrong answers: Understand the OSI layer each tool operates at. Ping = Layer 3, Netstat = Layer 4, Nslookup = Layer 7. If the symptom is 'no connectivity', Layer 3 tool first. If 'service not responding', Layer 4 tool. If 'name not resolving', Layer 7 tool. Match tool to symptom.
Ping uses ICMP Echo Request/Reply; default payload 32 bytes (Windows) or 56 bytes (Linux).
Tracert (Windows) uses ICMP; traceroute (Linux) uses UDP by default, but -I changes to ICMP.
Nslookup queries DNS; use 'set type=' for specific record types (A, MX, NS, etc.).
Netstat -an shows all connections with numeric addresses; -b shows process names (Windows admin).
Common TCP states: LISTENING, ESTABLISHED, TIME_WAIT, CLOSE_WAIT, SYN_SENT.
Ping loopback (127.0.0.1) tests local TCP/IP stack; failure indicates stack corruption.
Tracert max hops default is 30; use -h (Windows) or -m (Linux) to change.
Nslookup non-authoritative answer means response from cache, not authoritative server.
Netstat -r displays routing table; equivalent to 'route print' on Windows.
Combine tools: ping for reachability, tracert for path, nslookup for DNS, netstat for services.
These come up on the exam all the time. Here's how to tell them apart.
Ping
Tests reachability of a single host using ICMP Echo.
Measures RTT to destination only, not intermediate hops.
Default 4 packets (Windows) or continuous (Linux).
Cannot show path or identify which hop drops packets.
Operates at Layer 3 (Network).
Tracert/Traceroute
Maps each hop along path to destination.
Measures RTT per hop, identifies slow or unresponsive routers.
Sends 3 probes per hop by default.
Reveals path changes and hop-by-hop latency.
Operates at Layer 3 but uses ICMP (Windows) or UDP (Linux).
Nslookup
Queries DNS servers for name resolution.
Tests Layer 7 (Application) service availability.
Can query specific record types (A, MX, etc.).
Does not show active connections or listening ports.
Useful for verifying DNS configuration.
Netstat
Displays active network connections and listening ports.
Tests Layer 4 (Transport) and Layer 3 (routing table).
Shows connection states (ESTABLISHED, LISTENING, etc.).
Cannot perform name resolution queries.
Useful for checking if services are running and for security monitoring.
Mistake
Ping can verify that a web server is running.
Correct
Ping only tests ICMP echo at Layer 3. A web server may be up (responds to ping) but the HTTP service (Layer 7) may be down. Use netstat to check if port 80 is listening.
Mistake
Tracert always shows every router in the path.
Correct
Many routers are configured not to send ICMP Time Exceeded, resulting in asterisks. Also, load-balanced paths may not show all hops consistently.
Mistake
Nslookup resolves names using the system's DNS cache only.
Correct
Nslookup queries the configured DNS server directly and bypasses the local DNS cache. To check cache, use ipconfig /displaydns (Windows).
Mistake
Netstat -an shows process names by default.
Correct
Netstat -an shows numeric addresses and ports only. To see process names, use -b (Windows, admin required) or -o (shows PID, then tasklist to match).
Mistake
If ping fails, the destination is definitely down.
Correct
Firewalls often block ICMP Echo Requests. Ping failure does not guarantee host down; other protocols (TCP/UDP) may still work. Use tracert or telnet to test specific ports.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Windows tracert uses ICMP Echo Requests with incrementing TTL to elicit Time Exceeded messages. Linux traceroute uses UDP packets to high ports (default 33434-33534) by default, but can use ICMP with -I option. Both map the path but the underlying probe protocol differs. The exam may ask which protocol each uses.
Use netstat on the local machine to see if the port is listening. For remote ports, use telnet (e.g., telnet 192.168.1.10 80) or Test-NetConnection (PowerShell). Ping does not test ports. On Linux, use nc (netcat) or nmap. For exam, remember netstat shows local listening ports; telnet tests remote port connectivity.
'Destination Host Unreachable' is an ICMP message from a router indicating it has no route to the destination. 'Request Timed Out' means no Echo Reply was received within the timeout, possibly due to host down, firewall blocking, or network congestion. Unreachable is a definitive routing failure; timeout is ambiguous.
Yes, use 'set type=MX' then query the domain. Nslookup will return the mail exchange server(s) and their priority. For example: nslookup -type=mx domain.com. The exam may test record types; MX is for mail servers.
An asterisk indicates that the probe timed out without receiving an ICMP Time Exceeded message from that hop. This can happen if the router is configured not to send ICMP Time Exceeded, or if the probe is lost. It does not necessarily mean the router is down; it may still forward packets.
Use netstat -ano | findstr :port. The -o shows PID. Then use tasklist | findstr PID to see the process name. Alternatively, netstat -b (admin) shows the executable directly. For exam, know that -b requires admin and shows process name.
Windows sends 4 ICMP Echo Requests by default, then stops. Linux (and macOS) sends continuous pings until interrupted with Ctrl+C. Use -n (Windows) or -c (Linux) to specify count. The exam may ask default behavior.
You've just covered CLI Tools: ping, tracert, nslookup, netstat — now see how well it sticks with free N10-009 practice questions. Full explanations included, no account needed.
Done with this chapter?