Ethernet frame format

Source: Internet
Author: User

Ethernet frame format frames are a limited 0/1 series. It can be divided into three parts: Header, Data (Payload), and tail: Preamble sfd dst src Type Payload (Data) Pad FCS Extension frames are sent/received from start to end in the order above. We will further explain the regions below. The first seven bytes of the header frame are called the preface (preamble ). Each of its bytes is 0xAA (here it is a hexadecimal system, that is, 10101010 of the binary system ). Generally, we reserve a 0/1 series (such as 10 bits per second) sent at a certain frequency ). If the receiving device receives messages at other frequencies (such as 5 bits per second), 0/1 of the information to be received will be missed by mistake. However, due to different NICs, the sender and receiver may be physically deviated from each other even if the reservation frequency is the same. This is as if two people had an appointment at. The result is that one table is fast and one table is slow. The preface is to allow the receiving device to adjust the receiving frequency so as to be consistent with the frequency of the sending device. This process is called recover the clock ). (Just like adjusting the button until the sound is clear before listening to the broadcast. The NIC will constantly fine-tune its receiving frequency during the process of receiving the preface until you "hear" is... 1010 ...) after the clock is adjusted, we wait for the starting signal of the frame (SFD, start frame delimiter ). SFD is a fixed value 0 x AB. This 0xAB is like "The Little horn starts broadcasting", reminding us that the program is coming soon. Preamble and SFD are followed by SFD by 6 bytes of destination (DST, destination) and 6 bytes of destination (SRC, source ). This is what we introduced in the postmaster and post office. We wrote the destination and departure address for the envelope. Note that the "local description" of the address, that is, the MAC address, is written on the envelope. The MAC address is the serial number provided by the physical device and can only be identified in the same Ethernet (just as the postman is familiar with his own community ). The last area of the header is Type, which is used to describe the Type of the Data part. (For example, 0x0800 is IPv4 and 0x0806 is ARP) data generally contains data that complies with higher-level protocols, such as IP packets. The connection layer protocol itself does not care about what the data is. It is only responsible for transmission. Note that the end of the data may be filled with a string of 0 (PAD area ). The reason is that the data must exceed a certain minimum length. The Check Sequence (FCS and Frame Check Sequence) follows after the data ). The verification sequence is used to check whether an error occurs during data transmission. In the physical layer, we use some physical signals to represent the 0/1 sequence (such as high voltage/low voltage, high frequency/low frequency), but these physical signals may be affected during transmission so that an error occurs. How can we find that our data is correct? One way is to send the data twice and compare whether the data is the same. However, this greatly reduces the network efficiency. FCS adopts the CRC (Cyclic Redundancy Check) algorithm. It seems like a hotel owner has hired a cashier, but he is worried about the cashier's money. However, the daily turnover is very large. Even if the boss is sitting next to it, he cannot remember the total number of messages received. So he took a clever way: only remember the last person who received the money (for example, 19 yuan, the boss remembered 9 ). When there is a new revenue (for example, 13, the ending number is 3), he will add the new ending number and the old ending number, and then remember the ending number (that is, 2 ). When the cashier gives the money to the boss, the boss only needs to check whether the last one in the total amount is the same as the last one in his/her mind, so that he can know whether the cashier is honest. If our data is the total amount of cash, our FCS is the ending number recorded by the boss. If the two do not match, we know that the data is incorrect during transmission and cannot be used. In fact, the comparison between the number of business operations and the number of business operations is divided by 10 to get the final ending number. The CRC algorithm is similar. The n-bit CRC algorithm obtains an n-bit factor, for example, the following 1011. N-1-1 zeros are added at the end of the data sequence. The factor and data sequence are constantly operated on XOR until the remainder of N-1 bits is obtained, that is, 100. The remainder is reversed (011) and then stored in the position of the FCS. 11010011101100 000 <--- adding 3 bits at the end of the Data Sequence 01011 <--- factor 01100011101100 000 <--- XOR result 1011 <--- factor 00111011101100 000 101100010111101100 101100000001101100 101100000000110100 101100000000011000 101100000000001110 101100000000000101 101 1---------------00000000000000 100 <--- 3-bit remainder the above example uses 4-bit CRC. The factor used in Ethernet is 32 bits for better detection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.