Ethernet Data format and encapsulation--Ethernet Fundamentals 02

Source: Internet
Author: User


In the previous article we introduced the Ethernet 5 layer model, which I want to learn about the encapsulation and unpacking of Ethernet data, and how Ethernet data is transmitted. First, data encapsulation
      when our application uses TCP to transmit data, the data is fed into the protocol stack, then passes through each layer one by one, knowing that the final to the physical layer of data is converted into a bit stream and sent to the network. And in this process, each layer will add some header information to the data to be sent.。 The whole process is like.



    As can be seen, each layer of data is composed of the previous layer of data + this layer header information, each layer of data, known as the Protocol Data unit of this layer, the PDU.    ApplicationThe PDU that the layer data obtains after adding the TCP header to the transport layer is called Segment (data segment), which is shown as a TCP segment    data from the Transport Layer (TCP segment) is transmittedto the network layer, the network layer adds IP header to get the PDU is called packet (packet); the IP packet    Network LayerDatagrams (IP packets) are passed to the data link layer, and the PDU that encapsulates the data link layer header is called FRAME (data frame) and is shown as an Ethernet frame.        Finally, the frame is converted to bits and transmitted over the network media. This protocol stack passes the data down by layer, and the process of adding a header and a trailer is called encapsulation. Second, the data formatIt is important to note that the Ethernet frames mentioned here are not the same as what we often say about Ethernet. Let's introduce the header information for each layer of data.
first of all, we know that there is an association in the world called the IEEE, the Association of Electronic Engineers, which has a branch, called the IEEE802 Committee, is dedicated to the development of local area network standards. And 802 There is a division, called 802.3. That's what we often refer to as the IEEE802.3, which is a specification called the Ethernet specification, which defines the Ethernet header mentioned above, the Ethernet specification , Only the MAC layer and the physical layer specification in the data link layer are actually defined. (Note that the data link layer includes two sub-layers of the Mac Sublayer and the LLC Sublayer, while the LLC sublayer is regulated in IEEE802.2). 1. Ethernet Frame Format    There are two common frame formats for Ethernet,One is Ethernet II and the other is the IEEE 802.3 format. The two format differences are: Ethernet II contains a Type field. In the IEEE 802.3 format, this location is the length field. Where the Type field describes the types of packets that are followed by the Ethernet header, such as the IP protocol package when type 0x8000, and the type 8060, followed by the ARP protocol package. Most data frames in Ethernet use aEthernet II frame format.     A,Ethernet II Frame format



BIEEE 802.3 Frame Format
    
Preamble Code:Ethernet II is made up of8 x 8 ' b10101010 composition,IEEE802.3 consists of 78 ' b10101010+1 bytes of sfd .Destination Address: The Mac Physical address of the destination device.
Source Address: The physical address of the Mac of the sending device.
TypeEthernet II):The type of packet followed by the Ethernet header, such as the IP protocol package when type 0x8000, is 8060, followed by the ARP protocol package. Length (IEEE802.3): When the length is less than 1500, it indicates that the frame isIEEE802.3 frame format, greater than 1500, indicates that the frame isEthernet II frame format. data: Minimum data length is 46 bytes, less than 46 bytes, padding to 46 bytes. Because the minimum frame length is 64 bytes, 46+6+6+2+4=64. (Does not count preamble)FCS: is the CRC check value

The Ethernet header is:
2. IP packet Format
The IP packet format is as follows. The IP header also shows up.


3. TCP Data Segment format        for TCP header and TCP data segment formats
Here are a few more common data formats
4. UDP data Segment format--Transport layer
        where the UDP header is shown. 5. ARP packet format (excerpt from: Source: http://blog.sina.com.cn/s/blog_9c5d29f70101dwgk.html)


(1) The Hardware Type field indicates the type of hardware interface that the sender wants to know, and the value of Ethernet is 1;

(2) The Protocol Type field indicates the type of high-level protocol provided by the sender, andIP is 0800(System);

( 3 ) hardware address length and protocol length indicate the hardware address and the length of the High-level protocol address, so arp messages can be used on any hardware and any protocol network;

( 4 ) the Action field is used to denote the type of the message, arp request is 1 , arp response is 2 , rarp request is 3 , rarp response is 4 ;

(5) The sender's hardware address (0-3 bytes): The first 3 bytes of the source host hardware address;

(6) The sender's hardware address (4-5 bytes): The first 3 bytes of the source host hardware address;

( 7 ) Sender ip ( 0-1 bytes): The source host hardware address of the former 2 bytes;

( 8 ) Sender ip ( 2-3 bytes): The source host hardware address after 2 bytes;

(9) Destination hardware address (0-1 bytes): The first 2 bytes of the destination host hardware address;

(x) Destination hardware address (2-5 bytes): The destination host hardware address after 4 bytes;

(one) destination IP(0-3 bytes): The IP address of the destination host.


Ethernet Data format and encapsulation--Ethernet Fundamentals 02

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.