askvity

What port is ICMP?

Published in Networking Basics 2 mins read

ICMP (Internet Control Message Protocol) does not use ports in the same way that TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) do.

Understanding Why ICMP Doesn't Use Ports

Unlike TCP and UDP, ICMP operates at the network layer (Layer 3) of the OSI model. TCP and UDP use ports at the transport layer (Layer 4) to identify specific applications or processes on a host. ICMP, on the other hand, is used for control and informational messages, such as:

  • Error reporting (e.g., "Destination Unreachable")
  • Network diagnostics (e.g., ping)

ICMP Types and Codes Instead of Ports

Instead of ports, ICMP uses types and codes to categorize different ICMP messages. These types and codes help to specify the nature and purpose of the ICMP packet. According to the reference, ICMP has no concept of ports, as TCP and UDP do, but instead uses types and codes.

Here's a simple analogy:

Feature TCP/UDP ICMP
Identification Ports Types and Codes
Purpose Data Transfer Control/Diagnostic
OSI Layer Transport (4) Network (3)

Example of ICMP Type and Code

For example, an "Echo Request" (used by ping) has a type of 8 and a code of 0. An "Echo Reply" has a type of 0 and a code of 0.

Conclusion

Therefore, ICMP doesn't have a port number because it uses types and codes to classify and handle different control and diagnostic messages within a network.

Related Articles