Icmp


ICMP  Internet control message protocol
q). Why we use ICMP?
ans).
*.The IPV4 provides unreliable and connectionless datagram 
  delivery. It was designed this way to make efficient use of
  network resources.
*.The IP protocol is a best-effort delivery service that delivers
  a datagram from its original source to its final destination.
*.However, it has two deficiencies: lack of error control and
  lack of assistance mechanisms.
*.ICMPv4 is designed to compensate for these deficiencies.

q).what if ICMP itself failures?
ans).
*.NO ICMP error message will be generated in response to a
  datagram carrying an ICMP error message.

q).so, for every fragment IP packet, ICMP will generate right? If
   any failure?
ans).
*.No ICMP error message will be generated for a fragmented
  datagram that is no the first fragment.

q).is it like any other restrictions for ICMP generation?
ans).
*.No ICMP error message will be generated for a datagram having a 
  special address such as 127.0.0.0 or 0.0.0.0 and multicast
  address.

q).to whom ICMP error msg will be sent?
ans).
*.ICMP always reports error messages to the original source.

q).if no ICMP error msg, can we assume packet is delivered to destination successfully?
ans).
*.Note that even if a node/router/host does not report any ICMP
  error message to the source, it does not necessarily mean that
  the datagram has been successfully delivered.

q).does IP have flow-control mechanism?
ans).
*.There is no flow-contol or congestion-control mechanism if it 
  is IP protocol. And IP is connectionless protocol.
*.The source-quench message in ICMP was designed to add a kind of
  flow control and congestion control to the IP.

Source-quench:
—-------------
A source-quench message informs the source that a datagram has been discarded due to congestion in a router or the destination host. The source must slow down the sending of datagrams until the congestion is relieved.


q).do you have any situation that ICMP generates ‘time to live’ error packet?
ans).
*. If there are errors in one or more routing tables, a packet
  can travel in a loop or a cycle, going from one router to the
  next of visiting a series of routers endlessly. When a ttl
  field reaches 0 in IP packet. Datagram can be discarded, a
  time-exceeded message must be sent by the router to the
  original source.

q).what are notable ICMP message types?
ans).
*.
Summary of Message Types

    0  Echo Reply
    3  Destination Unreachable
    4  Source Quench
    5  Redirect
    8  Echo
   11  Time Exceeded
   12  Parameter Problem
   13  Timestamp
   14  Timestamp Reply
   15  Information Request
   16  Information Reply

q).Shall we talk on Icmp code type 5 ?
ans).
*.

Traceroute or tracert:
—--------------------
src:https://www.youtube.com/watch?v=xhL5Usvklpo by Elon musk


q).Why traceroute sends three messages to every device ?
Ans).
*.


q).how ping works?
ans).
*.
https://www.geeksforgeeks.org/ping-in-c/



q).traceroute google.com ?
ans).
*.my laptop ip: 192.168.0.104
     Google ip: 172.217.166.110


—-- 
(1) traceroute google.com , icmp echo request 👇 with ttl=1


(2) icmp echo reply 👇 from home route to laptop