The ping is used to send ICMP ECHO_REQUEST to the network hosts.
The PING stands for Packet Internet Groper. It is the best way to test the connectivity between two nodes. It may be a Local Area Network (LAN) or Wide Area Network (WAN), Ping works fine. Ping uses ICMP (Internet Control Message Protocol) to communicate to the other devices. You can use ping to the IP address of a hostname .
The ping uses ICMP protocol’s ECHO_REQUEST which is a mandatory datagram to elicit an ICMP ECHO_RESPONSE from a gateway or a host. The ECHO_REQUEST datagrams have an ICMP and IP and header, followed by a struct timeval and then arbitrary number of “pad” bytes that are used to fill out this packet.
OPTIONS :
-d
To set SO_DEBUG socket option.
-l
To Loose source route. This option is used in the IP header to send packet to given host and then back again. Usually specified with -R option.
-r
Bypass normal routing tables and send directly to host on the attached network. If host is not on a directly-attached network then an error is returned.
-L
Turn off the loopback of multicast packets.
-v
The Verbose output. Lists any ICMP packets, other than the ECHO_RESPONSE, which are received.
-n
Show the network addresses as numbers. The ping normally displays addresses as the host names
-R
This is the Record route. It sets the IP record route option, which stores the route of packet inside IP header. The contents of record route will only be printed if -v option is given, and only be set on the return packets if target host preserves record route option across the echos, or even -l option is given.
-i interface_address
This specifies the outgoing interface address to use for the multicast packets.
-I interval
Specify the interval between successive transmissions. The default is one second.
-t ttl
Specify the IP time to live for unicast and multicast packets. The default time to live for unicast packets is set with ndd (using the icmp_def_ttl variable).