The Protocol Header Field in IP Packet

IPv4 Protocol field tells the receiver what kind of protocol message is inside the IP datagram’s payload.

So, no—ICMP, IGMP, OSPF, TCP, and UDP are not flags inside the payload. The IPv4 header contains a small numeric field called Protocol, and that number identifies how to interpret the payload.

For example:

IPv4 Datagram
+------------------------+
| IPv4 Header            |
| Protocol = 1           |  ← says "payload is ICMP"
+------------------------+
| ICMP message           |  ← actual payload
+------------------------+

If the Protocol field is 6:

IPv4 Header
Protocol = 6
      ↓
Payload = TCP segment

If it is 17:

Protocol = 17
      ↓
Payload = UDP datagram

And similarly:

IPv4 Protocol valuePayload contains
1ICMP message
2IGMP message
6TCP segment
17UDP datagram
89OSPF packet

So the picture means:

An IP packet can carry different kinds of higher-level or IP-related protocol data inside its payload.

What does ICMP do there?

If:

Protocol = 1

then the IP payload is an ICMP message.

For example:

IP Header
Protocol = 1
+
ICMP Echo Request

That is what ping uses.

Or:

IP Header
Protocol = 1
+
ICMP Destination Unreachable

ICMP is used for control, error reporting, diagnostics, etc.

What about OSPF?

If:

Protocol = 89

the IP payload contains an OSPF packet.

For example:

IP Header
Protocol = 89
+
OSPF Hello packet

Routers use OSPF packets to exchange routing information.

OSPF does not normally sit inside TCP or UDP.

It goes directly inside IP:

IP
└── OSPF

not:

IP
└── UDP
    └── OSPF

ICMP is similar

ICMP also goes directly inside IP:

IP
└── ICMP

TCP and UDP are:

IP
└── TCP
    └── Application data

or:

IP
└── UDP
    └── Application data

That is a very important difference.

So what is the red dot in the diagram?

The red dot represents the idea of multiplexing/demultiplexing.

At the sender, IP may receive data from:

TCP
UDP
ICMP
IGMP
OSPF
...

and encapsulate whichever one is being sent into the IP payload.

Then the IPv4 Protocol field identifies which one it is.

At the receiver:

IPv4 Protocol field
        ↓
   Is it 1?
        ↓
      ICMP

   Is it 6?
        ↓
      TCP

   Is it 17?
        ↓
      UDP

   Is it 89?
        ↓
      OSPF

So it is essentially saying:

“What kind of data is inside my payload?”

One small issue with the diagram

The diagram visually places ICMP, IGMP, and OSPF around the Network layer, which is reasonable. TCP and UDP belong to the Transport layer.

So a cleaner conceptual picture would be:

             TCP       UDP
              \         /
               \       /
                \     /
                 IP
              /  |   \
           ICMP IGMP OSPF

But all five can be carried directly in an IPv4 payload, and the IPv4 Protocol field tells the receiver which one is present.

The key point is:

Protocol field = identifier

Payload = actual TCP, UDP, ICMP, IGMP, or OSPF message

It is not that the payload contains all of them at once. Each individual IP packet normally carries one indicated next protocol.

From AI Tools as is.

Leave a Reply