1

If a TCP packet is fragmented then would the identification field of the header stay the same for all of the fragmented packets, or would it increment by 1 so that the receiver would know what packet comes next?

Say a packet isn't fragmented and another unfragmented packet is sent directly after, would their identification fields differ by 1 or would the be totally different?

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 14 '17 at 23:25
2

... in a TCP packet ...

I'm assuming that you are speaking about the "identification" field in the IPv4 header and not about some TCP-specific field.

... or would it increment by 1 ...

This question can be understood in three different ways:

1) If you want to know if different fragments of the same fragmented IPv4 packet have different "identification" values:

No. RFC 791 (IPv4) says that different fragments belonging to the same IPv4 packet are identified by having "the same" "identification" value.

2) If you want to know if a router is allowed to change the "identification" value of a not-yet-fragmented packet when fragmenting it the first time:

RFC 791 does not explicitly say that a router is not allowed to change this field. But it says that the layer-4 protocol may evaluate the "identification" value. This implies that the "identification" field must pass routers unchanged.

3) If you want to know if a TCP/IPv4 implementation will increment this field by 1 for each packet:

RFC 791 says that the layer-4 protocol is responsible for selecting "unique" "identification" values and that it is up to layer-4 how these values are calculated (e.g. increment by 1).

RFC 793 (TCP) does not specify how to compute such values. This means ...

Say a packet isn't fragmented and another unfragmented packet is sent directly after, would their identification fields differ by 1 or would the be totally different?

... that every TCP implementation is free to calculate these values.

To save computation time, a TCP implementation on a little-endian computer might increment the value 1 but don't swap the bytes of the value. This would result in the following sequence:

0, 0x100, 0x200 ... 0xFF00, 1, 0x101, 0x201 ... 0xFF01, 2, 0x102 ...

Because a TCP implementation is totally free how to calculate these values, a receiving computer must assume that the "identification" values of two TCP packets are "totally different" (as you call it).

In the case of TCP the TCP header has additional fields - "Sequence Number" and "Acknowledgment Number" - which are used to check where in a TCP connection a certain packet belongs.

Because these two fields can also be used to detect duplicate packets, I doubt that TCP would even evaluate the "identification" value of a packet received.

However, if I understand RFC 791 correctly, some layer-4 protocol may use the "identification" value to check if packets are lost. In this case the specification of that layer-4 protocol may specify that the "identification" field must be incremented by 1 for each packet.

1

If a TCP packet is fragmented then would the identification field of the header stay the same for all of the fragmented packets

Here is a picture of the TCP header: TCP Header fields

As you can see in the picture, TCP only deals with sequence numbers. End devices (such as desktop computers) will use these sequence numbers to determine the order of the data that was sent. They are also used in conjunction with acknowledgements to ensure the entire payload is delivered.

Here is a picture of the IP header: IP Header Fields

Identification fields, though, are specific to the IP header. They are not supposed to repeat between two communicating devices, provide a way for an end device to uniquely identify packets from a sender and prevent the processing of duplicates.

With all that being said,

Say a packet isn't fragmented and another unfragmented packet is sent directly after, would their identification fields differ by 1 or would the be totally different?

The IP identification fields don't follow any universal law (as shown in other answers in this thread) with regards to incrementation. If a pay load must be delivered, the device will determine the best way to increment the ID field.

Sources: For clarity on fragmentation and segmentation, follow this link: How Layer-2 data will be fragmented?

For clarity on the IPv4 identification field, follow this link: Identification field in Ipv4 header https://www.rfc-editor.org/rfc/rfc6864

0

Packets are a layer-3 datagrams, and they are fragmented and reassembled at layer-3. TCP is a layer-4 protocol using segments that are carried in the layer-3 packets. The layer-3 packets are fragmented and reassembled transparently to layer-4.

IPv4 will fragment (if necessary) and reassemble packets, and it will pass the payload of a fully reassembled packet up to layer-4 (TCP, in this case). TCP will never know that a packet was fragmented and reassembled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.