🔧

Essential Network Troubleshooting Commands

Apr 23, 2025

Network Troubleshooting Utilities

Ping Command

  • Purpose: Check if a device on the network is reachable.
  • Protocol Used: ICMP (Internet Control Message Protocol).
  • Usage:
    • Commonly used in troubleshooting to see if a device is on the network and responding.
    • Works the same across macOS, Linux, and Windows.
    • Example: ping 1.1.1.1 (Cloudflare DNS)
    • Successful ping sends and receives 64 bytes, showing sequence numbers, TTL (Time to Live), and round trip time.
    • Errors: Displays a timeout message if the device is unreachable.
  • Stopping Continuous Ping: Use CTRL + C to stop and see statistics.

Traceroute Command

  • Purpose: Maps the route and identifies routers between your device and a destination.
  • Operating System Differences:
    • Linux/macOS: traceroute
    • Windows: tracert
  • ICMP Usage: Uses ICMP Time to Live exceeded error message; TTL refers to number of hops, not time.
  • Challenges: ICMP messages can be filtered by firewalls, shown as asterisks in output.
  • Example: Tracing a route to Google DNS 8.8.8.8.
  • Output: Shows each hop (router) and response times.

DNS Lookup Tools

  • NSLookup:
    • Deprecated but included in Windows, Linux, MacOS.
    • Usage: Perform queries to a DNS server.
  • Dig:
    • Preferred over NSLookup.
    • Included in Linux, MacOS, and available for Windows.
    • Provides queries and responses in a different format but similar information.
  • Example Query: www.professormesser.com returns multiple IPs for redundancy.

Packet Capture Tools

  • TCPDump:
    • Command-line packet capture utility available in Linux/macOS.
    • Saves captures in PCAP format, compatible with Wireshark.
    • Filters can be used to limit data and save to files for later analysis.
  • Windows Equivalent: WinDump.

Network Statistics Tool

  • Netstat:
    • Shows active connections and their executables.
    • Options include:
      • netstat -a: All active connections.
      • netstat -b: Show executables in Windows.
      • netstat -n: Display only IP addresses.
  • Usage: Identifying ports and processes that are open and communicating.

IP Configuration Tools

  • IPConfig (Windows):
    • Displays IP, subnet mask, and default gateway.
    • Use /all for detailed information like MAC address.
  • IfConfig (Linux/macOS):
    • Provides similar information as IPConfig.
    • Newer command: ip address.

Address Resolution Protocol (ARP)

  • ARP Table: Maps IP addresses to MAC addresses.
  • View ARP Cache: arp -a
  • Usage: Helpful in identifying devices on the local subnet and verifying network connections.