ping command


Internet Control Message Protocol (ICMP) is used to report errors and send messages about the delivery of a packet.

  • messages are generated under error conditions in most types of unicast traffic
    • not for broadcast traffic
  • can be used to test and troubleshoot connectivity issues on IP networks
  • ping command sends a configurable number and size of ICMP request packets to a destination host
    • implemented on both Windows and Linux
    • can perform a basic connectivity test
      • not dependent on target host running any higher-level applications or services

Basic Usage

  • ping IPAddress performs a basic connectivity test
    • output shows:
      • the message “Reply from IPAddress”
      • time it takes for server’s response to arrive
      • round-trip time (RTT) is used to diagnose latency problems on a link
      • TTL field shows the value of the counter when the packet arrived at its destination
    • Time to live (TTL) IP header field is reduced by one every time a packet is forwarded by a router
      • called a hop

ping Error Messaging

  • two messages received if ping is unsuccessful:
    • destination host unreachable
      • no routing information
        • local computer does not know how to get to the IP address
        • could be caused by a configuration error on the local host
          • e.g., incorrect default gateway
    • no reply (request timed out)
      • host is unavailable or cannot route a reply to your computer
      • requests time out when the TTL is reduced to 0 because
        • the packet is looping
        • congestion causes delays
        • when host does not respond

ping Switches

  • can use hostname or fully qualified domain name instead of IP address
  • when pinging by name, use -4 or -6 to force tool to use IPv4/IPv6
  • -t continues to ping host until interrupted (Ctrl+C)
  • different syntax in Linux
    • executes until manually halted by default
    • -c switch sets a number of specified packets to send