1 Internet Networking Spring 2006 Tutorial 4 ICMP (Internet Control Message Protocol)
Jan 28, 2016
1
Internet Networking Spring 2006
Tutorial 4 ICMP
(Internet Control Message Protocol)
2
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
3
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
4
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
5
ICMP Packet Encapsulation
Frame Header
IP Header
ICMP Header
ICMP Data
Frame Data Area
Datagram Data Area
6
ICMP Header Structure
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
Type Code Checksum
0 7 8 15 16 31
7
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
8
ICMP Message TypesType Field ICMP Message Type
0 Echo Reply
3 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
9
ICMP Message Types (cont.)
Type Field
ICMP Message Type
12 Parameter Problem on a Datagram
13 Timestamp Request
14 Timestamp Reply
15 Information Request (obsolete)
16 Information Reply (obsolete)
17 Address Mask Request
18 Address Mask Reply
10
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
11
Source Quench Message There is no ICMP message to reverse the
effect of a source quench
Type (4) Code (0) Checksum
0 7 8 15 16 31
Unused (Must be zero)
IP header + first 8 bytes of datagram
Source Quench Message Format
12
Clock Synchronization ICMP timestamp request allows a system to
query another for the current time
Type (13 or 14) Code (0) Checksum
0 7 8 15 16 31
32-bit originate timestamp
ICMP Timestamp Request and Reply Message Format
32-bit receive timestamp
32-bit transmit timestamp
Identifier Sequence number
13
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 geminiorig = 83601883, recv = 83598140, xmit =
83598140rtt = 247 ms, difference = -3743 ms
14
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
Type (3) Code (4) Checksum
0 7 8 15 16 31
IP header + first 8 bytes of datagram
Unused (must be 0) MTU of next-hop network
15
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)
16
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
17
Ping (Example)
18
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.
19
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
20
Traceroute (Example)
21
Traceroute (Example)traceroute from ack.berkeley.edu to www.technion.ac.il1 vlan206.inr-203-eva.Berkeley.EDU (128.32.206.1) 0.573 ms 0.595 ms 0.507 ms2 vlan210.inr-202-doecev.Berkeley.EDU (128.32.255.9) 0.816 ms 0.546 ms 0.553 ms3 gigE3-0.inr-000-eva.Berkeley.EDU (128.32.0.201) 0.357 ms 0.253 ms 0.242 ms4 pos3-0.c2-berk-gsr.Berkeley.EDU (128.32.0.90) 0.345 ms 0.345 ms 0.294 ms5 SUNV--BERK.POS.calren2.net (198.32.249.14) 1.565 ms 1.670 ms 1.515 ms6 Abilene--QSV.POS.calren2.net (198.32.249.162) 1.853 ms 1.716 ms 1.725 ms7 losa-snva.abilene.ucaid.edu (198.32.8.18) 9.297 ms 9.087 ms 9.143 ms8 hstn-losa.abilene.ucaid.edu (198.32.8.22) 40.695 ms 40.786 ms 40.651 ms9 atla-hstn.abilene.ucaid.edu (198.32.8.34) 59.921 ms 59.719 ms 59.941 ms10 ipls-atla.abilene.ucaid.edu (198.32.8.41) 69.950 ms 79.609 ms 69.786 ms11 ILAN-Abeline.ilan.net.il (192.114.98.2) 74.505 ms 74.324 ms 74.205 ms12 chi-gp3-fe-i2.ilan.net.il (192.114.101.33) 75.376 ms 74.741 ms 74.375 ms13 tau-gp2-s0.ilan.net.il (192.114.99.66) 265.863 ms 264.125 ms 264.264 ms14 tau-gp1-fe-i2.ilan.net.il (192.114.99.34) 264.943 ms 265.664 ms 265.047 ms15 technion-gp1-mag.ilan.net.il (128.139.203.13) 271.842 ms 269.802 ms 286.051 ms