Protocolo de Control de Mensajes en Internet (ICMP)

Figura: Internet Control Message Protocol (ICMP)

ICMP es un protocolo estándar con número de STD 5 que también incluye IP e IGMP. Su status es requerido y se describe en el RFC 792 que se actualiza en el RFC 950. Es parte del STD 5 que incluye también IP.

Path MTU Discovery is a draft standard protocol with a status of elective. It is described in RFC 1191.

ICMP Router Discovery is a proposed standard protocol with a status of elective. It is described in RFC 1256.

When a router or a destination host must inform the source host about errors in datagram processing, it uses the Internet Control Message Protocol (ICMP). ICMP can be characterized as follows:

Mensajes ICMP

ICMP messages are described in RFC 792 y RFC 950, belong to STD 5 y are mandatory.

ICMP messages are sent in IP datagrams. The IP header will always have a Protocol number of 1, indicating ICMP y a type of service of zero (routine). The IP data field will contain the actual ICMP message in the format shown in Figure - ICMP Message Format.

Figura: ICMP Message Format

donde:

Tipo
Especifica el tipo del mensaje:
ValorComentario
0Echo reply
3Destination unreachable
4Source quench
5Redirect
8Echo
9Router advertisement
10Router solicitation
11Time exceeded
12Parameter problem
13Timestamp request
14Timestamp reply
15Information request (obsolete)
16Information reply (obsolete)
17Address mask request
18Address mask reply
Código
Contains the error code for the datagram reported on by this ICMP message. The interpretation is dependent upon the message type.
Checksum
Contains the 16-bit one's complement of the one's complement sum of the ICMP message starting with the ICMP Type field. For computing this checksum, the checksum field is assumed to be zero. This algorithm is the same as that used by IP for the IP header. Compare este con el algoritmo que usa UDP y TCP que también incluye una cabecera pseudo-IP en la suma de comprobación.
Datos
Contains information for this ICMP message. Typically it will contain a part of the original IP message for which this ICMP message was generated. The length of the data can be determined from the length of the IP datagram that contains the message less the IP header length.

Cada uno de los mensajes se explican abajo.

Echo Reply (0)

Ver Echo (8) y Echo Reply (0).

Destino Inalcanzable (3)

Figura: Destino ICMP inalcanzable

Si este mensaje se recibe de un router intermedio, significa que el router considera la dirección IP de destino como inalcanzable.

Si este mensaje se recibe del host de destino, significa que el protocolo especificado en el campo número de protocolo del datagrama original no está activo, o que el protocolo no está activo en este host o si el puerto especificado está inactivo (ver UDP para una breve explicación del concepto de puerto).

El campo del código de cabecera ICMP contendrá uno de los siguientes valores:

ValorComentario
0red inalcanzable
1host inalcanzable
2protocolo inalcanzable
3puerto inalcanzable
4fragmentación necesaria pero el bit No Fragmentar estaba activo
5ruta de origen fallida
6red de destino desconocida
7host de destino desconocido
8host de origen aislado (obsoleto)
9red de destino administrativamente prohibido
10host de destino administrativamente prohibido
11red inalcanzable para este tipo de servicio
12host inalcanzable para este tipo de servicio
13comunicación administrativamente prohibido por filtrado
14violación con anterioridad de host
15corte con anterioridad

Si un router implementa el protocolo Path MTU Discovery, el formato del mensaje inalcanzable de destino se cambia por el código 4 para incluir el MTU del enlace que podría no aceptar el datagrama.

Figura: Fragmentación ICMP reuerida con enlace MTU

Source Quench (4)

Figura: ICMP Source Quench

Si este mensaje se recibe de un router intermedio, significa que el router no tiene espacio de búfer necesario para poner en la cola los datagramas de salida a la siguiente red.

Si este mensaje se recibe del host de destino, significa que los datagramas entrantes están llegando demasiado rápido para ser procesados.

El campo del código de cabecera ICMP es siempre cero.

Redirect (5)

Figura: ICMP Redirect

If this message is received from an intermediate router, it means that the host should send future datagrams for the network to the router whose IP address is given in the ICMP message. This preferred router will always be on the same subnet as the host which sent the datagram y the router which returned the IP datagram. The router will forward the datagram to its next hop destination. If the router IP address matches the source IP address in the original datagram header it indicates a routing loop. This ICMP will not be sent if the IP datagram contains a source route.

El campo del código de cabecera ICMP contendrá uno de los siguientes valores:

0Network redirect
1Host redirect
2Network redirect for this type of service
3Host redirect for this type of service

Echo (8) y Echo Reply (0)

Figura: ICMP Echo y Echo Reply

Echo is used to detect if another host is active on the network. The sender initializes the identifier y sequence number (which is used if multiple echo requests are sent), adds some data to the data field y sends the ICMP echo to the destination host. The ICMP header code field is zero. The recipient changes the type to Echo Reply y returns the datagram to the sender. This mechanism is used by the Ping command to determine if a destination host is reachable (ver Ping).

Router Advertisement (9) y Router Solicitation (10)

Los mensajes ICMP 9 y 10 son opcionales. Se describen en el RFC 1256 que es electivo.

Figura: ICMP Router Advertisement

Figura: ICMP Router Solicitation
número
The number of entries in the message.
longitud de entrada
The length of an entry in 32-bit units. This is 2 (32 bits for the IP address y 32 bits for the preference value).
TTL
The number of seconds that an entry will can be considered valid.
dirección de router
One of the sender's IP addresses.
nivel de preferencia
A signed 32-bit level indicating the preference to be assigned to this address when selecting a default router for a subnet. Each router on a subnet is responsible for advertising its own preference level. Larger values imply higher preference, smaller values imply lower. The default is zero, which is in the middle of the possible range. A value of X'80000000' -2(superscript 31) indicates that the router should never be used as a default router.

El campo del código de cabecera de ICMP es cero para ambos mensajes.

These two messages are used if a host or a router supports the Router Discovery Protocol. The use of multicasting is recommended, but broadcasting may be used if multicasting is not supported on an interface. Routers periodically advertise their IP addresses on those subnets where they are configured to do so. Advertisements are made on the all-systems multicast address (224.0.0.1) or the limited broadcast address (255.255.255.255). The default behavior is to send advertisements every 10 minutes with a TTL value of 1800 (30 minutes). Routers also reply to solicitation messages they receive. They may reply directly to the soliciting host, or they may wait a short random interval y reply with a multicast. Hosts may send solicitation messages when they start until they receive a response. Solicitation messages are sent to the all-routers multicast address (224.0.0.2) or the limited broadcast address (255.255.255.255). Typically, three solicitation messages are sent at 3-second intervals. Alternatively a host may wait for periodic advertisements. Each time a host receives an advertisement, it updates its default router if the new advertisement has one with a higher preference value y sets the TTL timer for the entry to match the value in the advertisement. When the host receives a new advertisement for its current default router, it resets the TTL value to that in the new advertisement. This also provides a mechanism for routers to declare themselves unavailable: they send an advertisement with a TTL value of zero.

Tiempo excedido (11)

Figura: ICMP Time Exceeded

If this message is received from an intermediate router, it means that the time-to-live field of an IP datagram has expired.

If this message is received from the destination host, it means that the IP fragment reassembly time-to-live timer has expired while the host is waiting for a fragment of the datagram. The ICMP header code field may have the one of the following values:

0
transit TTL exceeded
1
reassembly TTL exceeded

El problema del parámetro (12)

Figura: El problema del parámetro ICMP

Indicates that a problem was encountered during processing of the IP header parameters. The pointer field points to the byte in the original IP datagram where the problem was encountered. The ICMP header code field may have the one of the following values:

0
error sin especificar
1
falta opción requerida

Timestamp Request (13) y Timestamp Reply (14)

Figura: ICMP Timestamp Request y Timestamp Reply

The sender initializes the identifier y sequence number (which is used if multiple timestamp requests are sent), sets the originate timestamp y sends it to the recipient. The receiving host fills in the receive y transmit timestamps, changes the type to Timestamp reply y returns it to the recipient. The receiver has two timestamps in case there is a perceptible time difference between the receipt y transmit times, but in practice, most implementations will perform the two (receipt y reply) in one operation y will set the two timestamps to the same value. Timestamps are the number of milliseconds elapsed since midnight UT (GMT).

Information Request (15) y Information Reply (16)

Figura: ICMP Information Request y Information Reply

An Information Request is issued by a host to obtain an IP address for an attached network. The sender fills in the request with the destination IP address in the IP header set to zero (meaning this network) y waits for a reply from a server authorized to assign IP addresses to other hosts. The ICMP header code field is zero. The reply will contain IP network addresses in both the source y destination fields of the IP header. Este mecanismo está obsoleto actualmente. Ver también .

Petición de máscara de dirección (17) y Respuesta de máscara de dirección (18)

Figura: Petición y respuesta de la máscara de dirección ICMP

An Address Mask Request is used by a host to determine the subnet mask in use on an attached network. Most hosts will be configured with their subnet mask(s), but some, such as diskless workstations, must obtain this information from a server. A host uses RARP to obtain its IP address. To obtain a subnet mask, the host broadcasts an Address Mask Request. Any host on the network which has been configured to send Address Mask Replies will fill in the subnet mask, convert the packet to an Address Mask Reply y return it to the sender. The ICMP header code field is zero.

Aplicaciones ICMP

Hay dos aplicaciones basadas en ICMP que se usan ampliamente: Ping y Traceroute. Ping usa los mensajes ICMP Echo y Echo Reply para determinar si un host se puede alcanzar. Traceroute envía datagramas IP con valores bajos de TTL así que se descartan en las rutas hacia el destino. Usa los mensajes ICMP de tiempo excedido resultante para determinar dónde se descartan los datagramas en internet. Estas aplicaciones se explican en Ping y Traceroute.

ICMP para IP Versión 6

La implementación ICMP anterior es específica para la IP Versión 4 (IPv4). IP Versión 6 (IPv6, ver IP Versión 6 (IPv6)) requerirá una nueva versión de ICMP. Las definiciones de las nuevas versiones de ICMP e IP no están completas todavía. Las características importantes conocidas son:

Protocolo IP  |  Tabla de Contenidos  |  Ping