icmp.txt

icmp.txt - v i а SеrgеniuS, 04/30/2011 01:16 pm

Download (20.3 KB)

 
1
ICMP Messages
2
What follows is the ICMP message descriptions as they appear in RFC792. The ICMP 'header' appears immediately after the IP header. The format of the header is dependant on the ICMP Type field.
3
4
5
Destination Unreachable Message
6
7
8
    0                   1                   2                   3
9
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
10
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11
   |     Type      |     Code      |          Checksum             |
12
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
13
   |                             unused                            |
14
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
15
   |      Internet Header + 64 bits of Original Data Datagram      |
16
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17
18
 IP Fields:
19
20
   Destination Address
21
22
      The source network and address from the original datagram's data.
23
24
 ICMP Fields:
25
26
   Type
27
28
      3
29
30
   Code
31
32
      0 = net unreachable;
33
34
      1 = host unreachable;
35
36
      2 = protocol unreachable;
37
38
      3 = port unreachable;
39
40
      4 = fragmentation needed and DF set;
41
42
      5 = source route failed.
43
44
   Checksum
45
46
      The checksum is the 16-bit ones's complement of the one's
47
      complement sum of the ICMP message starting with the ICMP Type.
48
      For computing the checksum , the checksum field should be zero.
49
      This checksum may be replaced in the future.
50
51
   Internet Header + 64 bits of Data Datagram
52
53
      The internet header plus the first 64 bits of the original
54
      datagram's data.  This data is used by the host to match the
55
      message to the appropriate process.  If a higher level protocol
56
      uses port numbers, they are assumed to be in the first 64 data
57
      bits of the original datagram's data.
58
59
 Description
60
61
      If, according to the information in the gateway's routing tables,
62
      the network specified in the internet destination field of a
63
      datagram is unreachable, e.g., the distance to the network is
64
      infinity, the gateway may send a destination unreachable message
65
      to the internet source host of the datagram.  In addition, in some
66
      networks, the gateway may be able to determine if the internet
67
      destination host is unreachable.  Gateways in these networks may
68
      send destination unreachable messages to the source host when the
69
      destination host is unreachable.
70
71
      If, in the destination host, the IP module cannot deliver the
72
      datagram  because the indicated protocol module or process port is
73
      not active, the destination host may send a destination
74
      unreachable message to the source host.
75
76
      Another case is when a datagram must be fragmented to be forwarded
77
      by a gateway yet the Don't Fragment flag is on.  In this case the
78
      gateway must discard the datagram and may return a destination
79
      unreachable message.
80
81
      Codes 0, 1, 4, and 5 may be received from a gateway.  Codes 2 and
82
      3 may be received from a host.
83
84
85
Time Exceeded Message
86
87
88
    0                   1                   2                   3
89
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
90
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
91
   |     Type      |     Code      |          Checksum             |
92
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
93
   |                             unused                            |
94
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
95
   |      Internet Header + 64 bits of Original Data Datagram      |
96
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
97
98
 IP Fields:
99
100
   Destination Address
101
102
      The source network and address from the original datagram's data.
103
104
 ICMP Fields:
105
106
   Type
107
108
      11
109
110
   Code
111
112
      0 = time to live exceeded in transit;
113
114
      1 = fragment reassembly time exceeded.
115
116
   Checksum
117
118
      The checksum is the 16-bit ones's complement of the one's
119
      complement sum of the ICMP message starting with the ICMP Type.
120
      For computing the checksum , the checksum field should be zero.
121
      This checksum may be replaced in the future.
122
123
   Internet Header + 64 bits of Data Datagram
124
125
      The internet header plus the first 64 bits of the original
126
      datagram's data.  This data is used by the host to match the
127
      message to the appropriate process.  If a higher level protocol
128
      uses port numbers, they are assumed to be in the first 64 data
129
      bits of the original datagram's data.
130
131
 Description
132
133
      If the gateway processing a datagram finds the time to live field
134
      is zero it must discard the datagram.  The gateway may also notify
135
      the source host via the time exceeded message.
136
137
      If a host reassembling a fragmented datagram cannot complete the
138
      reassembly due to missing fragments within its time limit it
139
      discards the datagram, and it may send a time exceeded message.
140
141
      If fragment zero is not available then no time exceeded need be
142
      sent at all.
143
144
      Code 0 may be received from a gateway.  Code 1 may be received
145
      from a host.
146
147
148
Parameter Problem Message
149
150
151
    0                   1                   2                   3
152
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
153
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
154
   |     Type      |     Code      |          Checksum             |
155
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
156
   |    Pointer    |                   unused                      |
157
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
158
   |      Internet Header + 64 bits of Original Data Datagram      |
159
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
160
161
 IP Fields:
162
163
   Destination Address
164
165
      The source network and address from the original datagram's data.
166
167
 ICMP Fields:
168
169
   Type
170
171
      12
172
173
   Code
174
175
      0 = pointer indicates the error.
176
177
   Checksum
178
179
      The checksum is the 16-bit ones's complement of the one's
180
      complement sum of the ICMP message starting with the ICMP Type.
181
      For computing the checksum , the checksum field should be zero.
182
      This checksum may be replaced in the future.
183
184
   Pointer
185
186
      If code = 0, identifies the octet where an error was detected.
187
188
   Internet Header + 64 bits of Data Datagram
189
190
      The internet header plus the first 64 bits of the original
191
      datagram's data.  This data is used by the host to match the
192
      message to the appropriate process.  If a higher level protocol
193
      uses port numbers, they are assumed to be in the first 64 data
194
      bits of the original datagram's data.
195
196
197
 Description
198
199
      If the gateway or host processing a datagram finds a problem with
200
      the header parameters such that it cannot complete processing the
201
      datagram it must discard the datagram.  One potential source of
202
      such a problem is with incorrect arguments in an option.  The
203
      gateway or host may also notify the source host via the parameter
204
      problem message.  This message is only sent if the error caused
205
      the datagram to be discarded.
206
207
      The pointer identifies the octet of the original datagram's header
208
      where the error was detected (it may be in the middle of an
209
      option).  For example, 1 indicates something is wrong with the
210
      Type of Service, and (if there are options present) 20 indicates
211
      something is wrong with the type code of the first option.
212
213
      Code 0 may be received from a gateway or a host.
214
215
216
Source Quench Message
217
218
219
    0                   1                   2                   3
220
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
221
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
222
   |     Type      |     Code      |          Checksum             |
223
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
224
   |                             unused                            |
225
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
226
   |      Internet Header + 64 bits of Original Data Datagram      |
227
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
228
229
 IP Fields:
230
231
   Destination Address
232
233
      The source network and address of the original datagram's data.
234
235
 ICMP Fields:
236
237
   Type
238
239
      4
240
241
   Code
242
243
      0
244
245
   Checksum
246
247
      The checksum is the 16-bit ones's complement of the one's
248
      complement sum of the ICMP message starting with the ICMP Type.
249
      For computing the checksum , the checksum field should be zero.
250
      This checksum may be replaced in the future.
251
252
   Internet Header + 64 bits of Data Datagram
253
254
      The internet header plus the first 64 bits of the original
255
      datagram's data.  This data is used by the host to match the
256
      message to the appropriate process.  If a higher level protocol
257
      uses port numbers, they are assumed to be in the first 64 data
258
      bits of the original datagram's data.
259
260
 Description
261
262
      A gateway may discard internet datagrams if it does not have the
263
      buffer space needed to queue the datagrams for output to the next
264
      network on the route to the destination network.  If a gateway
265
      discards a datagram, it may send a source quench message to the
266
      internet source host of the datagram.  A destination host may also
267
      send a source quench message if datagrams arrive too fast to be
268
      processed.  The source quench message is a request to the host to
269
      cut back the rate at which it is sending traffic to the internet
270
      destination.  The gateway may send a source quench message for
271
      every message that it discards.  On receipt of a source quench
272
      message, the source host should cut back the rate at which it is
273
      sending traffic to the specified destination until it no longer
274
      receives source quench messages from the gateway.  The source host
275
      can then gradually increase the rate at which it sends traffic to
276
      the destination until it again receives source quench messages.
277
278
      The gateway or host may send the source quench message when it
279
      approaches its capacity limit rather than waiting until the
280
      capacity is exceeded.  This means that the data datagram which
281
      triggered the source quench message may be delivered.
282
283
      Code 0 may be received from a gateway or a host.
284
285
286
Redirect Message
287
288
289
    0                   1                   2                   3
290
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
291
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
292
   |     Type      |     Code      |          Checksum             |
293
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
294
   |                 Gateway Internet Address                      |
295
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
296
   |      Internet Header + 64 bits of Original Data Datagram      |
297
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
298
299
 IP Fields:
300
301
   Destination Address
302
303
      The source network and address of the original datagram's data.
304
305
 ICMP Fields:
306
307
   Type
308
309
      5
310
311
   Code
312
313
      0 = Redirect datagrams for the Network.
314
315
      1 = Redirect datagrams for the Host.
316
317
      2 = Redirect datagrams for the Type of Service and Network.
318
319
      3 = Redirect datagrams for the Type of Service and Host.
320
321
   Checksum
322
323
      The checksum is the 16-bit ones's complement of the one's
324
      complement sum of the ICMP message starting with the ICMP Type.
325
      For computing the checksum , the checksum field should be zero.
326
      This checksum may be replaced in the future.
327
328
   Gateway Internet Address
329
330
      Address of the gateway to which traffic for the network specified
331
      in the internet destination network field of the original
332
      datagram's data should be sent.
333
334
335
   Internet Header + 64 bits of Data Datagram
336
337
      The internet header plus the first 64 bits of the original
338
      datagram's data.  This data is used by the host to match the
339
      message to the appropriate process.  If a higher level protocol
340
      uses port numbers, they are assumed to be in the first 64 data
341
      bits of the original datagram's data.
342
343
 Description
344
345
      The gateway sends a redirect message to a host in the following
346
      situation.  A gateway, G1, receives an internet datagram from a
347
      host on a network to which the gateway is attached.  The gateway,
348
      G1, checks its routing table and obtains the address of the next
349
      gateway, G2, on the route to the datagram's internet destination
350
      network, X.  If G2 and the host identified by the internet source
351
      address of the datagram are on the same network, a redirect
352
      message is sent to the host.  The redirect message advises the
353
      host to send its traffic for network X directly to gateway G2 as
354
      this is a shorter path to the destination.  The gateway forwards
355
      the original datagram's data to its internet destination.
356
357
      For datagrams with the IP source route options and the gateway
358
      address in the destination address field, a redirect message is
359
      not sent even if there is a better route to the ultimate
360
      destination than the next address in the source route.
361
362
      Codes 0, 1, 2, and 3 may be received from a gateway.
363
364
365
366
Echo or Echo Reply Message
367
368
369
    0                   1                   2                   3
370
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
371
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372
   |     Type      |     Code      |          Checksum             |
373
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374
   |           Identifier          |        Sequence Number        |
375
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
376
   |     Data ...
377
   +-+-+-+-+-
378
379
 IP Fields:
380
381
   Addresses
382
383
      The address of the source in an echo message will be the
384
      destination of the echo reply message.  To form an echo reply
385
      message, the source and destination addresses are simply reversed,
386
      the type code changed to 0, and the checksum recomputed.
387
388
 ICMP Fields:
389
390
   Type
391
392
      8 for echo message;
393
394
      0 for echo reply message.
395
396
   Code
397
398
      0
399
400
   Checksum
401
402
      The checksum is the 16-bit ones's complement of the one's
403
      complement sum of the ICMP message starting with the ICMP Type.
404
      For computing the checksum , the checksum field should be zero.
405
      If the total length is odd, the received data is padded with one
406
      octet of zeros for computing the checksum.  This checksum may be
407
      replaced in the future.
408
409
   Identifier
410
411
      If code = 0, an identifier to aid in matching echos and replies,
412
      may be zero.
413
414
   Sequence Number
415
416
      If code = 0, a sequence number to aid in matching echos and
417
      replies, may be zero.
418
419
 Description
420
421
      The data received in the echo message must be returned in the echo
422
      reply message.
423
424
      The identifier and sequence number may be used by the echo sender
425
      to aid in matching the replies with the echo requests.  For
426
      example, the identifier might be used like a port in TCP or UDP to
427
      identify a session, and the sequence number might be incremented
428
      on each echo request sent.  The echoer returns these same values
429
      in the echo reply.
430
431
      Code 0 may be received from a gateway or a host.
432
433
434
435
Timestamp or Timestamp Reply Message
436
437
438
    0                   1                   2                   3
439
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
440
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
441
   |     Type      |      Code     |          Checksum             |
442
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
443
   |           Identifier          |        Sequence Number        |
444
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
445
   |     Originate Timestamp                                       |
446
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
447
   |     Receive Timestamp                                         |
448
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
449
   |     Transmit Timestamp                                        |
450
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
451
452
 IP Fields:
453
454
   Addresses
455
456
      The address of the source in a timestamp message will be the
457
      destination of the timestamp reply message.  To form a timestamp
458
      reply message, the source and destination addresses are simply
459
      reversed, the type code changed to 14, and the checksum
460
      recomputed.
461
462
 ICMP Fields:
463
464
   Type
465
466
      13 for timestamp message;
467
468
      14 for timestamp reply message.
469
470
   Code
471
472
      0
473
474
   Checksum
475
476
      The checksum is the 16-bit ones's complement of the one's
477
      complement sum of the ICMP message starting with the ICMP Type.
478
      For computing the checksum , the checksum field should be zero.
479
      This checksum may be replaced in the future.
480
481
   Identifier
482
483
      If code = 0, an identifier to aid in matching timestamp and
484
      replies, may be zero.
485
486
   Sequence Number
487
488
      If code = 0, a sequence number to aid in matching timestamp and
489
      replies, may be zero.
490
491
 Description
492
493
      The data received (a timestamp) in the message is returned in the
494
      reply together with an additional timestamp.  The timestamp is 32
495
      bits of milliseconds since midnight UT.  One use of these
496
      timestamps is described by Mills [5].
497
498
      The Originate Timestamp is the time the sender last touched the
499
      message before sending it, the Receive Timestamp is the time the
500
      echoer first touched it on receipt, and the Transmit Timestamp is
501
      the time the echoer last touched the message on sending it.
502
503
      If the time is not available in miliseconds or cannot be provided
504
      with respect to midnight UT then any time can be inserted in a
505
      timestamp provided the high order bit of the timestamp is also set
506
      to indicate this non-standard value.
507
508
      The identifier and sequence number may be used by the echo sender
509
      to aid in matching the replies with the requests.  For example,
510
      the identifier might be used like a port in TCP or UDP to identify
511
      a session, and the sequence number might be incremented on each
512
      request sent.  The destination returns these same values in the
513
      reply.
514
515
      Code 0 may be received from a gateway or a host.
516
517
518
519
Information Request or Information Reply Message
520
521
522
    0                   1                   2                   3
523
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
524
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
525
   |     Type      |      Code     |          Checksum             |
526
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
527
   |           Identifier          |        Sequence Number        |
528
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
529
530
 IP Fields:
531
532
   Addresses
533
534
      The address of the source in a information request message will be
535
      the destination of the information reply message.  To form a
536
      information reply message, the source and destination addresses
537
      are simply reversed, the type code changed to 16, and the checksum
538
      recomputed.
539
540
 ICMP Fields:
541
542
   Type
543
544
      15 for information request message;
545
546
      16 for information reply message.
547
548
   Code
549
550
      0
551
552
   Checksum
553
554
      The checksum is the 16-bit ones's complement of the one's
555
      complement sum of the ICMP message starting with the ICMP Type.
556
      For computing the checksum , the checksum field should be zero.
557
      This checksum may be replaced in the future.
558
559
   Identifier
560
561
      If code = 0, an identifier to aid in matching request and replies,
562
      may be zero.
563
564
   Sequence Number
565
566
      If code = 0, a sequence number to aid in matching request and
567
      replies, may be zero.
568
569
 Description
570
571
      This message may be sent with the source network in the IP header
572
      source and destination address fields zero (which means "this"
573
      network).  The replying IP module should send the reply with the
574
      addresses fully specified.  This message is a way for a host to
575
      find out the number of the network it is on.
576
577
      The identifier and sequence number may be used by the echo sender
578
      to aid in matching the replies with the requests.  For example,
579
      the identifier might be used like a port in TCP or UDP to identify
580
      a session, and the sequence number might be incremented on each
581
      request sent.  The destination returns these same values in the
582
      reply.
583
584
      Code 0 may be received from a gateway or a host.
Thank you!