Internet Control Message
Protocol (ICMP)
 IP provides unreliable and
  connectionless delivery
 No error reporting, or
  correcting mechanism
 No management of queries
        Error reporting vs. Error Correction
 ICMP can only report an error to the original source
     Up to the source to deal with it.
 ICMP cannot be used to inform intermediate routers.
     Source has no responsibility of routers problems.
                   ICMP messages
Type Message                   Type      Message
   3 Destination Unreachable   8 or 0    Echo request or reply
   4 Source Quench             13 or 14 Timestamp
  11 Time Exceeded             17 or 18 Address Mask
  12 Parameter problem         10 or 9   Router Sollicitation/Adv
   5 Redirection
        General format of ICMP messages
 Data section in
     Error Messages carries information to find the original packet that had
      the error
         Rest of Header unused (all 0s), except for Redirection message format
     Query Messages carries extra information based on type of the query.
         Rest of Header = Identifier (8 bits) + Sequence Number (8 bits)
Error-reporting messages
          Destination-unreachable (Type 3)
     0 Network is unreachable        8 source host isolated
     1 Host is unreachable           9 dest Network administratively prohibited
     2 Protocol is unreachable      10 dest Host admin prohibited
     3 Port is unreachable          11 Network unreachable for TOS
     4 Fragmentation required       12 Host unreachable for TOS
     5 Source routing not feasible 13 Administrator put a filter on Host
     6 Network unknown              14 requested precedence not permitted
     7 Host is unknown              15 Precedence was cut-off
   ICMP destination unreachable message for codes = 2 and 3 only created by a
    host
   All others are created by a routers
                   !!! Routers cannot detect all Problems that prevent
                   the delivery of a packet.
     Source-quench (type =4, code =0)
 IP do not provide a flow-control mechanism
      Source never knows if routers of destination is congested
 A source-quench message informs
    (1) informs the source of dropped packet
   (2) inform of congestion along the path
   (3) Source must slow down (quench) the sending of datagrams until the
    congestion is relieved.
          Time-exceeded message (Type 11)
 If router receives a datagram with TTL = 0
    Discard the datagram
    Inform the source using a Time-exceeded message (code = 0)
 If a host does not receive all fragments of a datagram
  during within a certain time of receiving the first fragment
    Discard all fragments
    Inform the source using a Time-exceeded message (code = 1)
               Code 0: used only by routers
               Code 1: used only by Hosts
     Parameter-problem message
 A parameter problem message is created by a router or destination host
     If there is an error or ambiguity in the header field (code = 0), pointer
      points to the byte with problem
     An option is missing or incorrect (code = 1) pointer not used
 Router discards the datagram and sends a Parameter-problem message
           Redirection message format
 Updates to routers routing tables are dynamic
 Updates to hosts routing tables are static
            Code 0:   Network specific
            Code 1:   Host specific
            Code 2:   Network specific (specified service)
            Code 3:   Host specific (specified service)
                 Query messages
 Diagnose some network problems.
          Timestamp-request and
      timestamp-reply message format
 Can be used to determine RTT needed for an IP datagram to travel
  between two machines.
                   Timestamp-request and
                  timestamp-reply message
   Can be used to synchronize two
    machines clocks.
   Example:
      Recv = 83573336, Sender =
       83573330;
      With RTT = 2 ms, |diff| = 6 ms;
      Recv = 83573336, Sender =
       83573000;
      With RTT = 2 ms; |diff|=336 ms
    Router solicitation message format
   An important issue is how to accommodate routers in the same network:
   Designers provide Router solicitation message to request immediate
    advertisement.
      Host multicasts/broadcasts a router solicitation message
             Router Advertisement
 Static routing works well for a network that has only one
  router
 For a network with many routers, and if a router crashes,
  then host uses router advertisement message.
    ICMP route discovery
Mask-request and mask-reply message format
 In general to request a subnet mask from a router
 A machine can use Mask-request to get its subnet mask.
Echo-request and echo-reply message format
    Designed for diagnosis purposes
       Host or router can send a echo-request
       Receivers echoes back the message with an echo-reply
    Echo-request/reply used by network admin to test the reachability of a specific
     host