3

I am a little bit confused about one fact. According to the specification, the ethernet frame maximum size is 1518 bytes, and the IPv4 packet size Length field in an IPv4 header can be up to 65535 bytes.

So my question is: how is it possible to have an IP packet maximum length larger than an ethernet frame, as everyone knows IPv4 packets encapsulated into ethernet frames.

I have only one guess is fragmentation.

Please explain this.

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, 2017 at 14:44

4 Answers 4

4

Your assumption the IPv4 is always encapsulated by ethernet is flawed. Don't confuse the network layers. Ethernet, a layer-2 protocol, can carry any numbers of layer-3 protocols, not only IPv4. On the other hand, IPv4, a layer-3 protocol, can be carried by any number of layer-2 protocols, and it doesn't care which. Some layer-2 protocols on which IPv4 is carried have larger maximum MTU sizes than does ethernet.

Ethernet and IPv4 were developed and released at about the same time, but by very different groups. It was not obvious at the time that either would end up being the dominant protocol for its network layer. Ethernet is a LAN protocol which was mostly used for IPX, and IPv4 was usually used on WANs to connect large university computers.

IPv4 can be fragmented by routers in the path, IPv6 cannot, but it specifies a minimum MTU of 1280. Lately, there is PMTUD which discovers the minimum MTU in a path before sending packets out along the path, so that packet sizes can be adjusted to fit the minimum MTU of the path before being sent.

5
  • Thanks for answer but I still cannot understand. Have a look at this picture elguber.files.wordpress.com/2010/05/osi_layers.jpg each upper layer has smaller size than lower, that is quite clear. Or you mean that 1500 restrictions is not real world case ? Jun 15, 2016 at 14:47
  • What I'm saying is that each protocol was developed independently. There is no reason that IPv4 knows or cares about ethernet. When IPv4 was being developed, there was no such thing as ethernet, and when ethernet was being developed, there was no IPv4. Why would each care about the maximum size of the other? Each was developed with maximum sizes that its creators thought fit the protocol being developed. It is by pure happenstance that those two are the dominant protocols, and neither cares about the other.
    – Ron Maupin
    Jun 15, 2016 at 14:53
  • @solderingiron, when Wi-Fi (IEEE 802.11) was developed, it was created with a larger payload than ethernet (IEEE 802.3). The maximum Wi-Fi frame size is 2346, considerably larger than ethernet, but not as large as the maximum packet size of IPv4. Token ring (IEEE 802.5) can have a payload of up to 4500 bytes. Some serial layer-2 protocols can have even larger payloads. Each network layer is independent of the other layers because each can carry, or be carried by, any current or future protocols.
    – Ron Maupin
    Jun 15, 2016 at 15:10
  • Thanks for answers, but one and main question. If lower standard doesn't support such size for example 4500 for IEEE 802.5 and 65535 in IPV4 protocol, what happens on the bottom layer ? Jun 15, 2016 at 19:52
  • The network stack in a host has an MTU for a particular interface. Each layer knows what this is, and it adjusts itself accordingly.
    – Ron Maupin
    Jun 15, 2016 at 20:00
2

a) Ethernet is not the only Layer-2 transport.
b) IP supports fragmentation. (it's a bad idea, but it supports it.)
and c) Many vendors ignore that specific part of the standard and allow "jumbo frames". As it's not part of any standard, there's no set number -- it ranges from 2k up to 16k.

2

In short the exact definition of fragmentation is part of the answer.

First, as some have answered, these are from specifications of ethernet and IP (IPv4). Since there are other Layer 2 (Data Link Layer) protocols than ethernet, and assume other uses for ethernet, these standards are written to not be dependent on each other. So the 65535 byte maximum specified for IP might be if Layer 2 supports the IP payload can be as large but might not be able to be larger than 65535 bytes. Over ethernet, the ethernet implementation becomes the limiting factor rather than the specification.

Another factor could be fragmentation. If one implemented a high speed serial cable protocol which supported 65535 byte frames, which was connected to a gateway on an ethernet LAN, then the IP packets in those large frames from the serial cable would have to be fragmented into multiple IP packets and reassembled.

Although the above is a complete direct answer to your question, misconceptions about this area is a pet peeve of mine, so I would like to expound into information you did not ask for to be a more full explanation of how this all works.

Conceptually, communication is modeled on ISO's OSI model, where lower layers encapsulate higher numbered layers. That would give us this concept:

OSI layers

That diagram, however, is incorrect.

Let's consider connecting the ethernet cards of two computers with a twisted pair cable. One computer is running a web server and the other opens a web page from that server. We have HTTP over TCP over IP over ethernet.

The physical layer (layer 1) is the cable which communicates by the cycles of charge on the wire.

The data link layer (layer 2) is ethernet which takes the physical charge service and implements a frame service of broadcasting frames on a LAN, and receiving frames addressed to the appropriate computer. Each of these frames has an ethernet header followed by the frame payload.

The network layer (layer 3) is IP. The IP layer provides an IP packet service, delivering packets over IP hops to the destination address for the packet. This IP packet is encapsulated in the payload of the ethernet frame. In that packet is an IP header, followed by the IP packet payload.

The transport layer (layer 4) is TCP. TCP provides a byte/bit streaming service. Bytes are written at one end and TCP allows them to be read at the other. TCP breaks the stream of those bytes to fit into IP packets. The payload of each of those IP packet payloads starts with a TCP header followed by bytes from the stream.

The headers of ethernet, IP, and TCP are repeated in each frame giving us this diagram:

Frame Headers

Next we have the application layer (layer 7) which is HTTP. The HTTP requests and responses have HTTP headers. However, the header is not repeated in every frame. It also can be larger than fits in a single frame. Here the original diagram is wrong.

The answer to your question is that the numbers you quote are from the specifications, which might not match the practical concerns of the particular combination of IP over ethernet. That pair may have an additional restriction limiting the IP packet to a smaller size than the maximum the specification allows.

However, to clarify, you are correct that an IP packet, IP header and IP payload, must fit in an ethernet frame. The TCP segment, TCP header and TCP segment payload, must fit into an IP packet. TCP provides a stream split across IP packets. The HTTP header and request or response body (not to be confused with the body tag) are streamed on TCP which is across multiple IP packets.

0

Unless the sender sets the Don't Fragement flag, a packet can be fragmented into many Ethernet frames. The recipient assembles the fragments and processes the whole IP packet. No information of the original IP packet will be lost.

1
  • "a packet can be fragmented into many Ethernet frames." IPv6 cannot be fragmented in the path the way IPv4 can be, and IP datagrams are packets, not frames (data-link datagrams). "No information of the original IP packet will be lost." Packet fragments can be lost, and if even one fragment is lost, the whole packets is lost because it cannot be reassembled.
    – Ron Maupin
    Dec 19, 2020 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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