3

What does the ethernet header look like?

Is it:

1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
..................................destination mac..................................
...................................|...................source mac..................
...................................................................................|
...............type................|

Or:

1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
..................................destination mac..................................
...................................|...................source mac..................
...................................................................................|
...............type................|.......................data....................
......................................up to 1500...................................|
crc/fcs|

Or is it:

1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|
...Preamble..|................................destination mac......................
...........................................................|source mac.............
...................................................................................
.............|.type........................................|data....................
......................................up to 1500...................................|
crc/fcs|

I found many different opinions on this in the web.

Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
user2025406
  • 55
  • 1
  • 1
  • 8

1 Answers1

4

Neither of them. Following the specs the frame looks like:

  • Preamble: 8 bytes
  • Destination mac: 6 bytes
  • Source mac: 6 bytes
  • Type/length: 2 bytes
  • Data: 46-1500 bytes
  • Frame check: 4 bytes

The specs are here: http://standards.ieee.org/about/get/802/802.3.html

A more useful and easily accessible explanation is here: http://wiki.wireshark.org/Ethernet

The header is the frame before the data. The MAC header is point 2-4 (14 bytes). The MAC trailer is 4 bytes (last point). The ethernet frame thus consists of the preamble (8 bytes), the MAC header (14 bytes), data and the trailer (4 bytes).

Patrik
  • 2,695
  • 1
  • 21
  • 36
  • [Here](http://stackoverflow.com/questions/4218553/what-is-the-size-of-udp-packets-if-i-send-0-payload-data-in-c) is said that the ethernet frame size was fixed to 18 bytes... I'm confused about this. Is the "data" here the same as the "payload" mentioned in the other thread (link)? thx – user2025406 Feb 11 '13 at 14:08
  • See the edits. There is a difference between the MAC header and the ethernet header. Payload is indeed the data transported by the packet. – Patrik Feb 11 '13 at 14:20