Bird
Raised Fist0
Computer Networksknowledge~10 mins

ICMP and ping/traceroute in Computer Networks - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - ICMP and ping/traceroute
Start: User runs ping/traceroute
↓
Send ICMP Echo Request
↓
Packet travels through network routers
↓
Destination receives request
↓
Destination sends ICMP Echo Reply
↓
Reply travels back through routers
↓
User receives ICMP Echo Reply
↓
Display response time or route info
↓
End
The user sends an ICMP Echo Request using ping or traceroute, which travels through routers to the destination. The destination replies with an ICMP Echo Reply, which returns to the user, allowing measurement of response time or path.
Execution Sample
Computer Networks
ping 8.8.8.8
traceroute 8.8.8.8
Sends ICMP Echo Requests to 8.8.8.8 and traces the route packets take through the network.
Analysis Table
StepActionPacket TypeSourceDestinationResult
1User sends ping commandICMP Echo RequestUser PC8.8.8.8Packet created and sent
2Packet reaches Router 1ICMP Echo RequestUser PC8.8.8.8Router forwards packet
3Packet reaches Router 2ICMP Echo RequestUser PC8.8.8.8Router forwards packet
4Packet reaches DestinationICMP Echo RequestUser PC8.8.8.8Destination receives request
5Destination sends replyICMP Echo Reply8.8.8.8User PCReply packet created
6Reply reaches Router 2ICMP Echo Reply8.8.8.8User PCRouter forwards reply
7Reply reaches Router 1ICMP Echo Reply8.8.8.8User PCRouter forwards reply
8Reply reaches User PCICMP Echo Reply8.8.8.8User PCUser receives reply
9User displays ping resultN/AN/AN/AShows response time
10Traceroute sends packets with increasing TTLICMP Echo Request with TTL=1User PC8.8.8.8First router replies with Time Exceeded
11Traceroute sends packet with TTL=2ICMP Echo Request with TTL=2User PC8.8.8.8Second router replies with Time Exceeded
12Traceroute continues increasing TTLICMP Echo Request with TTL=nUser PC8.8.8.8Routers reply until destination reached
13Destination replies to tracerouteICMP Echo Reply8.8.8.8User PCTraceroute ends showing full path
💡 Ping ends after receiving reply or timeout; traceroute ends after destination reply or max hops reached.
State Tracker
VariableStartAfter Step 1After Step 4After Step 5After Step 8After Step 13
Packet TypeNoneICMP Echo RequestICMP Echo RequestICMP Echo ReplyICMP Echo ReplyN/A
SourceUser PCUser PCUser PC8.8.8.88.8.8.8N/A
Destination8.8.8.88.8.8.88.8.8.8User PCUser PCN/A
TTL (for traceroute)N/A12nnN/A
Response ReceivedNoNoNoYesYesYes
Key Insights - 3 Insights
Why does ping send an ICMP Echo Request and expect an Echo Reply?
Ping uses ICMP Echo Request to check if the destination is reachable. The Echo Reply confirms the destination received the request and is responding, as shown in steps 1, 4, and 5 of the execution_table.
How does traceroute find the path to the destination?
Traceroute sends packets with increasing TTL values. Each router decreases TTL by 1 and replies with 'Time Exceeded' when TTL hits zero, revealing its address. This is shown in steps 10 to 12.
Why might some routers not reply during traceroute?
Some routers block ICMP messages or do not send 'Time Exceeded' replies, causing missing hops in traceroute results. This is why traceroute may show '*' or timeouts in some steps.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 5. What packet type does the destination send back?
AICMP Echo Reply
BICMP Echo Request
CTime Exceeded
DTCP SYN
💡 Hint
Check the 'Packet Type' column at step 5 in the execution_table.
At which step does the user first receive a reply from the destination?
AStep 4
BStep 8
CStep 5
DStep 10
💡 Hint
Look for when 'User receives reply' in the 'Result' column of execution_table.
If the TTL in traceroute packets is always 1, what will happen according to the execution_table?
ANo replies are received
BThe destination replies immediately
COnly the first router replies with Time Exceeded
DAll routers reply simultaneously
💡 Hint
Refer to step 10 where TTL=1 causes first router to reply.
Concept Snapshot
ICMP is a network protocol used for sending control messages.
Ping sends ICMP Echo Requests to check if a host is reachable.
The host replies with ICMP Echo Replies.
Traceroute uses ICMP with increasing TTL to map the path.
Routers send 'Time Exceeded' messages when TTL expires.
This helps diagnose network paths and delays.
Full Transcript
ICMP is a protocol used to send messages like Echo Requests and Echo Replies between computers on a network. When you use ping, your computer sends an ICMP Echo Request to a destination IP address. The destination replies with an Echo Reply if reachable. This exchange helps measure if the destination is online and how long the message took. Traceroute works by sending ICMP packets with a small TTL value that increases with each attempt. Each router along the path decreases the TTL by one and sends back a 'Time Exceeded' message when TTL reaches zero. This way, traceroute learns the route packets take to reach the destination. The execution table shows each step of sending and receiving these packets, including routers forwarding packets and replying. Understanding these steps helps diagnose network connectivity and delays.

Practice

(1/5)
1. What is the primary purpose of the ICMP protocol in computer networks?
easy
A. To check the status of network connections and report errors
B. To encrypt data for secure communication
C. To assign IP addresses to devices automatically
D. To transfer files between computers

Solution

  1. Step 1: Understand ICMP's role

    ICMP is used by devices to send messages about network status and errors.
  2. Step 2: Compare options with ICMP functions

    Only To check the status of network connections and report errors matches ICMP's role of checking connections and reporting errors.
  3. Final Answer:

    To check the status of network connections and report errors -> Option A
  4. Quick Check:

    ICMP = Network status and error messages [OK]
Hint: ICMP is for network messages, not data transfer or encryption [OK]
Common Mistakes:
  • Confusing ICMP with protocols for encryption or file transfer
  • Thinking ICMP assigns IP addresses
  • Assuming ICMP handles data encryption
2. Which of the following is the correct command syntax to send 4 ICMP echo requests using ping on most systems?
easy
A. ping -n 4 example.com
B. ping -c 4 example.com
C. ping /4 example.com
D. ping -t 4 example.com

Solution

  1. Step 1: Identify common ping options

    On Unix/Linux systems, '-c' specifies the count of echo requests.
  2. Step 2: Match option with correct syntax

    ping -c 4 example.com uses '-c 4' which is the standard way to send 4 requests on most systems.
  3. Final Answer:

    ping -c 4 example.com -> Option B
  4. Quick Check:

    Unix ping count option = -c [OK]
Hint: Use '-c' for count on Unix/Linux ping commands [OK]
Common Mistakes:
  • Using '-n' which is Windows-specific, not Unix/Linux
  • Confusing '-t' which sets TTL, not count
  • Using incorrect slash syntax like '/4'
3. Consider this traceroute output snippet showing hops to a destination:
1  192.168.1.1  1 ms  1 ms  1 ms
2  10.0.0.1  5 ms  5 ms  5 ms
3  * * *
4  203.0.113.5  20 ms  20 ms  20 ms

What does the asterisk (*) on hop 3 indicate?
medium
A. The router at hop 3 did not respond to the ICMP request
B. The destination was reached at hop 3
C. The traceroute command failed completely
D. The packet was lost before reaching hop 3

Solution

  1. Step 1: Understand traceroute asterisks

    Asterisks mean no reply was received from that hop within timeout.
  2. Step 2: Interpret hop 3 asterisks

    Hop 3's router likely blocked or did not respond to ICMP, but traceroute continued.
  3. Final Answer:

    The router at hop 3 did not respond to the ICMP request -> Option A
  4. Quick Check:

    Asterisk = No ICMP reply from hop [OK]
Hint: Asterisk means no reply, not necessarily failure [OK]
Common Mistakes:
  • Assuming asterisk means destination reached
  • Thinking traceroute failed completely
  • Believing packet was lost before hop 3
4. You run the command ping -c 3 8.8.8.8 but get the error: "ping: unknown option -c". What is the most likely cause?
medium
A. The IP address 8.8.8.8 is invalid
B. The ping command requires root privileges
C. You are using Windows where '-c' is not a valid option
D. The network cable is unplugged

Solution

  1. Step 1: Identify OS-specific ping options

    Windows ping uses '-n' for count, not '-c'.
  2. Step 2: Match error with option misuse

    Error shows '-c' is unknown, indicating Windows environment.
  3. Final Answer:

    You are using Windows where '-c' is not a valid option -> Option C
  4. Quick Check:

    Windows ping count option = -n, not -c [OK]
Hint: Use '-n' on Windows, '-c' on Unix/Linux for ping count [OK]
Common Mistakes:
  • Blaming invalid IP address for option error
  • Assuming root privileges are needed for ping
  • Thinking physical connection causes option error
5. You want to find the exact path packets take from your computer to a website but notice some hops show '*' in traceroute output. Which approach best helps you confirm the full path?
hard
A. Use a VPN to hide your IP and avoid hops with '*'
B. Switch to using ping since it shows all hops clearly
C. Disable your firewall to allow all ICMP packets through
D. Use the traceroute command with increased timeout and try multiple attempts

Solution

  1. Step 1: Understand why hops show '*'

    Some routers block ICMP or respond slowly, causing timeouts.
  2. Step 2: Use traceroute options to improve results

    Increasing timeout and repeating traceroute can get replies from slow or filtered hops.
  3. Step 3: Evaluate other options

    Ping does not show path; disabling firewall risks security; VPN changes path, not reveals it.
  4. Final Answer:

    Use the traceroute command with increased timeout and try multiple attempts -> Option D
  5. Quick Check:

    Traceroute with retries = better path info [OK]
Hint: Increase traceroute timeout and retry to reveal filtered hops [OK]
Common Mistakes:
  • Using ping to trace path instead of traceroute
  • Disabling firewall without understanding risks
  • Using VPN to avoid hops instead of revealing them
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard