02-14-2022 01:16 AM
(Sorry if this is the wrong place to put this)
Hello,
I'm studying for the CCNA, but got confused when reading about the IPv4 header. I just found a random picture of a IPv4 header, but as you can see at the bottom of the picture, it says "IPv4 Frame Format" so now i have to ask: What is a IPv4 header and what is a IPv4 frame? What is the difference and what do we have on this picture?
As i understand it, we have an IPv4 header on the picture, and for it to be a frame (which i wouldn't call it, it would be a packet, since it's IP and therefore must be a L3PDU, right?) it should also contain a payload in the form of L7/6/5 data encapsulated in a L4 segment.
Anyway, i'll reference the picture as a IPv4 header, because that's what i think it is, so now you know what i mean.Service Providers
Right, so now for the actual reason for this: The IPv4 contains all the fields in the picture. When reading about the different fields, i found that the 'Total length' field can be as large as 65,535 bytes (which should be around 65Kb, right?), but i also found that the IPv4 maximum header length (which must be all the fields) is 60 bytes?
I tried searching for this, but could not find an explanation, which tells me i misunderstood something or i am overthinking something and i often do both. I hope someone will help me understand. Thank you in advance
Solved! Go to Solution.
02-15-2022 07:30 AM - edited 02-15-2022 07:31 AM
Hi @trane.m ,
The "total length" refers to the total length of the datagram and is 16 bits, which means it can handle up to 65536 bytes.
The Internet Header Length (IHL) field is just 4 bits and is the number of words (32 bits) that constitute the IP header, which mean that it could handle up 60 bytes header (15x4).
Please refer to RFC791 for more information.
https://datatracker.ietf.org/doc/html/rfc791
Regards,
02-15-2022 11:16 AM
Hi @trane.m ,
> Field A is 4 bytes, field B is 2 bytes, field C is 20 bytes, field D is 12 bytes
> Field A-D is a "IPv4 header" which has a minimum size of 38 bytes.
The IP header will be at least 40 bytes (value of 5 in the IHL field), if there is no optional fields are included. It could be more if optional fields are present.
> The 'total length' field (which is not represented as a field in this imaginative IPv4 header) would then show the value of
> 238 in binary, meaning 238 bytes "long" in length.
The total length would be 240, as the value of the total length field would also be taken in consideration.
Regards,
02-14-2022 08:30 AM - last edited on 02-18-2022 09:06 AM by Translator
Maximum IPv4 header length = 60 bytes.
Total length (in bytes) = IPv4 header + the data.
Jon
02-15-2022 06:09 AM
Hello Jon,
I don't think you fully understand what i'm trying to write.
I'm not confused as to what the 'total length' field contains, when calculating the value to be in the field.
I don't understand why it is possible for a field (total length) to be larger (65.535 bytes) than the maximum size of the whole collection of fields(IPv4 header), being 60 bytes?
To simplify it: I don't understand how it is possible to fit 65535 bytes into 60 bytes.
Can you help me understand that?
02-15-2022 07:30 AM - edited 02-15-2022 07:31 AM
Hi @trane.m ,
The "total length" refers to the total length of the datagram and is 16 bits, which means it can handle up to 65536 bytes.
The Internet Header Length (IHL) field is just 4 bits and is the number of words (32 bits) that constitute the IP header, which mean that it could handle up 60 bytes header (15x4).
Please refer to RFC791 for more information.
https://datatracker.ietf.org/doc/html/rfc791
Regards,
02-15-2022 09:27 AM
Hello Harold,
You are my savior! I think it fell into place now.
Of course the 'total length' field refers to the total length of the whole datagram, i just didn't think of that. It also refers to a length instead of a size, as in the value in the field does not represent the size of the information in the same field, which of course wouldn't make sense, but for some reason i though of it that way and that was what i had trouble with understanding.
I also did not consider the fact that it can handle UP TO 65535 bytes, but a datagram doesn't necessarily need to be that large, which is also stated in RFC791:
Such long datagrams are impractical for most hosts and networks. All hosts must be prepared to accept datagrams of up to 576 octets (whether they arrive whole or in fragments). It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.
For a small, totally imaginative (i can't recall it all), visual representation:
Field A is 4 bytes, field B is 2 bytes, field C is 20 bytes, field D is 12 bytes
Field A-D is a "IPv4 header" which has a minimum size of 38 bytes. Then comes 200 bytes of data, so the whole datagram is 238 bytes "big" in size. The 'total length' field (which is not represented as a field in this imaginative IPv4 header) would then show the value of 238 in binary, meaning 238 bytes "long" in length.
I really really really hope you understand and can confirm this.
02-15-2022 11:16 AM
Hi @trane.m ,
> Field A is 4 bytes, field B is 2 bytes, field C is 20 bytes, field D is 12 bytes
> Field A-D is a "IPv4 header" which has a minimum size of 38 bytes.
The IP header will be at least 40 bytes (value of 5 in the IHL field), if there is no optional fields are included. It could be more if optional fields are present.
> The 'total length' field (which is not represented as a field in this imaginative IPv4 header) would then show the value of
> 238 in binary, meaning 238 bytes "long" in length.
The total length would be 240, as the value of the total length field would also be taken in consideration.
Regards,
02-14-2022 09:03 AM
I suspect they, in your OP diagram, are referring the all the IPv4 header fields, as a frame, but once you append the data portion, which is also "counted" in IPv4's total length field, the combination then is an IPv4 packet.
BTW 65,535 bytes (decimal) is generally represented as 64KB (because of binary, i.e. 2 ** 16, i.e. 65,536 also counting the number zero), not 65KB. Also often a capital "B" is used for bytes while a lowercase "b" is used for bits.
02-15-2022 06:11 AM
Hello Joseph,
Thank you for your answer. I get the feeling that some words are used freely as people please, that confuses me.
Can you help with the rest of my inquiry? maybe take a look at my reply to Jon's comment?
02-15-2022 08:37 AM
Sure, although I believe @Harold Ritter has answered your questions to Jon.
However, to be reword it another way the IPv4 header, maximum length 60 bytes, is part of the IPv4 packet's overall length, the 64KB (i.e. not the converse).
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide