最新消息:阿啰哈,本人90后,目前单身,欢迎妹子们来撩!.(。→‿←。) 微信:frank01991

以太网帧结构(精读)

Network 林志斌 991浏览

前面一篇博文讲到“线速”的概念,想必大家对Ethernet Frame都记不清了,下面的内容就正好给大家剖析了以太网的帧结构(Tips:大家可以使用抓包工具以进一步分析和强化理解)。

2.0 Ethernet Frame Structure

2.1 Frame Format

The following illustrates the format of an Ethernet frame as defined in the original IEEE 802.3 standard:

Preamble (7-bytes) Start Frame Delimiter (1-byte) Dest. MAC Address (6-bytes) Source MAC Address (6-bytes) Length / Type (2-bytes) MAC Client Data
(0-n bytes)
Pad
(0-p bytes)
Frame Check Sequence (4-bytes)

Preamble:A sequences of 56 bits having alternating 1 and 0 values that are used for synchronization. They serve to give components in the network time to detect the presence of a signal, and being reading the signal before the frame data arrives.Start Frame Delimiter:A sequence of 8 bits having the bit configuration 10101011 that indicates the start of the frame.Destination & Source MAC Addresses:The Destination MAC Address field identifies the station or stations that are to receive the frame. The Source MAC Address identifies the station that originated the frame. The 802.3 standard permits these address fields to be either 2-bytes or 6-bytes in length, but virtually all Ethernet implementations in existence today use 6-byte addresses. A Destination Address may specify either an "individual address" destined for a single station, or a "multicast address" destined for a group of stations. A Destination Address of all 1 bits refers to all stations on the LAN and is called a "broadcast address".Length/Type:If the value of this field is less than or equal to 1500, then the Length/Type field indicates the number of bytes in the subsequent MAC Client Data field. If the value of this field is greater than or equal to 1536, then the Length/Type field indicates the nature of the MAC client protocol (protocol type). Click here for a list of Ethernet protocol type assignments.MAC Client Data:This field contains the data transferred from the source station to the destination station or stations. The maximum size of this field is 1500 bytes. If the size of this field is less than 46 bytes, then use of the subsequent "Pad" field is necessary to bring the frame size up to the minimum length.Pad:If necessary, extra data bytes are appended in this field to bring the frame length up to its minimum size. A minimum Ethernet frame size is 64 bytes from the Destination MAC Address field through the Frame Check Sequence.Frame Check Sequence:This field contains a 4-byte cyclical redundancy check (CRC) value used for error checking. When a source station assembles a MAC frame, it performs a CRC calculation on all the bits in the frame from the Destination MAC Address through the Pad fields (that is, all fields except the preamble, start frame delimiter, and frame check sequence). The source station stores the value in this field and transmits it as part of the frame. When the frame is received by the destination station, it performs an identical check. If the calculated value does not match the value in this field, the destination station assumes an error has occurred during transmission and discards the frame.The original Ethernet standards defined the minimum frame size as 64-bytes and the maximum as 1518-bytes. These numbers include all bytes from the Destination MAC Address field through the Frame Check Sequence field. The Preamble and Start Frame Delimiter fields are not included when quoting the size of a frame. The IEEE 802.3ac standard released in 1998 extended the maximum allowable frame size to 1522-bytes to allow a "VLAN tag" to be inserted into the Ethernet frame format.

2.2 Interframe Gap

Ethernet devices must allow a minimum idle period between transmission of frames known as the interframe gap (IFG) or interpacket gap (IPG). It provides a brief recovery time between frames to allow devices to prepare for reception of the next frame. The minimum interframe gap is 96 bit times, which is 9.6 microseconds for 10 Mb/s Ethernet, 960 nanoseconds for 100 Mb/s Ethernet, and 96 nanoseconds for 1 Gb/s Ethernet.

2.3 Frame Format Extensions

2.3.1 VLAN Tagging

In 1998, the IEEE approved the 802.3ac standard that defines frame format extensions to support Virtual Local Area Network (VLAN) Tagging on Ethernet networks. The VLAN protocol permits insertion of an identifier, or "tag", into the Ethernet frame format to identify the VLAN to which the frame belongs. It allows frames from stations to be assigned to logical groups. This provides various benefits such as easing network administration, allowing formation of work groups, enhancing network security, and providing a means of limiting broadcast domains, Refer to IEEE standard 802.1Q for definition of the VLAN protocol. The 802.3ac standard defines only the implementation details of the VLAN protocol that are specific to Ethernet.

If present, the 4-byte VLAN tag is inserted into the Ethernet frame between the Source MAC Address field and the Length/Type field. The first 2-bytes of the VLAN tag consist of the "802.1Q Tag Type" and are always set to a value of 0x8100. The 0x8100 value is actually a reserved Length/Type field assignment that indicates the presence of the VLAN tag, and signals that the traditional Length/Type field can be found at an offset of 4-bytes further into the frame. The last 2-bytes of the VLAN tag contain the following information

  • The first 3-bits are a User Priority Field that may be used to assign a priority level to the Ethernet frame.
  • The next 1-bit is a Canonical Format Indicator (CFI) used in Ethernet frames to indicate the presence of a Routing Information Field (RIF).
  • The last 12-bits are the VLAN Identifier (VID) which uniquely identifies the VLAN to which the Ethernet frame belongs.

With the addition VLAN tagging, the 802.3ac standard permitted the maximum length of an Ethernet frame to be extended from 1518-bytes to 1522-bytes. The following illustrates the format of an Ethernet frame that has been "tagged" with a VLAN identifier per the IEEE 802.3ac standard:

Preamble (7-bytes) Start Frame Delimiter (1-byte) Dest. MAC Address (6-bytes) Source MAC Address (6-bytes) Length/Type = 802.1Q Tag Type (2-byte) Tag Control Information (2-bytes) Length / Type (2-bytes) MAC Client Data
(0-n bytes)
Pad
(0-p bytes)
Frame Check Sequence (4-bytes)

2.3.2 Extension Field

With introduction of the 802.3z standard for Gigabit Ethernet in 1998, an extension field was added to the end of the Ethernet frame to ensure it would be long enough for collisions to propagate to all stations in the network. The extension field is appended as needed to bring the minimum length of the transmission up to 512 bytes (as measured from the Destination Address field through the extension field). It is required only in half-duplex mode, as the collision protocol is not used in full-duplex mode. Non data bits, referred to as "extension bits", are transmitted in the extension field so the carrier is extended for the minimum required time. The following illustrates a frame with an extension field appended:

Preamble (7-bytes) Start Frame Delimiter (1-byte) Dest. MAC Address (6-bytes) Source MAC Address (6-bytes) Length / Type (2-bytes) MAC Client Data
(0-n bytes)
Pad (0-p bytes) Frame Check Sequence (4-bytes) Extension

2.3.3 Frame Bursting

With introduction of the 802.3z standard for Gigabit Ethernet in 1998, a burst mode of operation was added that optionally allows a station to transmit a series of frames without relinquishing control of the transmission medium. Burst mode may be used only with Gigabit and higher Ethernet speeds and applies to half-duplex mode only. It improves the performance of Gigabit Ethernet when transmitting short frames.

After successfully transmitting one frame, a station operating in burst mode may continue to initiate transmission of additional frames until it reaches a "burst limit" of 65,536 bit times (8192 byte times). An interframe gap period is inserted between each frame in the burst. But instead of allowing the medium to go idle between frames, the transmitting station fills the interframe gaps with extension bits. Extension bits are "non data" symbols that maintain an active carrier, and are readily distinguished from data bits by receiving stations,

The first frame of a burst is transmitted as normal and includes an "extension field" as required. Subsequent frames in the burst do not require an extension field. If a collision occurs, only the first frame in the burst will be affected and require retransmission. The following illustrates an example of frame bursting:

MAC Frame w/ Extension Interframe Gap MAC Frame Interframe Gap ... MAC Frame
|----------------- Burst Limit ------------------|
|----------------- Duration of Carrier Event ------------------|

2.3.4 Jumbo Frames

In 1998, Alteon Networks, Inc. promoted an initiative to increase the maximum size of the MAC Client Data field from 1500-bytes to 9000-bytes. The initiative was not adopted by the IEEE 802.3 Working Group, but it was endorsed by a number of other companies. Larger frames would provide a more efficient use of the network bandwidth while reducing the number of frames that have to be processed.

A copy of Alteon Network's Jumbo Frame proposal can be found on the following web page. It restricts the use of Jumbo Frames to full-duplex Ethernet links, and defines a "link negotiation" protocol that allows a station to determine if the station on the other end of the segment is capable of supporting Jumbo Frames.

Froml:http://www.techfest.com/networking/lan/ethernet2.htm

转载请注明:林志斌 » 以太网帧结构(精读)

发表评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址