ICMP และบทบาทของ Ping กับ Traceroute
ทำความเข้าใจโพรโทคอลควบคุม ICMP ที่ทำงานควบคู่กับ IP และวิธีที่ ping กับ traceroute ใช้โพรโทคอลนี้เพื่อวินิจฉัยการเข้าถึงและการกำหนดเส้นทาง
ICMP และบทบาทของ Ping กับ Traceroute เป็นบทเรียน Linux Networking & TCP/IP for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Linux Networking & TCP/IP for Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Linux Networking & TCP/IP for Developers มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
What Is ICMP?
The Internet Control Message Protocol (ICMP) carries control and error messages for the IP layer. It is not used to send application data; it reports problems like unreachable hosts and assists diagnostics.
ICMP Sits Beside IP
ICMP messages are wrapped in IP packets but ICMP is considered part of the network layer. Unlike TCP or UDP, it has no ports, only message types and codes.
Common Message Types
Key ICMP types include:
- Echo Request / Echo Reply (used by ping).
- Destination Unreachable.
- Time Exceeded (used by traceroute).
How Ping Works
ping sends an ICMP Echo Request and waits for an Echo Reply. The round-trip time tells you latency, and missing replies suggest packet loss or an unreachable host.
ping -c 4 example.comReading Ping Output
Ping reports time per packet and a summary with packet loss and min/avg/max round-trip times. Consistent times mean a healthy path; jitter or loss points to network trouble.
The TTL Field
Every IP packet carries a Time To Live (TTL) that decrements at each router. When it hits zero the router drops the packet and sends back an ICMP Time Exceeded message. Traceroute exploits exactly this.
How Traceroute Works
traceroute sends packets with increasing TTL: 1, then 2, then 3. Each router along the path returns a Time Exceeded message, revealing the hops between you and the destination.
traceroute example.comReading Traceroute Hops
Each line is one hop with three timing samples. Asterisks mean no reply from that hop, which can be normal if a router is configured not to answer.
When ICMP Is Blocked
Many firewalls drop ICMP for security. A failed ping does not always mean the host is down; it may simply not answer Echo Requests. Verify with a TCP-based check too.
traceroute -T -p 443 example.comContinuous Monitoring
For ongoing path monitoring, mtr combines ping and traceroute, continuously updating per-hop loss and latency, which is excellent for spotting an intermittent bad hop.
mtr example.comSetting Packet Size
You can vary the ping payload size to test how a path handles larger packets, which helps uncover MTU or fragmentation issues.
ping -c 4 -s 1400 example.comQuick Check
Test your ICMP knowledge.
Recap
You learned the role of ICMP.
- ICMP carries control/error messages for IP, with no ports.
- Ping uses Echo Request/Reply for reachability and latency.
- Traceroute uses TTL and Time Exceeded to map the path; blocked ICMP can hide a live host.
คำถามที่พบบ่อย
บทเรียน “ICMP และบทบาทของ Ping กับ Traceroute” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “ICMP และบทบาทของ Ping กับ Traceroute” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Linux Networking & TCP/IP for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Linux Networking & TCP/IP for Developers มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “ICMP และบทบาทของ Ping กับ Traceroute”
ทำความเข้าใจโพรโทคอลควบคุม ICMP ที่ทำงานควบคู่กับ IP และวิธีที่ ping กับ traceroute ใช้โพรโทคอลนี้เพื่อวินิจฉัยการเข้าถึงและการกำหนดเส้นทาง คุณปฏิบัติ Linux Networking & TCP/IP for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Linux Networking & TCP/IP for Developers หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Linux Networking & TCP/IP for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “ICMP และบทบาทของ Ping กับ Traceroute” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Linux Networking & TCP/IP for Developers นี้ได้ไหม
ได้ บทเรียน Linux Networking & TCP/IP for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ทำความเข้าใจแบบจำลอง TCP/IP
- การกำหนดที่อยู่ IP และการแบ่งเครือข่ายย่อย
- พื้นฐาน TCP และ UDP
- ICMP และบทบาทของ Ping กับ Traceroute