Command Line: ping, traceroute/tracert, nslookup, tcpdump, dig, netstat, ip/ifconfig/ipconfig, arp

5.4 Troubleshooting Tools

Software Tools

📘CompTIA Network+ (N10-009)


Command line tools are essential for network troubleshooting because they allow IT professionals to quickly check network connectivity, analyze traffic, and gather information about devices on the network. These tools are used in Windows, Linux, and macOS environments, though some commands have slight differences.


1. ping

Purpose:

  • Tests whether a device on the network is reachable.
  • Measures the round-trip time for packets sent to the device.

How it works in IT environments:

  • Used to check if a server, router, or any device is online.
  • Can detect packet loss, which might indicate network congestion or hardware issues.

Example commands:

  • Windows/Linux/macOS: ping 192.168.1.1 ping www.example.com

Key points for exam:

  • Uses ICMP (Internet Control Message Protocol).
  • Responses show time and TTL (Time To Live).
  • If the device is unreachable, you’ll see “Request timed out” or “Destination unreachable.”

2. traceroute / tracert

Purpose:

  • Maps the path packets take from your computer to a destination.
  • Helps identify where delays or failures occur in the network.

How it works in IT environments:

  • Used to troubleshoot slow connections or routing issues.
  • Helps network engineers see which routers are causing latency.

Example commands:

  • Windows: tracert www.example.com
  • Linux/macOS: traceroute www.example.com

Key points for exam:

  • Shows each hop along the network path.
  • Useful for diagnosing routing loops or unreachable devices.

3. nslookup

Purpose:

  • Checks DNS (Domain Name System) resolution.
  • Finds the IP address for a domain or vice versa.

How it works in IT environments:

  • Used when a website cannot be reached to see if the DNS is the problem.
  • Can query specific DNS servers.

Example commands:

nslookup www.example.com
nslookup 8.8.8.8

Key points for exam:

  • Works with Windows, Linux, macOS.
  • Can diagnose DNS misconfigurations.
  • Two types of queries: forward lookup (name → IP) and reverse lookup (IP → name).

4. tcpdump

Purpose:

  • Captures and analyzes network packets in real time.

How it works in IT environments:

  • Used by network administrators to inspect traffic for troubleshooting or security analysis.
  • Helps identify unusual traffic patterns or packet loss.

Example commands:

tcpdump -i eth0
tcpdump -n host 192.168.1.10

Key points for exam:

  • Usually used on Linux/macOS.
  • Can filter traffic by host, port, or protocol.
  • Requires administrative privileges.

5. dig

Purpose:

  • Performs DNS lookups, similar to nslookup, but more detailed.

How it works in IT environments:

  • Used to verify DNS records such as A, MX, NS, CNAME.
  • Helps troubleshoot DNS issues with more options than nslookup.

Example commands:

dig www.example.com
dig @8.8.8.8 example.com MX

Key points for exam:

  • Works mainly on Linux/macOS.
  • Shows detailed DNS query information.
  • Supports querying specific record types.

6. netstat

Purpose:

  • Displays active network connections, ports, and routing tables.

How it works in IT environments:

  • Used to see which services are running and listening on which ports.
  • Helps detect unauthorized connections or network issues.

Example commands:

  • Windows/Linux/macOS: netstat -an netstat -r netstat -s

Key points for exam:

  • -a shows all connections.
  • -n shows addresses numerically.
  • -r displays the routing table.
  • -s shows protocol statistics.

7. ip / ifconfig / ipconfig

Purpose:

  • Displays and configures IP addresses on devices.

How it works in IT environments:

  • Used to check a device’s IP configuration.
  • Troubleshoots network connectivity issues like wrong subnet or missing gateway.

Example commands:

  • Windows: ipconfig ipconfig /all ipconfig /release ipconfig /renew
  • Linux/macOS: ifconfig ip addr show ip link show

Key points for exam:

  • ipconfig = Windows, ifconfig/ip = Linux/macOS.
  • Can release and renew DHCP addresses.
  • Shows IP address, subnet mask, gateway, and DNS.

8. arp

Purpose:

  • Displays and modifies the ARP (Address Resolution Protocol) table.

How it works in IT environments:

  • Used to map IP addresses to MAC addresses.
  • Helps troubleshoot local network connectivity issues.

Example commands:

arp -a
arp -d 192.168.1.10
arp -s 192.168.1.20 00-14-22-01-23-45

Key points for exam:

  • Can view the ARP cache to see which MAC addresses are associated with which IPs.
  • Can manually add or delete entries.
  • Important for resolving LAN connectivity problems.

Summary for Exam

ToolPurposeKey Exam Points
pingTest connectivityUses ICMP, shows response time, packet loss
traceroute / tracertTrace path to destinationShows each hop, latency, routing issues
nslookupDNS resolutionForward/reverse lookup, query specific DNS
tcpdumpPacket capture & analysisFilters traffic, real-time analysis, Linux/macOS
digDNS lookupDetailed queries, record types, Linux/macOS
netstatConnections & portsActive connections, routing tables, protocol stats
ip / ifconfig / ipconfigIP configurationShows IP, subnet, gateway; DHCP release/renew
arpMap IP to MACView, add, delete ARP entries; LAN troubleshooting

These command line tools are critical in real IT environments for troubleshooting network issues, checking connectivity, inspecting DNS problems, and monitoring network traffic. For the exam, remember their purpose, common commands, and the operating systems they work on.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee