Network Technology-Data encapsulation

Source: Internet
Author: User

Data encapsulation

When a host transmits data across networks to other devices, the data is encapsulated by adding protocol information to each layer of the OSI model. Each layer only communicates with the peer layer on the receiving device.
Each layer uses Protocol Data Units (PDUS) for communication and information exchange ). At each layer of the model, these PDU containing control information are appended to the data. They are usually appended to the header of the data field, but they can also be appended to the end of the data field.
In each layer of the OSI model, each PDU is appended to the data through encapsulation, and each PDU ~ G has a specific name, which depends on the information provided in each header. This PDU information can only be read by the peer layer of the receiver device. After reading the PDU, the header is stripped and the data is handed over to the previous layer.
Figure 1.23 shows the PDU and how the PDU attaches control information to each layer. This figure shows how upper-layer user data is converted for transmission over the network. The data stream is then sent to the transmission layer. By sending the synchronization package, the transmission layer can establish a virtual circuit to the receiver device. The data stream is then divided into smaller blocks, a transport layer header (a pdu) is created based on the protocol, and then appended to the header of the data field. Currently, such data blocks are called data segments. Each data segment needs to be sorted so that the data stream can be accurately reproduced on the receiver, in exactly the same order as it was sent.
Each data segment is then handed over to the network layer for network addressing and route selection through the interconnected network. At the network layer, each data segment is sent to the correct network using logical addressing (such as IP. The Network Layer Protocol adds a control header to the data segment from the transport layer. The obtained data block is called a data packet or a data packet. Remember, the transport layer and the network layer work together to build data streams in the receiver host, it is similar that they place their PDUS on a primary network segment. This is the only method to obtain information about routers or hosts.
Figure 1.23 Data encapsulation

The data link layer receives data packets from the network layer and places them on the network medium (wired or wireless. The data link layer encapsulates each packet into a frame. The frame header contains the hardware addresses of the source and target hosts. If the target device is in a remote network, the frame is sent to the vro for transmission to the destination through the interconnected network. Once it reaches the destination network, a new frame is used to send data packets to the destination host.
To send a frame to the network, it must first be converted into a digital signal. Frames are actually logical groups of L and 0. The physical layer is responsible for encapsulating these values into digital signals, which can be directly transmitted in the same local network. The receiver device synchronizes the digital signal and extracts 1 and 0 from the digital signal. Then, the device can construct frames and execute cyclic redundancy check (CRC ), check whether the data is transmitted correctly based on the results in the frame's FCS field. If they match, the packet is taken from the frame and the rest is discarded. This process is called solution encapsulation. The packet is sent to the network layer. Check the address here. If the address matches, the data segment is extracted from the data packet and the rest is discarded. The data segment is processed at the transport layer. Here, the data stream is rebuilt and confirmed to the sender site that it has received
Each data block. It then sends data streams to high-level applications.
In the sender device, the Data encapsulation process is as follows:
1. User information is converted to data for transmission over the network.
2. Data is converted to data segments, and a reliable connection is established between the sender and the receiver host.
3. The data segment is converted into a data packet or a data packet and placed with a logical address in the header. In this way, each data packet can be transmitted through the Internet.
4. data packets or data packets are converted to frames for transmission over the local network. The hardware (Ethernet) Address uniquely identifies each host on the ingress network segment.
5. the frame is converted into a bit stream and uses digital encoding and clock schemes.
The hierarchical addressing concept is explained in detail in Figure 1.24.
Remember that data streams are sent from the top layer to the transport layer. As a technician, we do not need to worry about where the data flow comes from, because it is a programmer's concern. Our job is to reliably rebuild the data stream and send it to the high-level receiver device.


Figure 1.24 PDU and hierarchical addressing

Before further discussing figure 1.24, we will first discuss the concept of port numbers. please be sure to understand these concepts. The transport layer uses port numbers to define virtual circuits and upper-layer processes, as shown in Figure 1.25.
The Transport Layer receives data streams, combines them into segments, and creates virtual circuits to establish reliable sessions. It then sorts each end (number) and uses validation and traffic control. If you are ~ TCP: virtual circuits are defined by the source port number. Remember, the source port number of the host is allocated from 1024 (from O to 1023 is reserved for the well-known port ). When the data stream is reliably rebuilt in the receiver host, the destination port number defines the upper-layer process (Application) for receiving the data stream ).
Now that we understand the concept of port numbers and how they are used in the transport layer, let's go back to figure 1.24. Once the header information of the transport layer is added to the data sheet, it becomes a data segment and is handed over to the network layer. The destination IP address is delivered together with the data stream (the destination IP address is transferred from the upper layer to the transport layer along with the data stream, it is found through a high-level name resolution method, which may be DNS ).
The network layer adds a header before each data segment and a logical address (IP address ). There are also protocol fields in the data packet to describe where the data comes from (that is, the type of the Upper-layer protocol, which may be UDP or TCP) -- You can also think of it as "who owns this data segment". When a data packet arrives at the receiver host, this will make the network layer send the data segment to the correct transport layer protocol. It also has a protocol field (UDP or TCP) that describes where the data comes from. Therefore, when the data packet arrives at the receiver host, the data can be handed over to the correct transport layer protocol. The network layer is responsible for finding the destination hardware address, which indicates which host the packets will be sent. You can achieve this by using the Address Resolution Protocol (ARP. The Address Resolution Protocol is described in Chapter 1. The IP protocol at the network layer will view the destination IP address and compare it with its own source ID address and subnet mask. For a local network request, the hardware address of the local host is obtained through the ARP request. If the data packet is sent to the remote host, the IP address of the default gateway (vro) is obtained through the IP protocol. J
Then, the data packet is sent to the data link layer together with the destination hardware address of the local host or the default gateway. The data link layer will add a header before the data packet and add other data to convert the data packet into a frame (we call it a frame because the header and the end of the packet are added to the data packet, this makes the data like a book block or frame), and all this is 1.24. The Ether-Type field is used to describe which protocol of the packet comes from the network layer. Now, for frame cyclic redundancy check (CRC), the result of running CRC is placed in the "frame verification sequence (FCS)" field in the frame, that is, the frame returns to the end.

Figure 1.25 transport layer port number
Now, the frame can be delivered to the physical layer. One bit at a time. Here, the bit timing rule is used to encode the data in the digital signal. Each device in the CIDR Block synchronizes with the clock and extracts l and l from the digital signal. To build a frame. After recreating a frame, run CRC to ensure that the frame is correct. If everything works, the host checks the destination address to see if the frames are for them.
Do not worry if you are confused about everything described above. In Chapter 5th, we will carefully discuss how data is encapsulated and forwarded in an interconnected network.

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.