Ethernet frame

Ethernet frame

From Wikipedia, the free encyclopedia

Jump to navigationJump to search

data unit on an Ethernet link transports an Ethernet frame as its payload.[1]

An Ethernet frame is preceded by a preamble and start frame delimiter (SFD), which are both part of the Ethernet packet at the physical layer. Each Ethernet frame starts with an Ethernet header, which contains destination and source MAC addresses as its first two fields. The middle section of the frame is payload data including any headers for other protocols (for example, Internet Protocol) carried in the frame. The frame ends with aframe check sequence (FCS), which is a 32-bit cyclic redundancy check used to detect any in-transit corruption of data.

 

Contents

Structure[edit]

See also: Physical Coding Sublayer

A data packet on the wire and the frame as its payload consist of binary data. Ethernet transmits data with the most-significant octet (byte) first; within each octet, however, the least-significant bit is transmitted first.[a]

The internal structure of an Ethernet frame is specified in IEEE 802.3.[1] The table below shows the complete Ethernet packet and the frame inside, as transmitted, for the payload size up to the MTU of 1500 octets.[b] Some implementations of Gigabit Ethernet and other higher-speed variants of Ethernet support larger frames, known as jumbo frames.

802.3 Ethernet packet and frame structure
LayerPreambleStart of frame delimiterMAC destinationMAC source802.1Q tag (optional)Ethertype(Ethernet II) or length (IEEE 802.3)PayloadFrame check sequence(32‑bit CRC)Interpacket gap
 octets1 octet6 octets6 octets(4 octets)2 octets46‑1500 octets4 octets12 octets
Layer 2 Ethernet frame ← 64–1522 octets → 
Layer 1 Ethernet packet & IPG← 72–1530 octets →← 12 octets →

The optional 802.1Q tag consumes additional space in the frame. Field sizes for this option are indicated parenthetically in the table above. IEEE 802.1ad (Q-in-Q) allows for multiple tags in each frame. This option is not illustrated here.

Ethernet packet – physical layer[edit]

Preamble and start frame delimiter[edit]

An Ethernet frame inside an Ethernet packet, with SFD marking the end of the packet preamble and indicating the beginning of the frame.[3]

See also: Syncword

An Ethernet packet starts with a seven-octet preamble and one-octet start frame delimiter (SFD).[c]

The preamble consists of a 56-bit (seven-byte) pattern of alternating 1 and 0 bits, allowing devices on the network to easily synchronize their receiver clocks, providing bit-level synchronization. It is followed by the SFD to provide byte-level synchronization and to mark a new incoming frame. For Ethernet variants transmitting serial bits instead of larger symbols, the (uncoded) on-the-wire bit pattern for the preamble together with the SFD portion of the frame is 10101010 10101010 10101010 10101010 10101010 10101010 10101010 10101011;[3]:sections 4.2.5 and 3.2.2 The bits are transmitted in order, from left to right.[3]:sections 4.2.5

The SFD is the eight-bit (one-byte) value that marks the end of the preamble, which is the first field of an Ethernet packet, and indicates the beginning of the Ethernet frame. The SFD is designed to break the bit pattern of the preamble and signal the start of the actual frame.[3]:section 4.2.5 The SFD is immediately followed by the destination MAC address, which is the first field in an Ethernet frame. SFD is the binary sequence 10101011 (0xD5, decimal 213 in the Ethernet LSB first bit ordering).[3]:sections 3.2.2, 3.3 and 4.2.6

Physical layer transceiver circuitry (PHY for short) is required to connect the Ethernet MAC to the physical medium. The connection between a PHY and MAC is independent of the physical medium and uses a bus from the media independent interface family (MIIGMIIRGMIISGMIIXGMII). Fast Ethernet transceiver chips utilize the MII bus, which is a four-bit (one nibble) wide bus, therefore the preamble is represented as 14 instances of 0x5, and the SFD is 0x5 0xD (as nibbles). Gigabit Ethernet transceiver chips use the GMII bus, which is an eight-bit wide interface, so the preamble sequence followed by the SFD would be 0x55 0x55 0x55 0x55 0x55 0x55 0x55 0xD5 (as bytes).

Frame – data link layer[edit]

Header[edit]

The header features destination and source MAC addresses (each six octets in length), the EtherType field and, optionally, an IEEE 802.1Q tag orIEEE 802.1ad tag.

The EtherType field is two octets long and it can be used for two different purposes. Values of 1500 and below mean that it is used to indicate the size of the payload in octets, while values of 1536 and above indicate that it is used as an EtherType, to indicate which protocol is encapsulated in the payload of the frame. When used as EtherType, the length of the frame is determined by the location of the interpacket gap and valid frame check sequence (FCS).

The IEEE 802.1Q tag or IEEE 802.1ad tag, if present, is a four-octet field that indicates virtual LAN (VLAN) membership and IEEE 802.1p priority. The first two octets of the tag are called the Tag Protocol IDentifier and double as the EtherType field indicating that the frame is either 802.1Q or 802.1ad tagged. 802.1Q uses a TPID of 0x8100. 802.1ad uses a TPID of 0x88a8.

Payload[edit]

The minimum payload is 42 octets when an 802.1Q tag is present and 46 octets when absent.[d] When the actual payload is less, padding bytes are added accordingly.[e] The maximum payload is 1500 octets. Non-standard jumbo frames allow for larger maximum payload size.

Frame check sequence[edit]

The frame check sequence (FCS) is a four-octet cyclic redundancy check (CRC) that allows detection of corrupted data within the entire frame as received on the receiver side. The FCS value is computed as a function of the protected MAC frame fields: source and destination address, length/type field, MAC client data and padding (that is, all fields except the FCS).[3]:section 3.2.9

Running the CRC algorithm over the received frame data including the CRC code will always result in a zero value for error-free received data, because the CRC is a remainder of the data divided by the polynomial. However, this technique can result in "false negatives", in which data with trailing zeroes will also result in the same zero remainder. To avoid this scenario, the FCS is complemented (reversed for each bit) by the sender before it is attached to the end of the payload data.[3]:section 3.2.9 This way, the algorithm result will always be a magic number or CRC32 residueof 0xC704DD7B when data has been received correctly. This allows for receiving a frame and validating the FCS without knowing where the FCS field actually starts.[5][6]

End of frame – physical layer[edit]

The end of a frame is usually indicated by the end-of-data-stream symbol at the physical layer or by loss of the carrier signal; an example is10BASE-T, where the receiving station detects the end of a transmitted frame by loss of the carrier. Later physical layers use an explicit end of data or end of stream symbol or sequence to avoid ambiguity, especially where the carrier is continually sent between frames; an example is Gigabit Ethernet with its 8b/10b encoding scheme that uses special symbols which are transmitted before and after a frame is transmitted.[7][8]

Interpacket gap – physical layer[edit]

Interpacket gap is idle time between packets. After a packet has been sent, transmitters are required to transmit a minimum of 96 bits (12 octets) of idle line state before transmitting the next packet.

Types[edit]

Ethernet frame differentiation
Frame typeEthertype or lengthPayload start two bytes
Ethernet II≥ 1536Any
Novell raw IEEE 802.3≤ 15000xFFFF
IEEE 802.2 LLC≤ 1500Other
IEEE 802.2 SNAP≤ 15000xAAAA

There are several types of Ethernet frames:

The different frame types have different formats and MTU values, but can coexist on the same physical medium. Differentiation between frame types is possible based on the table on the right.

In addition, all four Ethernet frame types may optionally contain an IEEE 802.1Q tag to identify what VLAN it belongs to and its priority (quality of service). This encapsulation is defined in the IEEE 802.3ac specification and increases the maximum frame by 4 octets.

The IEEE 802.1Q tag, if present, is placed between the Source Address and the EtherType or Length fields. The first two octets of the tag are the Tag Protocol Identifier (TPID) value of 0x8100. This is located in the same place as the EtherType/Length field in untagged frames, so an EtherType value of 0x8100 means the frame is tagged, and the true EtherType/Length is located after the Q-tag. The TPID is followed by two octets containing the Tag Control Information (TCI) (the IEEE 802.1p priority (quality of service) and VLAN id). The Q-tag is followed by the rest of the frame, using one of the types described above.

Ethernet II[edit]

Ethernet II framing (also known as DIX Ethernet, named after DECIntel and Xerox, the major participants in its design[9]), defines the two-octetEtherType field in an Ethernet frame, preceded by destination and source MAC addresses, that identifies an upper layer protocol encapsulated by the frame data. For example, an EtherType value of 0x0800 signals that the frame contains an IPv4 datagram. Likewise, an EtherType of 0x0806 indicates an ARP frame, 0x86DD indicates an IPv6 frame and 0x8100 indicates the presence of an IEEE 802.1Q tag (as described above).

The most common Ethernet Frame format, type II

As this industry-developed standard went through a formal IEEE standardization process, the EtherType field was changed to a (data) length field in the new 802.3 standard.[g] Since the recipient still needs to know how to interpret the frame, the standard required an IEEE 802.2 header to follow the length and specify the type. Many years later, the 802.3x-1997 standard, and later versions of the 802.3 standard, formally approved of both types of framing. Ethernet II framing is the most common in Ethernet local area networks, due to its simplicity and lower overhead.

In order to allow some frames using Ethernet v2 framing and some using the original version of 802.3 framing to be used on the same Ethernet segment, EtherType values must be greater than or equal to 1536 (0x0600). That value was chosen because the maximum length of the payload field of an Ethernet 802.3 frame is 1500 octets (0x05DC). Thus if the field's value is greater than or equal to 1536, the frame must be an Ethernet v2 frame, with that field being a type field.[10] If it's less than or equal to 1500, it must be an IEEE 802.3 frame, with that field being a length field. Values between 1500 and 1536, exclusive, are undefined.[11] This convention allows software to determine whether a frame is an Ethernet II frame or an IEEE 802.3 frame, allowing the coexistence of both standards on the same physical medium.

Novell raw IEEE 802.3[edit]

Novell's "raw" 802.3 frame format was based on early IEEE 802.3 work. Novell used this as a starting point to create the first implementation of its own IPX Network Protocol over Ethernet. They did not use any LLC header but started the IPX packet directly after the length field. This does not conform to the IEEE 802.3 standard, but since IPX always has FF as the first two octets (while in IEEE 802.2 LLC that pattern is theoretically possible but extremely unlikely), in practice this usually coexists on the wire with other Ethernet implementations, with the notable exception of some early forms of DECnet which got confused by this.

Novell NetWare used this frame type by default until the mid-nineties, and since NetWare was then very widespread, while IP was not, at some point in time most of the world's Ethernet traffic ran over "raw" 802.3 carrying IPX. Since NetWare 4.10, NetWare defaults to IEEE 802.2 with LLC (NetWare Frame Type Ethernet_802.2) when using IPX.[12]

IEEE 802.2 LLC[edit]

Main article: IEEE 802.2

Some protocols, those designed for the OSI stack, operate directly on top of IEEE 802.2 LLC encapsulation, which provides both connection-oriented and connectionless network services.

IEEE 802.2 LLC encapsulation is not in widespread use on common networks currently, with the exception of large corporate NetWare installations that have not yet migrated to NetWare over IP. In the past, many corporate networks used IEEE 802.2 to support transparent translating bridges between Ethernet and Token Ring or FDDI networks.

There exists an Internet standard for encapsulating IPv4 traffic in IEEE 802.2 LLC SAP/SNAP frames.[13] It is almost never implemented on Ethernet, although it is used on FDDIToken RingIEEE 802.11 (with the exception of the 5.9 GHz band, where it uses EtherType)[14] and other IEEE 802 LANs. IPv6 can also be transmitted over Ethernet using IEEE 802.2 LLC SAP/SNAP, but, again, that's almost never used.

IEEE 802.2 SNAP[edit]

Main article: Subnetwork Access Protocol

By examining the 802.2 LLC header, it is possible to determine whether it is followed by a SNAP header. The LLC header includes two eight-bit address fields, called service access points (SAPs) in OSI terminology; when both source and destination SAP are set to the value 0xAA, the LLC header is followed by a SNAP header. The SNAP header allows EtherType values to be used with all IEEE 802 protocols, as well as supporting private protocol ID spaces.

In IEEE 802.3x-1997, the IEEE Ethernet standard was changed to explicitly allow the use of the 16-bit field after the MAC addresses to be used as a length field or a type field.

Mac OS uses IEEE 802.2 LLC + SNAP encapsulation for the AppleTalk v2 protocol suite on Ethernet ("EtherTalk").

Maximum throughput[edit]

We may calculate the protocol overhead for Ethernet as a percentage (packet size including IPG)

{\displaystyle {\text{Protocol overhead}}={\frac {{\text{Packet size}}-{\text{Payload size}}}{\text{Packet size}}}}\text{Protocol overhead} = \frac{\text{Packet size} - \text{Payload size}}{\text{Packet size}}

We may calculate the protocol efficiency for Ethernet

{\displaystyle {\text{Protocol efficiency}}={\frac {\text{Payload size}}{\text{Packet size}}}}\text{Protocol efficiency} = \frac{\text{Payload size}}{\text{Packet size}}

Maximum efficiency is achieved with largest allowed payload size and is:

{\displaystyle {\frac {1500}{1538}}=97.53\%}\frac{1500}{1538} = 97.53\%

for untagged frames, since the packet size is maximum 1500 octet payload + 8 octet preamble + 14 octet header + 4 octet trailer + minimum interpacket gap corresponding to 12 octets = 1538 octets. The maximum efficiency is:

{\displaystyle {\frac {1500}{1542}}=97.28\%}\frac{1500}{1542} = 97.28\%

when 802.1Q VLAN tagging is used.

The throughput may be calculated from the efficiency

{\displaystyle {\text{Throughput}}={\text{Efficiency}}\times {\text{Net bit rate}}\,\!}\text{Throughput} = \text{Efficiency} \times \text{Net bit rate}\,\!,

where the physical layer net bit rate (the wire bit rate) depends on the Ethernet physical layer standard, and may be 10 Mbit/s, 100 Mbit/s, 1 Gbit/s or 10 Gbit/s. Maximum throughput for 100BASE-TX Ethernet is consequently 97.53 Mbit/s without 802.1Q, and 97.28 Mbit/s with 802.1Q.

Channel utilization is a concept often confused with protocol efficiency. It considers only the use of the channel disregarding the nature of the data transmitted – either payload or overhead. At the physical layer, the link channel and equipment do not know the difference between data and control frames. We may calculate the channel utilization:

{\displaystyle {\text{Channel utilization}}={\frac {\text{Time spent transmitting data}}{\text{Total time}}}}\text{Channel utilization} = \frac{\text{Time spent transmitting data}}{\text{Total time}}

The total time considers the round trip time along the channel, the processing time in the hosts and the time transmitting data and acknowledgements. The time spent transmitting data includes data and acknowledgements.

Runt frames[edit]

A runt frame is an Ethernet frame that is less than the IEEE 802.3's minimum length of 64 octets. Runt frames are most commonly caused bycollisions; other possible causes are a malfunctioning network cardbuffer underrunduplex mismatch or software issues.[15]

Notes[edit]

  1. Jump up^ The frame check sequence (FCS) uses a different bit ordering.[2]
  2. Jump up^ The bit patterns in the preamble and start of frame delimiter are written as bit strings, with the first bit transmitted on the left (not as octet values, which in Ethernet are transmitted least significant bit(s) first). This notation matches the one used in the IEEE 802.3 standard.
  3. Jump up^ Preamble and start frame delimiter are not displayed by packet sniffing software because these bits are stripped away at OSI layer 1 by the network interface controller (NIC) before being passed on to the OSI layer 2, which is where packet sniffers collect their data. There are layer-2 sniffers that can capture and display the preamble and start frame delimiter, but they are expensive and mainly used to detect problems related to physical connectivity.
  4. Jump up^ Minimum payload size is dictated by the 512-bit slot time used for collision detection in the Ethernet LAN architecture.
  5. Jump up^ Both 42 and 46 octet minimums are valid when 802.1Q is present.[4]
  6. Jump up^ A version 1 Ethernet frame was used for early Ethernet prototypes and featured 8-bit MAC addresses and was never commercially deployed.
  7. Jump up^ Original Ethernet frames define their length with the framing that surrounds it, rather than with an explicit length count.
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值