What is ICMP and How Does It Work?

5j4J...GviB
1 Jan 2024
92

                 
Internet Control Message Protocol (ICMP) is a Layer 3 communication protocol used by devices in a network to report data transmission errors. It generates error messages to verify the availability of devices. For example, messages can be too long, or data packets may arrive irregularly, making it impossible for the receiver to assemble them. In such cases, the receiver uses ICMP to inform the sender with an error message and requests the retransmission of the message.
The primary goal of ICMP is to send ping requests to devices in the network or to trace them. To measure availability, round-trip time, and route through devices, ICMP sends Echo ICMP request messages. In other words, ICMP operates Ping and Trace features that identify network device details.
ICMP operates in the RFC792 packet of the IP protocol. Messages respond to IP errors, findings, and routing. Messages have the ability to process these.

  • RFC792: Defines the general principles and message formats of ICMP.

ICMP messages exist in two main versions at the network layer:

  1. ICMPv4 for IPv4
  2. ICMPv6 for IPv6

IPv4 and IPv6 are protocols used for devices to communicate with each other over the Internet.
System messages are sent in datagrams, wrapped with an IP header, and each device has a TTL value for IP packets.

  • TTL: Specifies the maximum number of routers a data packet can pass through on the network.

When the TTL value is 0, it means the data has exceeded its time for the source, and ICMP confirms the connection with this packet.
ICMP plays a significant role in detecting problems in local networks, generating error and control messages, and assisting in problem detection and resolution. Most web applications use ICMP messages, such as HTTP and HTTPS.

  • HTTP and HTTPS: Protocols used for transmitting information over the Internet.

Using Ping and Trace, we can solve device operating system problems.
Ping checks devices on computer networks using Echo Request and Reply messages. Additionally, it uses UDP datagrams to check TTL and unreachable targets.

  • Datagram: An autonomous packet data transmission unit.
  • UDP: A transport protocol used for data transmission in computer networks.

Trace identifies problematic devices along the route by determining routers and host PCs between the source and destination.

  • Router: A device that routes data packets from one network to another.
  • Host PC: In a computer network, it refers to the main computers that serve or run on a network.

It's worth noting that ICMP only reports and does not play a role in fixing errors alone.
So, what are ICMP message types?

  1. Echo Request/Echo Reply

We use request messages to learn the operational status of devices in the network. In this way, local computers send ICMP request requests to the target computer. Later, the receiving computer responds with a reply*(Here, we tested the connectivity to the ufuk.edu.tr network using the ping command. In the output given, we see that 5 packets were delivered, and all 5 were accepted. The values in Rtt correspond to the minimum time to receive a response, average time to receive a response, and maximum time to receive a response.)
You can specify the number of Echo Request by adding the -c command*You can also determine the hop count from the TTL value. The hop count represents the number of routers or switches a packet passes through when going from source to destination. 64-43=21, 21 is the hop count between my computer and the ufuk.edu.tr server. As this number increases, it can lead to more delays and communication complexity.
2.Destination Uncreachable
This message provides information about an unreachable target. It warns about non-use. It sends Uncreachable messages for undelivered packets and informs the sending computer about the problem, generating code structures to explain the situation of not delivering the packets.
Some of the generated codes are:

  1. Destination Unreachable
  2. Network Unreachable
  3. Host Unreachable
  4. Protocol Unreachabl

*Here, I sent a ping to a closed server and received the Host Unreachable error.
3.Time Exceeded
It limits the number of routers passed to reach the destination by using TTL values in IP headers, preventing it from entering an infinite loop. If there were no TTL limitation, routers could affect efficient packet access due to infinite loops in the network. Finally, routers send the Time Exceeded message to the source, indicating an error due to the expired TTL
4.Redirect
ICMP Redirect messages can be used in network management and performance optimization.
"1. Redirecting the Host to the Wrong Path": If a host uses the wrong path instead of the correct one while trying to reach a target on the network, the network router detects it and can redirect the host to the correct path using an ICMP Redirect message.
"2. Redirecting the Host to Use a Better Path": If a router determines a more efficient path for a host than the normal path, it can redirect the host to this path using an ICMP Redirect message.
5.Source Quench
This message is sent when a device on the network determines that it cannot accept more packets when one computer or router sends packets to another. When the recipient receives a Source Quench message, it must reduce the speed of the packets it sends. Source Quench messages are useful for balancing network traffic and adjusting performance. However, Source Quench messages are not widely used in many modern network infrastructures today. Instead, more effective methods, such as flow control mechanisms in TCP and other protocols, are preferred.





Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to Sisyphos

11 Comments