I'm completely new to the topic, I've read that Ethernet sends Bytes in a Big-Endian way, but that bits are sent with Little-Endian. I've also read that IPv4 uses Big_endian order. So my question is, how can IP protocol stay on an Ethernet layer if they (IP layer and Ethernet) manage bits in different ways?
1 Answer
I wouldn't use the term endianness here. There's no general word size like with CPUs.
Ethernet sends bytes as a bit stream, with the least significant bit first, with the notable exception of the FCS. In multi-octet fields, octets are ordered most significant octet first.
IP uses the same most-significant-octet-first order, where that matters. It doesn't (really) define a bit order as it interfaces with the underlying protocol on the octet/byte level.
For Ethernet, the IP packet with headers is only payload, a bunch of bytes, so whatever rules apply within the payload doesn't matter. The only thing that matters is that the bit and byte orders are well defined and apply to the whole network, to enable data exchange.
-
I'm sorry for ingenuity but as I said I'm completely naive. But in what sense "whatever rules apply within the payload doesn't matter"? the superior layer will have to read that payload, so ins't it a problem if ethernet level has sent (and saved (?)) data in an inverted bit order than the one used by the upper layer?– miziusMay 30 at 20:30
-
Ethernet is the lower layer here. Generally, a lower layer doesn't understand nor care for any headers, data or anything else in an upper layer - it's all just payload. And as explained, Ethernet's physical layer is the only one involved with bit order.– Zac67 ♦May 30 at 21:26
-
From what I have learnt data is passed from layer to layer as packets (the topic of n-PDU and so on). Having this image in my mind I see the packet transferred from Ethernet level to network layer in a packet in which bits are arranged in a little endian fashion and I'm not understanding how network layer could understand it if the packet that is received has been "written" in a language different from what the level uses. What am I missing with this view ?– miziusMay 30 at 22:29
-
@mizius Payload is passed between layers as just an array of bytes. Packetization may even be a service provided by a lower layer. What those bytes mean and how they are arranged is not of any consequence nor even understood by the lower layer.– Zac67 ♦May 31 at 9:04
-
1Lower layers encapsulate upper layers, like putting a letter in an envelope. May 31 at 16:59