Transcript ICMP

Internet Networking
Spring 2002
Tutorial 4
ICMP
(Internet Control Message Protocol)
1
ICMP - Introduction
• Defined in RFCs 792/1122
• Allow routers to send error or control messages
to other router or hosts
• Considered as a required part of IP layer
– Although implemented above IP layer
• Not making IP service more reliable, but provide
feedback about network problems
• Destination of ICMP packets is ICMP software
module on another machine
2
Typical Network Error
and Control Cases
• Reporting errors:
– Unreachable destination (network, host, port)
– Traffic overrun on router (congestion)
– Detecting Circular or excessively long routes
• Information exchanging:
– Testing destination reachability
– Clock synchronization
– Discovering the local router
3
Errors During Sending
ICMP Message
• ICMP messages are routed as usual packets
– There is no additional reliability or priority
• Thus, error messages themselves may be lost or
discarded
• New ICMP error message is not generated for:
– ICMP error messages
(however, may be generated for ICMP queries)
– Fragment other than the first
– Broadcast or Multicast messages
4
ICMP Packet Encapsulation
ICMP
Header
IP
Header
Frame
Header
ICMP Data
Datagram Data Area
Frame Data Area
5
ICMP Header Structure
0
7 8
Type
15 16
Code
31
Checksum
• TYPE field identifies type of service
– There are 15 different values for the TYPE field
• CODE - further specifies some types of services
• CHECKSUM - for discovering errors.
– Same algorithm as in IP checksum
– Covers the entire ICMP message
6
ICMP Data
• Content of DATA depends on TYPE and CODE
fields
• In case of an error, DATA field contains IP
header and 8 first bytes of a datagram that
caused the problem
– In hope to help for the Receiver to determine what
caused the problem
7
ICMP Message Types
Type Field
ICMP Message Type
0
3
Echo Reply
Destination Unreachable
4
Source Quench
5
Redirect (change a route)
8
Echo Request
9
Router Advertisement
10
Router Solicitation
11
Time Exceeded for a Datagram
8
ICMP Message Types (cont.)
Type Field
ICMP Message Type
12
13
Parameter Problem on a Datagram
Timestamp Request
14
Timestamp Reply
15
Information Request (obsolete)
16
Information Reply (obsolete)
17
Address Mask Request
18
Address Mask Reply
9
Source Quench Message
• Congestion will occur if a router gets datagrams
in faster rate than it can process.
• In such cases router must discards some of the
arriving datagrams
• It sends then ICMP “source quench” message to
report congestion to the original source
• A source quench message is a request for the
source to reduce its current rate of datagram
transmission
10
Source Quench Message
• There is no ICMP message to reverse the effect
of a source quench
Source Quench Message Format
0
7 8
Type (4)
15 16
Code (0)
31
Checksum
Unused (Must be zero)
IP header + first 8 bytes of datagram
11
Clock Synchronization
• ICMP timestamp request allows a system to
query another for the current time
ICMP Timestamp Request and Reply Message Format
0
7 8
Type (13 or 14)
Identifier
15 16
Code (0)
31
Checksum
Sequence number
32-bit originate timestamp
32-bit receive timestamp
32-bit transmit timestamp
12
Clock Synchronization
• The requestor fills in the originate timestamp
and sends the request
– Timestamp values are in milliseconds past midnight
• The replying system fills in receive timestamp
when it receives the request and transmit
timestamp when it sends the reply
Example:
sun % icmptime gemini
orig = 83601883, recv = 83598140, xmit = 83598140
rtt = 247 ms, difference = -3743 ms
13
MTU Discovering
• When a router get a datagram that requires
fragmentation, but the IP header fragment flag is turned
on, than the router drop the packet and sends ICMP
unreachable error - Fragmentation Required to the
sender
• Newer router also returns next hop MTU value that
caused the packet dropping, insides of ICMP message
0
7 8
Type (3)
15 16
Code (4)
Unused (must be 0)
31
Checksum
MTU of next-hop network
IP header + first 8 bytes of datagram
14
MTU Discovering
• Algorithm:
– We send packets with don’t fragment bit set
– The size of the first packet we send will be equal the
MTU of the outgoing interface
– Whenever we receive an ICMP “can’t fragment” error
we will reduce the size of the packet:
• If the router sending ICMP error, returns MTU that
caused the drop than we will use this value
• Otherwise we we will try the next smallest MTU
(RFC defines only a limited number of MTUs)
15
Ping Program
• A program for checking if host is alive
– Exists in most Operation Systems
• Sends ICMP message of type Echo Request
• Receiver answers with ICMP messages of type
Echo Reply
• Enables also to see the Round Trip Time from a
sender to a destination
16
Ping (Example)
17
Traceroute Program
• Lets see the route that IP datagrams follow from
one host to another
– There is no guaranty that two that two consecutive IP
datagrams from the same source to the same
destination follow the same route, but most of the time
they do
• Sends a sequence of datagrams with TTL set to
1,2,etc.
• These datagrams are UDP packets sent to some
unused port.
18
Traceroute Program (cont.)
• When intermediate router receives a packet with
TTL=1 it throws the packet and sends back
ICMP “time exceeded” message
• In such way we can discover all routers in the
was between source and destination
• The process finishes, when a destination host
gets the packet and sends back ICMP “port
unreachable” message
• Many sites now put firewalls that don’t give
traceroute/ping packets get through
19
Traceroute (Example)
20
Traceroute (Example)
traceroute from ack.berkeley.edu to www.technion.ac.il
1 vlan206.inr-203-eva.Berkeley.EDU (128.32.206.1) 0.573 ms 0.595 ms 0.507 ms
2 vlan210.inr-202-doecev.Berkeley.EDU (128.32.255.9) 0.816 ms 0.546 ms 0.553 ms
3 gigE3-0.inr-000-eva.Berkeley.EDU (128.32.0.201) 0.357 ms 0.253 ms 0.242 ms
4 pos3-0.c2-berk-gsr.Berkeley.EDU (128.32.0.90) 0.345 ms 0.345 ms 0.294 ms
5 SUNV--BERK.POS.calren2.net (198.32.249.14) 1.565 ms 1.670 ms 1.515 ms
6 Abilene--QSV.POS.calren2.net (198.32.249.162) 1.853 ms 1.716 ms 1.725 ms
7 losa-snva.abilene.ucaid.edu (198.32.8.18) 9.297 ms 9.087 ms 9.143 ms
8 hstn-losa.abilene.ucaid.edu (198.32.8.22) 40.695 ms 40.786 ms 40.651 ms
9 atla-hstn.abilene.ucaid.edu (198.32.8.34) 59.921 ms 59.719 ms 59.941 ms
10 ipls-atla.abilene.ucaid.edu (198.32.8.41) 69.950 ms 79.609 ms 69.786 ms
11 ILAN-Abeline.ilan.net.il (192.114.98.2) 74.505 ms 74.324 ms 74.205 ms
12 chi-gp3-fe-i2.ilan.net.il (192.114.101.33) 75.376 ms 74.741 ms 74.375 ms
13 tau-gp2-s0.ilan.net.il (192.114.99.66) 265.863 ms 264.125 ms 264.264 ms
14 tau-gp1-fe-i2.ilan.net.il (192.114.99.34) 264.943 ms 265.664 ms 265.047 ms
15 technion-gp1-mag.ilan.net.il (128.139.203.13) 271.842 ms 269.802 ms 286.051 ms
21