Sunday, October 27, 2019

The Ping command & 56 data bytes

The ping command sends an Internet Control Message Protocol (ICMP) ECHO_REQUEST to obtain an ICMP ECHO_RESPONSE from a host or gateway. The ping command is useful for:
Determining the status of the network and various foreign hosts.
Tracking and isolating hardware and software problems.
Testing, measuring, and managing networks.

If the host is operational and on the network, it responds to the echo. Each echo request contains an Internet Protocol (IP) and ICMP header, followed by a timeval structure, and enough bytes to fill out the packet. The default is to continuously send echo requests until an Interrupt is received (Ctrl-C).

The ping command sends one datagram per second and prints one line of output for every response received. The ping command calculates round-trip times and packet loss statistics, and displays a brief summary on completion. The ping command completes when the program times out or on receipt of a SIGINT signal. The Host parameter is either a valid host name or Internet address.

By default, the ping command will continue to send echo requests to the display until an Interrupt is received (Ctrl-C). Because of the load that continuous echo requests can place on the system, repeated requests should be used primarily for problem isolation.

Below are the various flags and options

-n Specifies numeric output only. No attempt is made to look up symbolic names for host addresses.
-r Bypasses the routing tables and sends directly to a host on an attached network. If the Host is not on a directly connected network, the ping command generates an error message. This option can be used to ping a local host through an interface that no longer has a route through it.
-s PacketSize Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
-src hostname/IP_add Uses the IP address as the source address in outgoing ping packets. On hosts with more than one IP address, the -src flag can be used to force the source address to be something other than the IP address of the interface on which the packet is sent. If the IP address is not one of the machine's interface addresses, an error is returned and nothing is sent.

Below are the parameters

Count : Specifies the number of echo requests to be sent (and received). This parameter is included for compatibility with previous versions of the ping command.

Below is an example which sends 5 packets

SUPER-M-91RJ:CNAServer tetuser$ ping google.com -c 5
PING google.com (216.58.199.174): 56 data bytes
64 bytes from 216.58.199.174: icmp_seq=0 ttl=49 time=25.742 ms
64 bytes from 216.58.199.174: icmp_seq=1 ttl=49 time=25.684 ms
64 bytes from 216.58.199.174: icmp_seq=2 ttl=49 time=27.228 ms
64 bytes from 216.58.199.174: icmp_seq=3 ttl=49 time=26.242 ms
64 bytes from 216.58.199.174: icmp_seq=4 ttl=49 time=26.172 ms

--- google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 25.684/26.214/27.228/0.554 ms




References:
https://www.ibm.com/support/knowledgecenter/TI0003M/p8hcg/p8hcg_ping.htm

No comments:

Post a Comment