Fundamentals 8 min read

Understanding ICMP: How Ping and Traceroute Diagnose Network Issues

The article explains the role of the Internet Control Message Protocol (ICMP) in detecting and reporting network errors, details its message structure and common types, and demonstrates practical uses of ICMP through ping and traceroute commands for diagnosing connectivity and routing problems.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Understanding ICMP: How Ping and Traceroute Diagnose Network Issues

What Is ICMP?

ICMP (Internet Control Message Protocol) is a network‑layer protocol that provides error detection and reporting for IP traffic. Because IP itself is unreliable and connection‑less, ICMP is used to confirm whether an IP packet reaches its destination and to inform the sender why a packet was discarded.

ICMP Message Encapsulation

ICMP messages are encapsulated inside regular IP packets. The encapsulation format consists of an IP header followed by an ICMP header (type, code, checksum, etc.) and the ICMP payload.

ICMP encapsulation diagram
ICMP encapsulation diagram

Common ICMP Message Types

Echo Request (type 8) : Sent by a source to test reachability of a destination.

Echo Reply (type 0) : The destination’s response to an Echo Request; used by the ping utility.

Destination Unreachable (type 3) : Indicates that a router cannot forward the packet; the code field specifies the exact reason (e.g., network unreachable, host unreachable).

Parameter Problem (type 12) : Sent when a router detects an error in the IP header.

Redirect (type 5) : Informs the source of a better route for the destination.

Time Exceeded (type 11) : Generated when a packet’s TTL reaches zero, preventing endless loops.

Timestamp Request/Reply (type 13/14) : Used to measure round‑trip time by exchanging timestamps.

ICMP message types chart
ICMP message types chart

ICMP in Action: ping

Ping uses ICMP Echo Request and Echo Reply messages to test whether a host is reachable. The source sends an Echo Request to the target’s IP address; the target replies with an Echo Reply. If no reply is received within a timeout, the host is considered unreachable.

Ping command output
Ping command output

ICMP in Action: traceroute

Traceroute (tracert on Windows) discovers the path packets take to a destination by sending successive ICMP packets with increasing TTL values. Each router that decrements TTL to zero discards the packet and returns a Time Exceeded message, revealing its address. The process repeats until the destination replies.

Traceroute process diagram
Traceroute process diagram

Practical Network Tests

Typical Windows screenshots show how to run ping and tracert, view the returned messages, and capture packet traces for verification.

Ping command in Windows
Ping command in Windows
Traceroute command in Windows
Traceroute command in Windows

Both tools rely on ICMP messages; successful two‑way communication indicates a healthy network, while firewalls or routing issues may block the messages and cause failures.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

pingtracerouteTCP/IPICMPNetwork Diagnostics
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.