8

According to big endian byte ordering or network byte order the bits are transmitted in this order: bits 0-7 first, then bits 8-15, then 16-23 and bits 24-31 last. Does this means that bits from version, identification, TTL etc go first and then bits from next fields?

enter image description here

6

There is a confusion here. The network byte order does not specify how bits are transmitted over the network. It specifies how values are stored in multi byte fields.

Example:

The Total Length field is composed of two bytes. It specifies in bytes the size of the packet.

Lets say we have the value 500 for that field. Using the Network Byte Order it will be seen over the wire like this, being transmitted transmission from left to right:

00000001 11110100

If we would use the little endian format then it would have been seen over the wire like this:

11110100 00000001

After the whole packet is constructed the bits will be sent starting with the lowest addressed bit of the header (bit 0), so the transmission will start with the Version field.

A final point to make here is that the Network byte order is, as you mentioned, the Big Endian Order. This was chosen arbitrarily to have a common format for all network protocols and implementations.

  • 1
    So, in case the first field that will go on wire is version, then HL, then Type, then Total Length, then Identification, and so on. Big endian and little endian only determine how the bits are stored in the header fields. – MUSR Nov 10 '15 at 13:42
  • Yes you got it :) – dragosb Nov 10 '15 at 13:50
  • @MUSR: no, they determine the order in which bytes in a multi-byte field are transmitted. – EML Aug 10 '18 at 11:07
3

It's very easy to think that internet packets go on the wire in a very simple "serial port" kind of way. In practice there is nothing inherently serial about it.

If you think about some interface details it might make this clearer:

  • Consider Parallel port IP, which actually sends the data 4-bits at a time over four wires. https://en.wikipedia.org/wiki/Parallel_Line_Internet_Protocol
  • Actual 100baseTX scrambles 4-bit blocks and sends them as 5 bits serially but the original data isn't visible in the output, so the question about what order they go in doesn't have an answer. https://en.wikipedia.org/wiki/4B5B
  • When you send a packet across a loopback interface, it might be copied inside the computer's bus 64-bits at a time; or indeed just by memory remapping which would really be whole packet in parallel.

Of course parallel port IP isn't common, but it illustrates the point; the other two are ubiquitous.

Hope that helps

Jonathan.

2

Other protocols may be different, but Ethernet transmits most signficant octet/byte first and within each byte least significant bit first. So, a 16-bit field is transmitted 8-9-10-11-12-13-14-15 - 0-1-2-3-4-5-6-7 (0=least signficant bit, 15=most significant bit). Check IEEE 802.3 Clauses 3.1.1, 3.2.6, and 3.3.

(This is for purely serial Ethernet - depending on the physical layer, up to eight bits may be transferred simultaneously. Additionally, the bit order goes only for the unencoded layer 1.)

IPv4 also uses most significant octet first, check RFC 791. However, numbering in IETF RFCs is in order of transmission with the bit numbering in reverse to Ethernet: Bit 0 = most significant bit = transmitted first (where not otherwise defined).

  • You confused octets and bit order it should be : 7-6-5-4-3-2-1 15-14-13-12-11-10-9-8 first octet is 0-7 the 7th bit being the least significant. – Gopoi Oct 8 at 22:16
  • @Gopoi If you number the bits that way you're right. However, usually "0" is the least significant bit (last in human written form) and "15" is the most significant bit (first in human written form) - according to their power of two values. – Zac67 Oct 9 at 6:32
  • I always thought of the bit numbering as the transmit order since RFCs headers are shown thusly. The more you know! – Gopoi Oct 10 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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