ICMP
What is ICMP?
ICMP (Internet Control Message Protocol) is a network protocol operates at the Network Layer. It’s primarily used for error reporting and connection problem diagnosis
For example, ping and traceroute command utilize ICMP
Difference with TCP/UDP
- ICMP operates on Network Layer, while TCP/UDP operates on Transport Layer
- ICMP is used for error reporting and diagnosis, while TCP/UDP used for application data transmission
- ICMP don’t need a specific port, while TCP/UDP need a port
ICMP message type
Echo Request
When we use ping, we send an ICMP echo request to the target server to check if we can connect to it successfully
Echo Reply
When a server receive an ICMP echo request, it will send ICMP echo reply back to the source. This can also be used for calculating the delay
Destination Unreachable
This ICMP packet will be send back to the source when the router is unable to forward the packet to the destination. For example, the routing table doesn’t contain a path to the destination
How it works?
Steps:
- You type the command
ping 8.8.8.8 - The computer create ICMP echo request packet
- The computer send the packet through the network
- Destination receives the ICMP echo request
- Destination sends an ICMP echo reply
- Your computer receives ICMP echo reply
- The computer calculates round-trip time then show the result on the screen