ICMP Ping Trace
ICMP Ping Trace
Ping
• Uses ICMP message encapsulated within an IP Packet
– Protocol field = 1
• Both are layer 3 protocols. (ICMP is considered as a network layer
protocol.)
• Does not use TCP or UDP, but may be acted upon by the receiver
using TCP or UDP.
Format
• ping ip address (or ping <cr> for extended ping)
• ping 172.30.1.25
Echo Request
• The sender of the ping, transmits an ICMP message, “Echo Request”
Echo Reply
• The IP address (destination) of the ping, receives the ICMP
message, “Echo Request”
• The ip address (destination) of the ping, returns the ICMP
message, “Echo Reply”
• http://en.wikipedia.org/wiki/Traceroute
• On modern Unix and Linux-based operating systems, the traceroute
utility by default uses UDP datagrams with a destination port number
starting at 33434.
• The traceroute utility usually has an option to specify use of ICMP echo
request (type 8) instead.
• The Windows utility uses ICMP echo request, better known as ping
packets.
• Some firewalls on the path being investigated may block UDP probes
but allow the ICMP echo request traffic to pass through.
• There are also traceroute implementations sending out TCP packets,
such as tcptraceroute or Layer Four Trace.
• In Microsoft Windows, traceroute is named tracert.
• A new utility, pathping, was introduced with Windows NT, combining
ping and traceroute functionality. All these traceroutes rely on ICMP
(type 11) packets coming back.
Rick Graziani [email protected] 9
Trace (Traceroute)
.1 .2 .1 .2 .1 .2
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
1
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
RTB - TTL:
• When a router receives an IP Packet, it decrements the TTL by 1.
• If the TTL is 0, it will not forward the IP Packet, and send back to the
source an ICMP “time exceeded” message.
• ICMP Message: Type = 11, Code = 0
Rick Graziani [email protected] 13
10.0.0.0/8 172.16.0.0/16 192.168.10.0/24
RTA RTB RTC RTD
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
RTB
• After the traceroute is received by the first router, it decrements the
TTL by 1 to 0.
• Noticing the TTL is 0, it sends back a ICMP Time Exceeded
message back to the source, using its IP address for the source IP
address.
• Router B’s IP header includes its own IP address (source IP) and the
sending host’s IP address (dest. IP).
Rick Graziani [email protected] 14
10.0.0.0/8 172.16.0.0/16 192.168.10.0/24
RTA RTB RTC RTD
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
2
RTA
• The traceroute program increments the TTL by 1 (now 2 ) and
resends the ICMP Echo Request packet.
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
RTB
• This time RTB decrements the TTL by 1 and it is NOT 0. (It is 1.)
• So it looks up the destination ip address in its routing table and forwards
it on to the next router.
RTC
• RTC however decrements the TTL by 1 and it is 0.
• RTC notices the TTL is 0 and sends back the ICMP Time Exceeded
message back to the source.
• RTC’s IP header includes its own IP address (source IP) and the sending
host’s IP address (destination IP address of RTA).
• The sending host, RTA, will use the source IP address of this ICMP
Time Exceeded message to display at the second hop.
Rick Graziani [email protected] 17
10.0.0.0/8 172.16.0.0/16 192.168.10.0/24
RTA RTB RTC RTD
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
RTA to RTB
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
2
RTB to RTC
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
. TTL
1
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
DA = 192.168.10.2, TTL = 3
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
3
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
DA = 192.168.10.2, TTL = 3
RTA to RTB
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
3
RTB to RTC
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
2
.
RTC to RTD
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
1
Rick Graziani [email protected] 21
10.0.0.0/8 172.16.0.0/16 192.168.10.0/24
RTA RTB RTC RTD
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
DA = 192.168.10.2, TTL = 3
RTB
• This time RTB decrements the TTL by 1 and it is NOT 0. (It is 2.)
• So it looks up the destination ip address in its routing table and forwards it on to
the next router.
RTC
• This time RTC decrements the TTL by 1 and it is NOT 0. (It is 1.)
• So it looks up the destination ip address in its routing table and forwards it on to
the next router.
RTD
• RTD however decrements the TTL by 1 and it is 0.
• However, RTD notices that the Destination IP Address of 192.168.0.2 is it’s own
interface.
• Since it does not need to forward the packet, the TTL of 0 has no affect.
Rick Graziani [email protected] 22
Data Link Header IP Header ICMP Message - Echo Request (trace) UDP DataLink
(Layer 2) (Layer 3) (Layer 4) Tr.
Data Link Data Link …… Source IP Type Chk ID Seq. Data DestPort FCS
Destination Source Add. 8 sum Num 35,000
Address Address 10.0.0.1
Dest. IP Add. Code
192.168.10.2 0
Protocol field
1
TTL
1
RTD
• RTD sends the packet to the UDP process.
• UDP examines the unrecognizable port number of 35,000 and sends
back an ICMP Port Unreachable message to the sender, RTA, using
Type 3 and Code 3.
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
DA = 192.168.10.2, TTL = 3
.1 .2 .1 .2 .1 .2
DA = 192.168.10.2, TTL = 1
DA = 192.168.10.2, TTL = 2
DA = 192.168.10.2, TTL = 3