Ping Command | ICMP Protocol

Ping Command | ICMP Protocol


Ping command in computer network


The Ping command is a simple network troubleshooting tool that helps us check whether a destination is reachable. It uses the ICMP protocol and, when executed, measures the round-trip time (RTT) between the request and the response in milliseconds (ms), also known as latency.
However, a destination may be online and working properly while its firewall blocks ICMP traffic, preventing it from responding to Ping requests.


  • ping [Options] destination
This is the general structure of the ping command
for example, we pinged the Google domain which indicates that the destination is accessible to us


Ping Command | ICMP Protocol


Reply from: Destination IP

Bytes: ICMP data size

Time: Round-trip duration

Ttl: The TTL value indicates the remaining lifetime of a packet
each router along the path decrements this value by one

Ttl os detection: linux < 100 < windows < 200 < router

Request timed out: The issue stems from the firewall or the destination being inactive

Destination host unreachable | Destination net unreachable: Problem with routing

General failure: The issue lies with the system's network configuration

Ttl expired in transit: TTL has reached zero, and the packet's lifespan has ended

Unknown host: The problem is with the DNS
  • ping -s [Bytes] destination
By specifying the size of the ICMP data packet (in bytes) during a ping, one can examine network behavior across different packet sizes; for instance, small pages may load, while large pages might load only partially

Ping Command | ICMP Protocol






  • ping -t [Num] destination
The TTL (Time to Live) value represents the lifetime of a packet within a network
As the packet travels from source to destination, this value decreases by one each time it passes through a router
If the value reaches zero, the router discards the packet and sends an error message back to the source
For instance, if the TTL is set to 1, the packet's lifetime expires at the first router (which is typically the default gateway), and an error message is returned to the source
Similarly, if the value is set to 2, the packet's lifetime expires at the second router along the path
In this way, by manually changing the TTL value in the ping command, one can perform a traceroute-like operation to identify the IP addresses of the routers along the path from source to destination


Ping Command | ICMP Protocol



Ping Command | ICMP Protocol





  • ping -I [Source ip or Inteface] destination
If you have multiple network interfaces, you can choose which one to use for the ping operation
Alternatively, you can specify a source IP address
In this case, the destination host will send its response back to the specified source IP address
Note that the source IP address must already be assigned to one of your network interfaces
In this example, we have configured the system to use a specific source IP address when pinging Google

Ping Command | ICMP Protocol




  • ping -f destination
Flooding a target with a large number of ping requests can overwhelm its resources and potentially disrupt its availability This is a DoS attack

Ping Command | ICMP Protocol





  • ping -6 destination

Using IPv6



Comments

Popular posts from this blog

Top Free Online IDEs and Platforms for Running Resource-Intensive Python Code

Google Dork (Google Hacking) for Advance Google Search with Examples