Computer network--Data Link layer (PPP)

Source: Internet
Author: User
Tags control characters

There are two main types of channels used by the data link layer:
(1) Point-to-point channel
(2) Broadcast channel

Data link layer using point-to-point channel

It's not the same thing to be clear about "link" and "Data Link" first.
A link refers to a physical line from a node to an adjacent node, without any other exchange nodes in the middle.
In addition to having a physical circuit, the data link must have some necessary communication protocols to control the transmission of the data. If the hardware and software of these protocols are added to the link, the data link is formed.
Protocol data Unit for the data link layer of the point-to-point channel is a frame

The main steps of the data link layer of the point-to-point channel when communicating:
(1) The Data Link layer of Node A adds the header and trailer to the IP datagram that is delivered by the network layer into frames.
(2) Node A sends the encapsulated frame to the data link layer of Node B.
(3) If the data link layer of Node B receives the frame error-free, then extracts the IP datagram from the received frame to the above network layer; otherwise discards the frame.

Three basic questions encapsulated into frames

Encapsulating Frames is the addition of headers and tails before and after a piece of data. Once the receiver receives a bit stream from the physical layer, it is able to identify the beginning and end of the frame from the received bit stream based on the header and tail markings.
The length of a frame is equal to the length of the frame's data portion plus the frame header and frame trailer length.
Each link-layer protocol specifies the maximum length of the data portion of the frame that can be transmitted-the MTU of the largest transmission unit.

Transparent transmission

Because the start and end tags of a frame are marked with a specially specified control character (SOT and EOT), any combination of 8 bits in the transmitted data must not be allowed and used as the control character of the frame delimitation, or there will be a frame-bound error.
In order to solve the problem of transparent transmission, we must try to make the control characters that may appear in the data not be interpreted as control characters on the receiving side. The method is: the data link layer of the sending end inserts an escape character (ESC) before the control character appears in the data. The data link layer at the receiving end removes the inserted escape character before sending the data to the network layer.

Error detection

BITS may cause errors during transmission.
Over a period of time, the ratio of transmission errors to the total number of transmitted bits is called ber ber. In order to ensure the reliability of data, it is necessary to use various error detection measures when transmitting data in computer. cyclic redundancy Detection CRC is widely used in the data link layer at present
m long data, n-bit redundant code calculation:
The binary modulo 2 (no carry addition) operation is used to 2^n multiply M, which is equivalent to adding n 0 after M. The number of the obtained (K+N) bits divided by the pre-agreed length (n+1) of the sending and receiving parties is p, which concludes that the quotient is Q and the remainder is R. This remainder R is sent out behind the data m as a redundant code stitching.
The receiving end of the received data in the frame of the CRC test: the received each frame divided by the same divisor p (modulo 2 operation), and then check to get the remainder p.
If the transmission is error-free, then the remainder R obtained after the CRC test must be 0.

Note: We do not now require the data link layer to provide reliable transport services to the network layer.

Point-to-Point Protocol PPP

There are three components of the PPP protocol
(1) A method that encapsulates an IP datagram to a serial link.
(2) A Link Control protocol LCPused to establish, configure, and test the data link connection.
(3) A set of Network Control Protocol NCP, in which each protocol supports different network layer protocols.

Frame format for PPP protocol

The header and tail of the PPP frame are four fields and two fields respectively.
The first field and the trailing second field are the Flag field F (flag), which is specified as "0x7E". Flag the start or end of a frame. So the flag field is the delimiter for the PPP frame.
Only one flag field is required between two frames in a row. If two consecutive flag fields appear, this is an empty frame and should be discarded.
The second field, a in the header, stipulates that the third field C of "0xFF" is defined as "0x03" and meaningless.
The PPP header fourth field is a 2-byte protocol field.
Definitions published by the IANA website:
Http://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml#ppp-numbers-2

RFC1662 Specifies the following fill method:
(1) Convert each 0x7e byte that appears in the Information field to a 2-byte sequence (0x7d,0x5e)
(2) If a 0x7d byte appears in the Information field (i.e., a bit combination with the same escape character), the 0x7d is converted to a 2-byte sequence (0x7d,0x5d)
(3) If the control character of the ASCII code appears in the Information field (that is, the value is less than 0x20), then the 0x7d is added, and the encoding of the character is changed.

0-bit padding (solution for asynchronous transmissions)
On the sending side, the entire information field is scanned first, and as long as 5 consecutive 1 are found, fill in a 0 immediately. Therefore, after 0 bits of data are populated, it is guaranteed that there will be no 6 consecutive 1 in the Information field.

Working status of PPP protocol

The starting and terminating state of a PPP link is always a " link-static " state.
When the user's PC calls the router through the modem, the router detects the carrier signal from the modem, and after the physical layer link is established, PPP enters the " Link Establishment " state, which is designed to establish the LCP connection of the link layer.
LCP begins to negotiate configuration options , that is, to send LCP configuration request frames. Its Protocol field is set to the code corresponding to the LCP, and the information field contains the specific configuration request.
After the negotiation, the two sides established LCP link and entered the " identification " status. Only the packet of LCP protocol and the grouping of authentication protocols are allowed. If authentication fails, it goes to the " link termination " state and, if successful, enters the " Network layer protocol " status.
The network control protocol NCP at both ends of the PPP link exchanges network Layer-specific network control groupings based on the different protocols of the network layer.
When the network layer is configured, the link enters a " link-open " state that can be used for data communication.
At the end of the data transfer, a termination request can be made by one end of the link LCP group.

Computer network--Data Link layer (PPP)

Related Article

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.