RFC 792

Internet Control Message Protocol

๐Ÿ“… published September 1981, from ietf

INTERNET CONTROL MESSAGE PROTOCOL ๐Ÿงš

okay bestie, let's get into it ๐Ÿซถ this is RFC 792, written by J. Postel at ISI for the Network Working Group, dated September 1981 ๐ŸŒธ it's a DARPA Internet Program Protocol Specification, and it updates RFCs 777, 760 and IENs 109, 128 ๐ŸŽ€ nothing here obsoletes anything, so it's all about leveling up what's already out there ๐Ÿ’… this is part 1 of 3, so get ready for more ๐Ÿฆ‹


Introduction โœจ

okay so the Internet Protocol (IP) [1] handles host-to-host datagram service across a bunch of interconnected networks, and that whole web of networks is called the Catenet [2] ๐ŸŒ the devices that connect those networks are called Gateways ๐Ÿšช the gateways chat with each other for control stuff using the Gateway to Gateway Protocol (GGP) [3,4] ๐Ÿ’ฌ

every so often a gateway or destination host needs to talk to a source host, like to report an error it ran into while processing a datagram ๐Ÿ™ˆ that's where this protocol comes in: the Internet Control Message Protocol (ICMP) ๐Ÿ’– ICMP uses IP's basic support as if it were a higher level protocol, but it's actually an integral part of IP, so it MUST be implemented by every IP module ๐Ÿ”ฅ no skipping it, bestie!

ICMP messages get sent in a few situations ๐Ÿ“ for example, when a datagram can't reach its destination, when a gateway doesn't have the buffer space to forward a datagram, and when a gateway can tell a host to send its traffic on a shorter route ๐Ÿ›ฃ๏ธ

IP is not designed to be absolutely reliable, and that's a totally intentional choice ๐Ÿ™…โ€โ™€๏ธ the whole point of these control messages is to give feedback about problems in the communication environment, not to make IP reliable ๐Ÿ’… there are still no guarantees that a datagram gets delivered or that a control message comes back, and some datagrams might vanish with no report at all ๐Ÿ˜ญ so if a higher level protocol that uses IP needs reliable communication, it MUST implement its own reliability procedures ๐Ÿซถ

ICMP messages mostly report errors in how datagrams got processed ๐Ÿง to avoid an infinite regress of messages about messages about messages, no ICMP messages are sent about ICMP messages ๐ŸŒ€ also, ICMP messages are only sent about errors in handling fragment zero of fragmented datagrams ๐Ÿงฉ (fragment zero is the one whose Fragment Offset is equal to zero, iykyk ๐Ÿฐ)


Message Formats ๐Ÿ’…

ICMP messages are sent using the basic IP header ๐Ÿ“ฆ the first octet of the data portion of the datagram is the ICMP type field, and its value decides the format of everything after it ๐ŸŽ€ any field labeled "unused" is reserved for later extensions and MUST be zero when sent ๐ŸŒธ but receivers SHOULD NOT use those fields (except to include them in the checksum) ๐Ÿ™ˆ unless the individual format descriptions say otherwise, the internet header fields look like this:

Version

The value is 4 โœจ

IHL

Internet header length, in 32-bit words ๐Ÿ“

Type of Service

The value is 0 ๐Ÿ’–

Total Length

Length of the internet header and data, in octets ๐Ÿ“

Identification, Flags, Fragment Offset

Used in fragmentation, see [1] ๐Ÿงฉ

Time to Live

Time to live, in seconds ๐Ÿ•ฐ๏ธ this field gets decremented at each machine that processes the datagram, so the value SHOULD be at least as great as the number of gateways this datagram will traverse ๐Ÿšฆ bestie, don't set it too low, it'll get eaten up fast ๐Ÿ˜ญ

Protocol

The value is ICMP = 1 ๐Ÿฆ‹

Header Checksum

The 16 bit one's complement of the one's complement sum of all 16 bit words in the header ๐Ÿงฎ for computing the checksum, the checksum field SHOULD be zero ๐Ÿ™ƒ and this checksum MAY be replaced in the future ๐Ÿ”ฎ

Source Address

The address of the gateway or host that composes the ICMP message ๐Ÿ“ฎ unless noted otherwise, this can be any of a gateway's addresses ๐ŸŒˆ

Destination Address

The address of the gateway or host the message SHOULD be sent to ๐Ÿ’Œ


Destination Unreachable Message ๐Ÿ’€

this is the one for when a datagram can't get where it's going ๐Ÿ™ˆ here's the layout:

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             unused                            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields

Destination Address: the source network and address from the original datagram's data ๐Ÿ“ฌ

ICMP Fields

Type: 3 ๐ŸŽ€

Code: the possible codes are

  • 0 = net unreachable ๐ŸŒ
  • 1 = host unreachable ๐Ÿ 
  • 2 = protocol unreachable ๐Ÿง‘โ€๐Ÿ’ป
  • 3 = port unreachable ๐Ÿšช
  • 4 = fragmentation needed and DF set ๐Ÿงฉ
  • 5 = source route failed ๐Ÿ—บ๏ธ

Checksum: the 16-bit ones's complement of the one's complement sum of the ICMP message, starting with the ICMP Type ๐Ÿงฎ for computing it, the checksum field SHOULD be zero ๐Ÿ™ƒ and this checksum MAY be replaced in the future ๐Ÿ”ฎ

Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data ๐Ÿ“ฆ the host uses this data to match the message to the right process ๐ŸŽฏ if a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ’

Description

so okay, if the gateway's routing tables say the network in the internet destination field of a datagram is unreachable (like the distance to the network is infinity ๐Ÿ’€), the gateway MAY send a destination unreachable message to the internet source host of the datagram ๐Ÿ“จ on top of that, some networks let the gateway figure out whether the internet destination host is unreachable, and gateways in those networks MAY send destination unreachable messages to the source host when that happens ๐Ÿ•ต๏ธโ€โ™€๏ธ

if the destination host's IP module can't deliver the datagram because the indicated protocol module or process port isn't active, the destination host MAY send a destination unreachable message to the source host ๐Ÿ™…โ€โ™€๏ธ

another case: a datagram has to be fragmented so a gateway can forward it, but the Don't Fragment flag is on ๐Ÿšซ in that situation the gateway MUST discard the datagram, and it MAY return a destination unreachable message ๐Ÿ—‘๏ธ

codes 0, 1, 4, and 5 MAY be received from a gateway ๐ŸŒ‰ and codes 2 and 3 MAY be received from a host ๐Ÿ–ฅ๏ธ


Time Exceeded Message โฐ

this one's for when time basically runs out โŒ› here's the layout:

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             unused                            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields

Destination Address: the source network and address from the original datagram's data ๐Ÿ“ฌ

ICMP Fields

Type: 11 โณ

Code: the possible codes are

  • 0 = time to live exceeded in transit ๐Ÿšš
  • 1 = fragment reassembly time exceeded ๐Ÿงฉ

Checksum: the 16-bit ones's complement of the one's complement sum of the ICMP message, starting with the ICMP Type ๐Ÿงฎ for computing it, the checksum field SHOULD be zero ๐Ÿ™ƒ and this checksum MAY be replaced in the future ๐Ÿ”ฎ

Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data ๐Ÿ“ฆ the host uses this data to match the message to the right process ๐ŸŽฏ if a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ’

Description

if a gateway processing a datagram finds that the time to live field is zero, it MUST discard the datagram ๐Ÿ—‘๏ธ the gateway MAY also notify the source host with a time exceeded message ๐Ÿ“ฃ

if a host reassembling a fragmented datagram can't finish the reassembly because fragments are missing within its time limit, it discards the datagram, and it MAY send a time exceeded message โŒ›

if fragment zero isn't available, then no time exceeded need be sent at all ๐Ÿ™ˆ

code 0 MAY be received from a gateway ๐ŸŒ‰ and code 1 MAY be received from a host ๐Ÿ–ฅ๏ธ


Parameter Problem Message ๐Ÿ”ง

this one's for when something's wrong in the header parameters ๐Ÿ› ๏ธ here's the layout:

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |    Pointer    |                   unused                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields

Destination Address: the source network and address from the original datagram's data ๐Ÿ“ฌ

ICMP Fields

Type: 12 ๐ŸŽ€

Code: the only code is 0 = pointer indicates the error ๐Ÿ“

Checksum: the 16-bit ones's complement of the one's complement sum of the ICMP message, starting with the ICMP Type ๐Ÿงฎ for computing it, the checksum field SHOULD be zero ๐Ÿ™ƒ and this checksum MAY be replaced in the future ๐Ÿ”ฎ

Pointer: if code = 0, this identifies the octet where an error was detected ๐Ÿ‘‰

Internet Header + 64 bits of Data Datagram: the internet header plus the first 64 bits of the original datagram's data ๐Ÿ“ฆ the host uses this data to match the message to the right process ๐ŸŽฏ if a higher level protocol uses port numbers, they're assumed to be in the first 64 data bits of the original datagram's data ๐Ÿ’

Description

if the gateway or host processing a datagram finds a problem with the header parameters so that it can't finish processing the datagram, it MUST discard the datagram ๐Ÿ—‘๏ธ one potential source of that problem is incorrect arguments in an option ๐Ÿ™ˆ the gateway or host MAY also notify the source host with a parameter problem message โœจ this message is only sent if the error caused the datagram to be discarded ๐Ÿ’…

the pointer identifies the octet of the original datagram's header where the error was detected, and it can even be in the middle of an option ๐ŸŽฏ for example, 1 means something's wrong with the Type of Service, and (if there are options present) 20 means something's wrong with the type code of the first option ๐Ÿง 

code 0 MAY be received from a gateway or a host ๐ŸŒˆ ilysm, that's the whole section ๐Ÿ’–

Source Quench Message โœจ

okay bestie, let's get into the source quench message ๐Ÿฆ‹

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             unused                            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields ๐Ÿ’…

Destination Address

this is the source network and address of the original datagram's data, so it's basically the sender getting the message ๐Ÿซถ

ICMP Fields ๐ŸŽ€

Type

it's 4 ๐ŸŒธ

Code

it's 0 ๐Ÿ’–

Checksum

the checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. when you compute it, the checksum field should be zero. and this checksum may be replaced in the future ๐Ÿ‘€

Internet Header + 64 bits of Data Datagram

this is the internet header plus the first 64 bits of the original datagram's data. the host uses it to match the message to the right process ๐Ÿงš if a higher level protocol uses port numbers, they're assumed to be in those first 64 data bits of the original datagram's data. iykyk ๐Ÿ˜ญ

Description ๐ŸŒˆ

so a gateway may discard internet datagrams if it doesn't have the buffer space it needs to queue them for output to the next network on the route to the destination network. and if it does discard one, it may send a source quench message to the internet source host of that datagram ๐Ÿšซ

a destination host can send one too, if datagrams are arriving too fast for it to process. the source quench message is basically a polite request for the host to cut back the rate at which it's sending traffic to the internet destination. the gateway may send one for every message it discards, no cap ๐Ÿ™ˆ

when a source host gets a source quench message, it should cut back the rate it's sending traffic to that destination until it stops getting source quench messages from the gateway. then it can slowly ramp the rate back up until the source quench messages show up again. it's giving patience ๐Ÿฆ‹

the gateway or host may also send the source quench message when it's approaching its capacity limit, instead of waiting until it's already exceeded. this means the data datagram that triggered the source quench message may still get delivered โœจ

code 0 may be received from a gateway or a host ๐Ÿ“


Redirect Message ๐Ÿฆ‹

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                 Gateway Internet Address                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Internet Header + 64 bits of Original Data Datagram      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields ๐Ÿ’…

Destination Address

this is the source network and address of the original datagram's data ๐Ÿซถ

ICMP Fields ๐ŸŽ€

Type

it's 5 ๐ŸŒธ

Code

  • 0 = Redirect datagrams for the Network.
  • 1 = Redirect datagrams for the Host.
  • 2 = Redirect datagrams for the Type of Service and Network.
  • 3 = Redirect datagrams for the Type of Service and Host.

Checksum

same deal as before: the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. the checksum field should be zero while you compute it, and this checksum may be replaced in the future ๐Ÿ‘€

Gateway Internet Address

this is the address of the gateway that traffic for the network in the internet destination network field of the original datagram's data should be sent to ๐Ÿ—บ๏ธ

Internet Header + 64 bits of Data Datagram

the internet header plus the first 64 bits of the original datagram's data. the host uses this to match the message to the appropriate process ๐Ÿงš and if a higher level protocol uses port numbers, they're assumed to be in those first 64 data bits. same energy as before, periodt ๐Ÿ’…

Description ๐ŸŒˆ

okay so here's the situation. a gateway, G1, gets an internet datagram from a host on a network the gateway is attached to. G1 checks its routing table and grabs the address of the next gateway, G2, on the route to the datagram's internet destination network, X ๐Ÿงญ

if G2 and the host that sent the datagram (the one in the internet source address) are on the same network, the gateway sends a redirect message to the host. the redirect message basically says "hey, send your traffic for network X directly to G2, it's a shorter path to the destination" ๐Ÿƒโ€โ™€๏ธ๐Ÿ’จ and the gateway still forwards the original datagram's data to its internet destination, so nobody's left on read ๐Ÿ“ฌ

for datagrams with the IP source route options and the gateway address in the destination address field, a redirect message is not sent, even if there's a better route to the ultimate destination than the next address in the source route. no exceptions, bestie ๐Ÿ™…โ€โ™€๏ธ

codes 0, 1, 2, and 3 may be received from a gateway ๐Ÿฆ‹


Echo or Echo Reply Message ๐Ÿ“

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |     Code      |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Identifier          |        Sequence Number        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Data ...
   +-+-+-+-+-

IP Fields ๐Ÿ’…

Addresses

the address of the source in an echo message becomes the destination of the echo reply message ๐Ÿชž to make an echo reply, you just reverse the source and destination addresses, change the type code to 0, and recompute the checksum. it's literally a mirror ๐Ÿชžโœจ

ICMP Fields ๐ŸŽ€

Type

  • 8 for echo message;
  • 0 for echo reply message.

Code

it's 0 ๐ŸŒธ

Checksum

the checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. the checksum field should be zero while you compute it. if the total length is odd, the received data gets padded with one octet of zeros for the checksum calculation. and yes, this checksum may be replaced in the future ๐Ÿซ 

Identifier

if code = 0, an identifier to help match echos and replies may be zero ๐Ÿชช

Sequence Number

if code = 0, a sequence number to help match echos and replies may be zero ๐Ÿ”ข

Description ๐ŸŒˆ

the data received in the echo message must be returned in the echo reply message. no skipping, that's the whole point ๐Ÿ’–

the identifier and sequence number can be used by the echo sender to match the replies with the echo requests. for example, the identifier might work like a port in TCP or UDP to identify a session, and the sequence number might go up on each echo request sent. the echoer returns these same values in the echo reply, so everything lines up ๐Ÿงš

code 0 may be received from a gateway or a host ๐Ÿ“


Timestamp or Timestamp Reply Message โฐ

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |      Code     |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Identifier          |        Sequence Number        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Originate Timestamp                                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Receive Timestamp                                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Transmit Timestamp                                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields ๐Ÿ’…

Addresses

the address of the source in a timestamp message becomes the destination of the timestamp reply message ๐Ÿชž to form a timestamp reply, you reverse the source and destination addresses, change the type code to 14, and recompute the checksum. same mirror moment as the echo, just with a clock ๐Ÿ•ฐ๏ธ

ICMP Fields ๐ŸŽ€

Type

  • 13 for timestamp message;
  • 14 for timestamp reply message.

Code

it's 0 ๐ŸŒธ

Checksum

the checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. the checksum field should be zero while you compute it, and this checksum may be replaced in the future ๐Ÿ‘€

Identifier

if code = 0, an identifier to help match timestamps and replies may be zero ๐Ÿชช

Sequence Number

if code = 0, a sequence number to help match timestamp and replies may be zero ๐Ÿ”ข

Description ๐ŸŒˆ

the data received in the message (a timestamp) gets returned in the reply, together with an additional timestamp. that timestamp is 32 bits of milliseconds since midnight UT. one use of these timestamps is described by Mills [5] ๐Ÿ“š (the bestie reading list starts there ๐Ÿค“)

there are three timestamps, and they're all about when someone last touched the message โฑ๏ธ

  • the Originate Timestamp is the time the sender last touched the message before sending it.
  • the Receive Timestamp is the time the echoer first touched it on receipt.
  • the Transmit Timestamp is the time the echoer last touched the message on sending it.
if the time isn't available in milliseconds, or can't be given with respect to midnight UT, then any time can be inserted in a timestamp, as long as the high order bit of the timestamp is also set. that's how you flag it as a non-standard value ๐Ÿšฉ

the identifier and sequence number can be used by the echo sender to match the replies with the requests. for example, the identifier might work like a port in TCP or UDP to identify a session, and the sequence number might go up on each request sent. the destination returns these same values in the reply ๐Ÿงš

code 0 may be received from a gateway or a host ๐Ÿ“ ๐Ÿ’…

Information Request or Information Reply Message ๐ŸŽ€

okay bestie, this one is all about asking "wait, what network am I even on??" ๐ŸŒธ Here's the layout:

    0                   1                   2                   3
    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Type      |      Code     |          Checksum             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Identifier          |        Sequence Number        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

IP Fields โœจ

Addresses

The address of the source in a information request message will be the destination of the information reply message. ๐Ÿ’– So the request's source becomes the reply's destination. To make the reply, you just flip the source and destination addresses, change the type code to 16, and recompute the checksum. Iconic glow-up ๐Ÿ’…

IP Fields (part two) ๐Ÿฆ‹

Type

  • 15 for information request message ๐Ÿ”ฅ
  • 16 for information reply message โœจ

Code

  • 0 ๐ŸŒˆ

Checksum

The checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. Lowkey math, but the vibe is "add it all up, flip the bits." ๐Ÿงฎ For computing the checksum , the checksum field should be zero. So zero it out first, then do the math ๐Ÿ™ˆ This checksum may be replaced in the future. So it's not set in stone, bestie ๐ŸŒ™

Identifier

If code = 0, an identifier to aid in matching request and replies, may be zero. ๐Ÿงš In other words, it's there to help match up requests and replies, and zero is totally fine. ๐Ÿ’œ

Sequence Number

If code = 0, a sequence number to aid in matching request and replies, may be zero. ๐Ÿ“ Same deal as the identifier: helps pair things up, and zero is allowed. โœจ

Description

This message may be sent with the source network in the IP header source and destination address fields zero (which means "this" network). ๐Ÿซถ

Translation: the sender can leave the network part of the source and destination addresses at zero, meaning "this network," aka "idk which network I'm on, help." ๐Ÿ˜ญ The replying IP module should send the reply with the addresses fully specified. So the reply comes back with real, complete addresses. ๐ŸŽ€ This message is a way for a host to find out the number of the network it is on. Literally the whole point: a host uses it to figure out its own network number. ๐Ÿ‘‘

The identifier and sequence number may be used by the echo sender to aid in matching the replies with the requests. Same energy as the echo message, babe. ๐Ÿ’… For example, the identifier might be used like a port in TCP or UDP to identify a session, and the sequence number might be incremented on each request sent. Like a session ID plus a little counter that goes up every time you send one ๐Ÿฆ‹ The destination returns these same values in the reply. So the reply sends the same numbers right back ๐Ÿ’–

Code 0 may be received from a gateway or a host. So code 0 can show up from either a gateway or a host, no bias ๐ŸŒธ


Summary of Message Types ๐ŸŒˆ

Here's your cheat sheet, bestie ๐Ÿ“

    0  Echo Reply

    3  Destination Unreachable

    4  Source Quench

    5  Redirect

    8  Echo

   11  Time Exceeded

   12  Parameter Problem

   13  Timestamp

   14  Timestamp Reply

   15  Information Request

   16  Information Reply

References ๐Ÿ“š

  • [1] Postel, J. (ed.), "Internet Protocol - DARPA Internet Program Protocol Specification," RFC 791, USC/Information Sciences Institute, September 1981. ๐Ÿ’œ
  • [2] Cerf, V., "The Catenet Model for Internetworking," IEN 48, Information Processing Techniques Office, Defense Advanced Research Projects Agency, July 1978. ๐ŸŒŸ
  • [3] Strazisar, V., "Gateway Routing: An Implementation Specification", IEN 30, Bolt Beranek and Newman, April 1979. ๐Ÿซถ
  • [4] Strazisar, V., "How to Build a Gateway", IEN 109, Bolt Beranek and Newman, August 1979. ๐ŸŽ€
  • [5] Mills, D., "DCNET Internet Clock Service," RFC 778, COMSAT Laboratories, April 1981. ๐Ÿฆ‹

And that's a wrap on RFC 792, periodt! ๐ŸŒˆ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from