views:

43

answers:

1

The bits in Ethernet are transferred in LSB first fashion, but IPv4 datagram is to be transmitted in big endian byte order.

e.g. assume an ethernet frame with destination address as 12-34-56-78-9A-BC carrying an IP datagram in the data field. As I understand following will be the order in which the bits will be transmitted:

preamble-SFD-destination addr----(rest of ethernet header)----(ethernet data)

preamble-SFD-destination addr----(rest of ethernet header)----version----header length----(rest of IP datagram)

preamble-SFD-12-34-56-78-9A-BC----(rest of ethernet header)----4----15----(rest of IP datagram)

Question 1:Which of the following transmissions is correct?

transmission of ethernet frame on the wire with LSB in each byte first

preamble-SFD-01001000 00101100 01101010 00011110 01011001 00111101----(rest of ethernet header)---- 11110010----(rest of IP datagram)

transmission of ethernet frame on the wire with LSB in each byte first but IP header is transfered as MSB in each byte first

preamble-SFD-01001000 00101100 01101010 00011110 01011001 00111101----(rest of ethernet header)---- 01001111----(rest of IP datagram)

Question 2: Since the ethernet frame is transmitted with LSB in each byte first, will the bits in the data part also(the IPv4 datagram) be transfered as LSB in each byte first?

If yes, why do we say that IPv4 datagram is transfered in big endian byte order

+1  A: 

Big-endian byte order within the IPv4 datagram has nothing whatsoever to do with the ordering of bits on the wire.

Logically, think of an Ethernet frame as a series of bytes, until you get all the way down to the physical layer.

Some Ethernet physical layer technologies (the older, slower ones) happen to straightforwardly convert each byte into 8 bits on the wire, least-significant bit first. (Once you get to 1G / 10G speeds, it is nothing like this simple...)

In your example, with version = 4 and header length = 15, the first byte of the IP datagram will be 0x4F which will be transmitted as 11110010.


"Big-endian byte order" is referring to the ordering of bytes in multi-byte fields.

For example: the "Total Length" field in the IPv4 header is a 16-bit value occupying bytes 2 and 3. If the total length is 1000 bytes - 0x3E8 in hex - this will be sent as 0x03 (byte 2) followed by 0xE8 (byte 3). (Whereas if it was little-endian, it would be 0xE8 in byte 2 and 0x03 in byte 3.)

Matthew Slattery