Network Fundamentals: Ethernet Data Encapsulation

Source: Internet
Author: User

Data Link layer for Ethernet

At the data-link layer, Ethernet is responsible for Ethernet addressing, which is often referred to as hardware addressing or MAC addressing. Ethernet is also responsible for encapsulating packets from the network layer into frames.

Ethernet Addressing

Ethernet addressing uses the MAC (media access control) address that is cured in each Ethernet network card (NIC). The MAC (hardware) address is 48 bits long and in hexadecimal format.

OUI (organizationally unique Identifier, organization unique identifier) is assigned by the IEEE to the Organization (vendor), which contains 24 bits, and each network adapter that the organization gives it assigns a unique global management address that is 24 bits long. See you will find that the highest bit is the i/g (individual/group) bit: If its value is 0, we can assume that the corresponding address is the MAC address of a device, which is likely to appear in the source address portion of the MAC header, if its value is 1, we can assume that the corresponding address is either a broadcast address or a multicast address in Ethernet, or a broadcast address or function address in the token ring and FDDI.
Next is the G/L bit (global/current status, also known as u/l bit, where U represents Universal): If this bit is 0, then the corresponding address is the global address, assigned by IEEE, or 1, which means that the corresponding address is the local administrative address. In the Ethernet address, the right 24 bits are the local management (manufacturer assigned) encoding, which is typically set to 24 0 for a particular manufacturer when the first network adapter is produced, and then incremented to 24 1.

Ethernet Frame

The data link layer is responsible for merging bits into bytes and then encapsulating the bytes into frames. At the data link layer we use frames to encapsulate packets from the network layer for transmission over certain types of media.
The responsibility of the Ethernet workstations is to pass data frames to each other using the MAC frame format. It uses CRC (Cyclic redundancy check, cyclic redundancy check) to provide error detection, remembering that it is only detection, not error correction.
Describes the format of 802.3 frames and Ethernet frames:

Note: Using one frame to encapsulate another frame is called tunneling technology.

each field is described in detail below.
Preamble Code
alternating 0 and 1 provide a 5MHz clock signal at the beginning of each packet, allowing the receiving device to track incoming bitstream.
frame start position delimiter (SFD)/sync
The preamble is 7Byte, and SFD (synchronous) is 1Byte. The value of SFD is 10101011, where the last two 1 allows the receiver to recognize the intermediate 0 and 1 alternating modes, thus synchronizing and checking the beginning of the data.
Destination Address (DA)
contains a 48-bit value, and the LSB (Least significant bit, least significant bit) takes precedence. Whether the incoming packet is sent to a particular node according to the DA. The destination address can be a unicast address, broadcast address, or multicast MAC address. Broadcast addresses are all 1 (all f in hexadecimal format), broadcast to all devices, and multicast is sent only to a similar set of nodes in the network.
Source Address (SA)
The SA is a 48-bit MAC address that identifies the transport device and also uses the LSB precedence format. In the SA field, you cannot include a broadcast address or a multicast address.
length or type
802.3 frames Use the length field, while the Ethernet_II frame uses the Type field to identify the network layer protocol. 802.3 cannot identify upper-layer protocols and can only be used on private LANs, such as IPX.
Data
This is the frame that the network layer passes to the data link layer, and its length is 46-1500 Bytes.
frame Check Sequence (FCS)
FCS Field at the end of the frame used to store the CRC (Cyclic redundancy check, cyclic redundancy check) result. A CRC is a mathematical algorithm that runs when each frame is created. When a host receives a frame as a receiver and runs a CRC, the result must be the same, otherwise the receiver will think that an error has occurred, thereby discarding the frame.

Data Encapsulation

When a host transmits data to another device over the network, the data will go through encapsulation: each layer of the OSI model uses protocol information to wrap the data together. Each layer communicates only with the peer layer on the receiving device.
In order to communicate and exchange information, each layer uses the PDU (PROTOCAOL Data Unit, Protocol Unit). PDUs contain control information that is added to the data at each level. These control information is usually added to the header in front of the data field, but may also be added to the trailer.
Each layer of the OSI model encapsulates the data to form a PDU,PDU name that varies with the information provided by the header. The PDU information is read only at the peer layer of the receiving device, then stripped, and then the data is handed over to the next layer.
Displays the PDU for each layer and the control information added to each layer:

This diagram illustrates how to convert upper-level user data for transmission over the network. The data is then handed over to the transport layer, and the transport layer establishes the virtual circuit to the receiving device by sending a synchronization packet. Next, the data stream is split into small chunks, and the transport layer header is created and placed in the header in front of the data field, where the data block is called the data segment (a PDU). We can sort each piece of data to reorganize the data stream in the send order at the receiving end.
Next, each data segment is assigned to the network layer for addressing and routing in the internetwork. To get each piece of data to the correct network, use a logical address (such as an IP address). For data segments from the transport layer, the Network layer protocol adds a control header to it, resulting in a grouping or datagram. On the receiving host, the transport layer and the network layer work together to reconstruct the data stream, but they are not responsible for placing the PDU on the local network segment-This is the only way to transfer the information to the router or host.
The Data Link layer is responsible for receiving groupings from the network layer and placing them on a network medium (cable or wireless). The data link layer encapsulates each grouping into frames, where the frame header contains the hardware address of the source host. If the target device is in a remote network, the frame is sent to the router for routing in the internetwork. After reaching the target network, the new is being used to transfer packets to the target host.
to put a frame on a network, you must first convert it to a digital signal. Frames are logical groupings of 1 and 0, and the network layer is responsible for encoding these 0 and 1 into digital signals that are read by devices in the local network. The receiving device synchronizes the digital signal and extracts 1 and 0 (decoding) from it. Next, the device reorganizes the frame, runs the CRC, and compares the result to the value of the FCS field in the frame. If they are the same, the device extracts the groupings from the frame and discards the other parts, a process known as unpacking. The packet is handed over to the network layer, and the network layer checks the packet address. If the address matches, the data segment is extracted from the grouping, while the rest is discarded. The data segment is processed at the transport layer, and the latter is responsible for rebuilding the data stream, and then confirming to the sender that all the information was received by the receiving party. The transport layer then hands the traffic to the upper-level application.
on the sending side, the process of data encapsulation is roughly as follows:
1. The user information is converted to data for transmission over the network.
2. The data is converted to a data segment, and a reliable connection is established between the sending host and the receiving host.
3. The data segment is converted to a packet or datagram, and the connection address is added to the header so that it can be grouped in the middle of the internetwork.
4. The packet or datagram is converted to a frame for testing in the local network. The hardware (Ethernet) address is used to uniquely identify the host in the local network segment.
5. The frame is converted to bits and uses the data encoding method and the clock synchronization scheme.
explains the process of data encapsulation:

The transport layer uses the port number to identify the virtual circuit and the upper process, as shown in:

when using a connection-oriented protocol (that is, TCP), the transport layer transforms the data stream into a data segment and creates a virtual circuit to establish a reliable session. Next, it numbers each segment of data and uses confirmation and flow control. If you are using TCP, the virtual circuit will be identified by the source and destination IP addresses (called sockets) by the source port number and target port number. The host can only use port numbers that are not less than 1024. The target port number identifies the upper-level process (the application), and after the receiving host reliably rebuilds the data stream, the data stream is handed over to the process (application).
let's go back to the process of data encapsulation.
after the data block is added the transport Layer header information, the data segment is formed, and then the data segment and the destination IP address are handed over to the network layer. (The destination IP address is presented to the transport layer by the upper layer along with the data stream, and it is discovered by the upper layer using the name resolution method, possibly DNS.) )
The network layer adds headers and logical addresses (IP addresses) to the front of each data segment. After the header is added to the data segment, the PDU that is formed is grouped. The grouping contains a protocol field that indicates where the data segment came from (UDP or TCP) so that when the packet arrives at the receiving host, the transport layer can hand over the data segment to the correct protocol.
The Network layer is responsible for knowing the destination hardware address (which indicates where the packet should be sent to the local network), and for this purpose it uses ARP (address Resolution Protocol, addresses resolution Protocol). The network layer views the destination IP address and compares it to the host's IP address and subnet mask. If the comparison indicates that the packet is going to the local host, the ARP request is used to request the host's hardware address, and if the grouping is to the remote host, IP will learn the IP address of the default gateway (router).
Next, the network layer passes the packet down to the data link layer, along with the hardware address of the local host or default gateway. The data link layer adds a header in front of the packet so that the data block becomes true ( it is called a frame because it adds both a header and a trailer to the grouping, making it resemble a book file ). The frame contains an Ethernet type (ether-type) field that indicates which Network layer protocol the packet came from. The CRC check is now run against the frame, and the result is placed in the FCS field at the end of the frame.
at this point, the frame can be passed down to the network layer in a 1-bit way, and the network layer encodes the data into a digital signal using the bit-timing rule (bit timing rule). Each device in the network segment synchronizes the clock, extracting 1 and 0 from the digital signal, and rebuilding the frame. After the frame is rebuilt, the device runs the CRC to ensure that the frame is correct. If all goes well, the host will check the target MAC address and destination IP address to check if this frame is sent to it.

Network Fundamentals: Ethernet Data Encapsulation

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.