ICMP Port Number? (No, It’s Not 7)
- Average speed
- km/h
- Result
- Finish time
- 50 min
- You entered
- Distance
- 10 km
- You entered
ICMP (Internet Control Message Protocol) does not use port numbers. It is a companion protocol to IP that operates at the network layer (Layer 3), whereas TCP and UDP use ports at the transport layer (Layer 4). The short answer: ICMP has no port number, and the concept of a port simply does not apply to it.
What Exactly Is ICMP?
ICMP is a protocol defined in RFC 792, designed to carry error messages and operational information about the IP network. It is used by network devices like routers and hosts to report problems, such as an unreachable destination, a packet that lived too long, or a congested path. The most familiar ICMP messages are echo request and echo reply, which are the basis of the ping utility. When you run ping example.com, your computer sends an ICMP echo request to the target, and the target replies with an ICMP echo reply. No port numbers are involved in that exchange.
Why Does the Confusion Happen?
The confusion arises because people often think of network communication as always involving IP addresses and ports. TCP and UDP, the two most common transport protocols, both use 16-bit port numbers to identify applications. ICMP, however, is a different kind of protocol: it is encapsulated directly inside IP packets, with its own header that contains a type and code field, not a port number. For example, ICMP type 8 is echo request, type 0 is echo reply, type 3 is destination unreachable, and type 11 is time exceeded. These type/code pairs serve a role similar to ports, but they are not ports.
How ICMP Is Encapsulated
In an IP packet, the protocol field in the IP header tells the receiving device what is inside. For TCP, that field is 6; for UDP, it is 17; for ICMP, it is 1. The ICMP header itself is 8 bytes long (for most messages) and contains the type, code, and a checksum. Following that are the payload and, for error messages, the IP header and first 8 bytes of the original packet that triggered the error. This structure has no room for a port number, and none is needed because ICMP is not a transport protocol delivering data to applications.
What About Port 7 (Echo) and Others?
Some older texts mention port 7 as the “echo” port, and indeed TCP and UDP port 7 are reserved for an echo service that simply sends back whatever it receives. That is a different thing from ICMP echo. The echo protocol on port 7 is a TCP or UDP service, not ICMP. Similarly, some people think ICMP uses port 0 or port 1, but that is incorrect. ICMP does not use ports at all. When you see firewall rules that mention “ICMP” and a port number, the port number is usually a misinterpretation or a misconfiguration.
How Firewalls and Security Tools Handle ICMP
Firewalls and security devices often treat ICMP differently from TCP and UDP. Instead of filtering by port, they filter by ICMP type and code. For example, a firewall might allow ICMP echo request (type 8) and echo reply (type 0) but block other types like redirect (type 5) or timestamp (type 13). Some network administrators block all ICMP to reduce attack surface, but that can break path MTU discovery (which uses ICMP type 3 code 4) and make troubleshooting harder. If you are configuring a firewall, you usually specify ICMP types, not ports.
Common Misconceptions and Mistakes
One common mistake is trying to use ICMP in a tool that expects a port number, such as a port scanner. A port scanner like nmap can send ICMP packets, but it does not scan ports on the target; it uses ICMP to discover hosts. Another mistake is assuming that a blocked ICMP means a host is down. Many servers block ICMP echo requests, but they still respond to TCP connections on port 80 or 443. So if ping fails, it does not necessarily mean the host is unreachable—it might just be ignoring ICMP.
ICMP vs. TCP/UDP: A Quick Comparison
- Layer: ICMP is at the network layer (Layer 3); TCP and UDP are at the transport layer (Layer 4).
- Ports: ICMP has none; TCP and UDP use 16-bit port numbers.
- Purpose: ICMP reports errors and diagnostics; TCP and UDP carry application data.
- Reliability: ICMP is unreliable (no retransmission); TCP is reliable, UDP is not.
- Common uses: ping, traceroute (partially), path MTU discovery; TCP for web, email, file transfer; UDP for DNS, streaming, gaming.
Frequently Asked Questions
Does ICMP use port 7?
No. Port 7 is reserved for the TCP and UDP echo service, which is unrelated to ICMP. ICMP echo requests and replies do not use any port.
Why does my firewall ask for an ICMP port?
Some firewall UIs have a generic rule type that includes a port field, but for ICMP you should ignore it or use the ICMP type/code fields instead. If your firewall only allows port-based rules, you may need to allow protocol 1 (ICMP) without specifying a port.
Can I ping a specific port?
No, ping uses ICMP, which has no ports. To test a specific TCP port, use tools like telnet, nc, or nmap. For UDP, you can use specialized tools, but UDP is connectionless and harder to test.
Is ICMP a security risk?
ICMP can be abused for attacks like ping floods, Smurf attacks, or ICMP tunneling. However, completely blocking ICMP can cause network issues. Best practice is to allow essential ICMP types (echo, destination unreachable, time exceeded) and block or rate-limit others.
What is the ICMP type for destination unreachable?
Type 3 is destination unreachable. The code field gives more detail: code 0 means network unreachable, code 1 means host unreachable, code 4 means fragmentation needed but DF set, and so on.
Does traceroute use ICMP?
Traceroute can use ICMP echo requests, but many implementations use UDP packets to high-numbered ports or TCP SYN packets. The ICMP time exceeded messages (type 11) are what traceroute relies on to map the path.
Related
Formula used
in t | Finish time | min | 50 | 0 in d | Distance | km | 10 | 0 out pace | Average pace | min/km | t / d | 2 out speed | Average speed | km/h | d / (t / 60) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.