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
pingcommand 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 IPAddressperforms 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
- output shows:
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 routing information
- 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
- destination host unreachable
ping Switches
- can use hostname or fully qualified domain name instead of IP address
- when pinging by name, use
-4or-6to force tool to use IPv4/IPv6 -tcontinues to ping host until interrupted (Ctrl+C)- different syntax in Linux
- executes until manually halted by default
-cswitch sets a number of specified packets to send