Get the App
SLTechnology News&Howtos  ›  Servers  › 

Encapsulation and unencapsulation

Shulou Source: shulou.com Published: 2022-06-02 23:47:06 10月03日 Update

Encapsulation and unencapsulation

Encapsulation: in the process of turning data into a bitstream, a specific protocol header action needs to be added to each layer of the reference model

Action: encapsulate from high layer to low layer, use a specific protocol at each layer, process the data, and add a specific protocol header in front of the data.

Encapsulation principles:

1: each layer adds a protocol header in front of the upper layer of data

2: the whole of the protocol header added is the PDU of this layer.

3: the PDU of each layer is the upper data for the next layer (the upper data of each layer is the PDU of the upper layer)

PDU (protocol data unit, that is, the data unit of each layer)

Application layer: APDU

Presentation layer: PPDU

Session layer: SPDU

Transport layer: segment (segment)

Network layer: packet (packet)

Data link layer: frame (frame)

Physical layer: bits (bit)

The encapsulation is sent by the sender, and the data can be sent only after it has been encapsulated.

* the host must know the destination IP address before encapsulating the packet, and the route to the destination network and the MAC address of the next hop before encapsulating the data frame.

Necessary parameters for encapsulation

Transport layer: source port number, destination port number

Network layer: source IP address destination IP address

Data link layer: source MAC address destination MAC address

De-encapsulation: the reverse process of encapsulation in which data is restored from a bit stream to data.

Action, unencapsulated in turn from the bottom to the upper layer, and the protocol header of that layer will be removed for each unencapsulated layer.

De-encapsulation principle:

1: must be unencapsulated from the bottom to the top

2: when unencapsulating, it can be unencapsulated only if the protocol header is reasonable (for example, you receive a package with your name and your home address on it, which is called reasonable for a long time).

3: once de-encapsulation stops, the data will be discarded

De-encapsulation is triggered by the receiver, and the data must be unencapsulated before it can be accepted.

The data link layer is divided into two sublayers:

LLC sublayer: logical link control sublayer-responsible for negotiating with the upper layer and using SAP to distinguish different upper layer protocols

MAC sublayer: media access control sublayer

The data link layer has FCS (frame check field) to check the integrity of the data.

The LLC sublayer provides a service access point (SAP) to identify upper layer protocols

1: each layer needs to communicate with the services of the lower layer

2: each layer needs to serve the upper layer, so you need to identify the protocols or applications used by the upper layer

Transport layer: use port numbers to identify upper applications

Network layer: use protocol numbers to identify upper applications

Tags: Encapsulation data upper layer address header link identity network application action slogan that is goal process high level transmission service principle only the bottom layer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Shulou Technology OPPO Reno Shulou Tech Info