What is the "in-the-wire" size of a ethernet frame? 1518 or 1542?

27,571

Solution 1

The diagram on Wikipedia is horrible. Hopefully what I'm about to write is clearer.


The maximum payload in 802.3 ethernet is 1500 bytes.
This is the data you're trying to send out over the wire (and what the MTU is referring to).
[payload] <- 1500 Bytes

The payload is encapsulated in an Ethernet Frame (which adds the Source/Destination MAC, VLAN tag, Length, and CRC Checksum. This is a total of 22 bytes of additional "stuff"
[SRC+DST+VLAN+LENGTH+[payload]+CRC] <- 1522 Bytes

The Frame is transmitted over the wire -- before your ethernet card does that it basically stands up and shouts really loud to make sure nobody else is using the wire (CSMA/CD) -- This is the Preamble and Start-of-Frame delimiter (SFD) -- an additional 8 bytes, so now we have:
[Preamble+SFD+[Ethernet Frame]] <- 1530 Bytes

Finally when an ethernet transceiver is done sending a frame it is required by 802.3 to transmit 12 bytes of silence ("Interframe Gap") before it's allowed to send its next frame.
[Preamble+SFD+[Ethernet Frame]+Silence] <- 1542 bytes transmitted on the wire.


The Preamble, SFD and Interframe Gap do not count as part of the frame. They are support structure for the Ethernet protocol itself.

The MTU applies to the payload -- it is the largest unit of data you can cram into the packet. Thus an ethernet packet with an MTU of 1500 bytes will actually be a 1522 byte frame, and 1542 bytes on the wire (assuming there's a vLAN tag).

So the answer to your question - What is the biggest packet I can send out over 802.3 ethernet without fragmentation? - is 1500 bytes of payload data.

HOWEVER the ethernet layer may not be your limiting factor. To discover if something along the way is restricting the MTU to be smaller than 1500 bytes of payload data use one of the following:

  • Windows: ping hostname -f -l sizeofdata (technique John K mentioned)
  • BSD: ping -D -s sizeofdata hostname
  • Linux: ping -M do -s sizeofdata hostname

The largest value of sizeofdata that works is the MTU (over the particular path your data is taking).

Solution 2

It depends on the amount of data you put in the frame. If you put 1500 bytes of data in a frame, your total frame size is going to be 1518 bytes. With 1472 bytes of data, you'll end up with a total frame size of 1500..

http://en.wikipedia.org/wiki/Ethernet_frame

That being said, if you're truly interested in testing fragmentation, a good way to test this is with a good old ping with a few flags:

ping hostname -f -l sizeofdata

The -f flag will cause the ping to fail if the packet is fragmented. The key to understand here is "sizeofdata" is the amount of data you can put in a message without fragmenting - so if you send a payload of 1500, you'll start fragmenting as you go over 1500 bytes. Turn that down to 1472 though (1500 - the 18 byte overhead), and you'll see the pings go through.

Share:
27,571

Related videos on Youtube

chrisapotek
Author by

chrisapotek

I enjoy playing with technology and programming. Hope I can help you.

Updated on September 18, 2022

Comments

  • chrisapotek
    chrisapotek over 1 year

    According to the table here, it says that MTU = 1500 bytes and that the payload part is 1500 - 42 bytes or 1458 bytes (<- this is actually wrong!). Now on top of that you have to add IPv4 and UDP headers, which are 28 bytes (20 IP + 8 UDP). That leaves my maximum possible application message to as 1430 bytes! But by looking for this number in the Internet I see 1472 instead. Am I doing this calculation wrong here?

    All I want to find out is the maximum application message I can send over the wire without the risk of fragmentation. It is definitely not 1500 because that includes the frame headers. Can someone help?


    The confusion is the PAYLOAD can actually be as large as 1500 bytes and that's the MTU. So now what is the size in-the-wire for a payload of 1500? From that table it can be as big as 1542 bytes.

    So the maximum app messages I can send is 1472 (1500 - 20 (ip) - 8 (udp)) for a maximum in the wire size of 1542. It amazes me how things can get so complicated when they are actually simple. And I have not clue how someone came up with the number 1518 if the table says 1542.

    • Mike Pennington
      Mike Pennington over 11 years
      The real question here is what do you mean by "in the wire size" and what will you do with this information? Are you trying to calculate packets per second?
    • chrisapotek
      chrisapotek over 11 years
      @MikePennington Trying to determine in-the-wire transite time. With packet size and ethernet speed (10 gigabits) you can calculate that.
  • Mike Pennington
    Mike Pennington over 11 years
    I'm sorry, 1542 bytes is way above the standard ethernet frame defined by IEEE 802.3. A untagged 1500-byte ethernet payload is 1518 bytes (not including the SFD / preable). An 802.1q-tagged frame is 1522 bytes (same caveats)
  • Univ426
    Univ426 over 11 years
    I'm sorry, I must be wrong - I thought I understood it but I clearly have my numbers off, it looks like its 1518 :S sorry about that
  • chrisapotek
    chrisapotek over 11 years
    It is not you who are confused, but everyone. So my questions continues. What the heck is the difference between MTU and ethernet frame size? Is the payload 1500 or less?
  • Univ426
    Univ426 over 11 years
    My understanding is the payload can be up to 1500 octets, which will give you a total frame size of 1518. I have no idea why I thought the total frame size was 1542. @MikePennington is correct, an 802.1q tagged frame has an additional 4 bytes for VLAN taggin
  • chrisapotek
    chrisapotek over 11 years
    Where are the extra 18 bytes coming from for a payload of 1500? If I count the stuff in that wiki table, it gives me 42 extra bytes. Your mistake was the same mistake I was doing. We need to understand the logic behind this.
  • Univ426
    Univ426 over 11 years
    Agreed, I'll leave this atrocity here for now, but yeah, I'm hoping someone else can answer it too - I'm just as confused. Again, my apologies for that.
  • chrisapotek
    chrisapotek over 11 years
    However I do have to exclude IP and UDP headers from this 1500, right? So my max application message length is 1472 for UDP.
  • voretaq7
    voretaq7 over 11 years
    @chrisapotek Correct - The IP and UDP (or TCP, GRE, etc.) headers are part of the payload that gets put into the ethernet frame
  • Rqomey
    Rqomey over 11 years
    traceroute --mtu {target} on linux will also display max mtu
  • SaveTheRbtz
    SaveTheRbtz over 11 years
    should we get a little more "physical"? en.wikipedia.org/wiki/8b/10b_encoding
  • voretaq7
    voretaq7 over 11 years
    @SaveTheRbtz oh please no - getting down to the binary representation hurts my head enough :-)
  • kasperd
    kasperd almost 9 years
    This answer is almost, but not quite, entirely unrelated to the question.
  • Matt
    Matt over 3 years
    But why do we often see 1514 in packet captures, and not 1518 for total bytes ?