ICMP

ICMP guide: ping, traceroute, and network diagnostics

Understand how ICMP differs from TCP and UDP ports, when to allow echo requests, and how to keep diagnostics useful without inviting abuse.

Default port
ICMP
Protocol
ICMP
Primary use
Network diagnostics

What is ICMP?

ICMP, or Internet Control Message Protocol, carries network control and error messages. It is used by tools such as ping and traceroute, but it is not a TCP or UDP service and does not have a port number in the same way HTTP, SSH, or DNS do.

  • ICMP has types and codes, not ports

    Ping uses ICMP echo request and echo reply messages. Other ICMP messages report unreachable destinations, time exceeded, fragmentation needs, and routing problems.

  • Blocking all ICMP can hurt troubleshooting

    Some ICMP messages are important for path MTU discovery, latency checks, monitoring, and diagnosing routing or firewall issues.

How ICMP works

ICMP rides alongside IP to report network conditions. A host, router, or firewall can send ICMP messages when a destination is unreachable, a packet expires in transit, fragmentation is needed, or a diagnostic echo request needs a reply.

The most familiar ICMP workflow is ping. A client sends an echo request, and the target replies with an echo reply. The round-trip time gives a quick signal about reachability and latency, but it does not prove that an application port such as 443 or 22 is open.

ICMP ports vs TCP and UDP ports

ICMP does not use TCP or UDP port numbers. It uses message types and codes. That is why an ICMP guide should not be treated like a normal open-port article: you are deciding whether to allow specific ICMP messages, not whether a daemon is listening on a numbered port.

A port checker tests TCP or UDP service reachability. Ping tests ICMP reachability. Both are useful, but they answer different questions. A server can block ping while HTTPS works, or respond to ping while every application port is closed.

Ping vs traceroute

Ping checks whether a target responds to ICMP echo and how long the round trip takes. It is useful for quick reachability checks, monitoring probes, and latency baselines.

Traceroute maps the path by sending packets with increasing TTL values and reading ICMP time exceeded messages from routers along the way. Some platforms use UDP or TCP probes for traceroute, but ICMP messages are still central to how many path diagnostics report intermediate hops.

When ICMP should be allowed

Allow ICMP when monitoring systems, load balancers, network teams, or operations staff need reachability and latency signals. For internal networks, allowing controlled ICMP often improves troubleshooting and reduces blind spots.

For public systems, many teams allow limited echo replies from trusted monitoring sources and allow essential error messages such as fragmentation-needed or destination-unreachable behavior. The exact policy should match your network edge, DDoS posture, and observability needs.

Before changing ICMP firewall rules

Before blocking or allowing ICMP, decide which messages you are controlling. Echo request, echo reply, time exceeded, destination unreachable, and packet-too-big behavior have different operational impact.

Avoid a blanket block unless you understand the tradeoff. Blocking all ICMP can break path MTU discovery, hide useful routing errors, make monitoring less accurate, and force teams to debug with weaker signals.

How to manage ICMP on Windows, Linux, and cloud firewalls

On Windows, Windows Defender Firewall has predefined ICMP echo rules that can be enabled for selected profiles and source addresses. Scope rules to trusted networks where possible instead of enabling broad public ping responses by default.

On Linux, nftables, iptables, firewalld, and cloud security groups can allow or limit ICMP by type. Many distributions also expose kernel sysctl settings for echo behavior, but firewall policy is usually the clearer control point.

On cloud platforms, security groups often treat ICMP separately from TCP and UDP. Check both inbound and outbound policies, and remember that load balancers, CDN edges, and provider DDoS controls may handle ICMP differently from instance firewalls.

  • Diagnostics: allow enough ICMP for ping, traceroute, path MTU discovery, and error visibility where needed.
  • Scoping: restrict public echo responses to trusted monitoring sources when broad visibility is not required.
  • Rate limits: use rate limiting or edge protections to reduce flood risk without removing all diagnostics.
  • Validation: test both ICMP reachability and application ports because they answer different questions.

How to test ICMP

Use ping to test echo request and reply. Use traceroute or tracert to inspect the path and identify where packets stop, keeping in mind that some routers intentionally suppress ICMP responses or rate limit them.

If ping fails but an application works, ICMP may be blocked while TCP or UDP is allowed. If ping works but the application fails, the target is reachable at the network layer but the specific service port, firewall rule, listener, or application may be broken.

Test an application port instead

Common ICMP troubleshooting cases

If ping times out, the target may be down, a route may be missing, ICMP echo may be blocked, or an intermediate firewall may be dropping the message. Timeouts do not automatically prove the host is offline.

If traceroute stops at a hop, that hop may be filtering TTL-expired responses or rate limiting diagnostics. If large transfers fail while small requests work, check path MTU discovery and whether packet-too-big messages are blocked.

Security checklist for ICMP

Allow ICMP deliberately rather than reflexively blocking everything. Rate limit echo traffic, scope public responses where appropriate, and preserve important error messages needed for stable networking.

Monitor unusual ICMP volume, spoofed sources, and flood patterns at the edge. For sensitive networks, combine ICMP policy with segmentation and trusted monitoring rather than relying on ping visibility as a security boundary.

Frequently asked questions

What port does ICMP use?

ICMP does not use TCP or UDP ports. It uses message types and codes, such as echo request and echo reply for ping.

Is ping the same as a port check?

No. Ping tests ICMP reachability. A port check tests whether a TCP or UDP service is reachable. A host can answer ping while all application ports are closed, or block ping while applications still work.

Should I block ICMP?

Do not block all ICMP by default without understanding the impact. Controlled ICMP helps monitoring, traceroute, path MTU discovery, and troubleshooting. Scope or rate limit it instead where possible.

Why does ping fail but the website works?

The server or network may block ICMP echo while allowing HTTP or HTTPS. Test the actual application port to confirm service reachability.