IPv4 - header protocol field
The header of an IPv4 packet contains what is known as a protocol field.
This is an 8-bit field that is used to indicate which upper layer protocol should handle the packet upon reaching its destination. This field effectively identifies the next level protocol, at the transport layer, that is encapsulated in the data part of the IPv4 packet.
For example, if the Protocol field contains the number 6, this means that the data carried by the packet should be passed to the TCP protocol for processing. If it's number 17, then the packet should be passed to the UDP protocol. Other codes used by this field include:
The protocol field is crucial because it helps routers and receivers to correctly interpret the data they receive over the network. Different protocols may have different expectations for how to handle data, and the Protocol field helps ensure that the data is handled in the way that it's intended.