Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Several protocols of data Link layer

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Computer network is becoming more and more important in daily life, so it is very necessary for us to learn network knowledge. Network communication is divided into learning and research convenience is divided into five layers, namely: physical layer, data link layer, network layer, transport layer, application layer.

In the data link layer is mainly responsible for data transmission, there are many protocols, the most commonly used is the Ethernet protocol in the local area network, and the PPP protocol and HDLC protocol in the wide area network.

Etherne II

Header 8 destination address 6 source address 6 etheric type 2 payload 46mi 1500 frame check sequence 4

Header: 8 bytes, the first seven zero zero 1 alternating bytes (10101010) are used to synchronize the receiving station, and a 1010101011 byte indicates the starting position of the frame. The header provides receiver synchronization and frame demarcation services.

Destination address: 6 bytes, unicast, multicast or broadcast. A unicast address is also called a personal, physical, hardware, or MAC address. The broadcast address is all 1B0xFF FF FF FF.

Source address: 6 bytes. Indicates the unicast address of the sending node.

Ethernet type: 2 bytes, used to indicate the upper layer protocols contained in the Ethernet frame. That is, the protocol identifier in frame format. For IP messages, the field value is 0x0800. For ARP information, the value of the etheric type field is 0x0806.

Payload: consists of a protocol data unit PDU of the upper layer protocol. The maximum payload that can be sent is 1500 bytes. Due to the collision detection feature of Ethernet, the payload is at least 46 bytes. If the upper layer protocol data unit length is less than 46 bytes, it must be added to 46 bytes.

Frame check sequence: 4 bytes. Verify bit integrity.

HDLC frame format

Segmentation of frame information

One frame of SDLC/HDLC information includes the following fields (Field), all of which are transmitted from the least significant bits.

1. SDLC/HDLC flag character

The SDLC/HDLC protocol stipulates that all information transmission must begin with a flag character and end with the same character. The flag character is 01111110, which is called sign field (F). A complete unit of information is formed from the start flag to the end flag, called a frame (Frame). All information is transmitted in the form of frames, and flag characters provide the boundary of each frame. The receiver can establish frame synchronization by searching for "01111110" to find out the beginning and end of the frame.

The PPP protocol has three components:

(1) A method for encapsulating IP datagrams to a serial link. PPP supports both asynchronous links (8-bit data without parity) and bit-oriented synchronous links.

(2) A link control protocol LCP (Link Control Protocol) for establishing, configuring, and testing data links. The two sides of the communication can negotiate some options. Eleven types of LCP grouping are defined in [RFC 1661].

(3) A set of network control protocol NCP (Network Control Protocol), which supports different network layer protocols, such as IP, OSI network layer, DECnet, AppleTalk and so on.

II. PPP frame format

The PPP frame format is similar to the HDLC frame format, as shown in figure 1. The main difference between the two: PPP is character-oriented while HDLC is bit-oriented.

Figure 1 PPP frame format

As you can see, the first three fields and the last two fields of the PPP frame are in the same format as HDLC. Flag field F is 0x7E (0x for 7e), but address field An and control field C are fixed, 0xFF and 0x03, respectively. The PPP protocol is not bit-oriented, so all PPP frame lengths are integer bytes.

Unlike HDLC, there is an extra 2 bytes of protocol fields. If the protocol field is different, the subsequent information field type is different. Such as:

0x0021muri-Information field is IP Datagram

0xC021 color-the information field is the link control data LCP

0x8021 color-information field is the network control data NCP

0xC023While-the information field is the security authentication PAP

0xC025 color-the information field is LQR

0xC223While-the information field is the security authentication CHAP

When the same bit 0x7E as the flag field appears in the information field, some measures must be taken. Because the PPP protocol is character-oriented, it cannot use the zero-bit insertion method used by HDLC, but uses a special character fill. The specific way to do this is to convert each 0x7E byte that appears in the information field into a 2-byte sequence (0x7Dre0x5e). If a byte of 0x7D appears in the information field, it is converted into a 2-byte sequence (0x7D, 0x5D). If the control character of the ASCII code appears in the information field, a 0x7D byte is added before the character. The purpose of this is to prevent these ostensibly ASCII control characters from being misinterpreted as control characters.

Third, the working process of PPP link

When the user dials into the ISP, the router's modem answers the dialing and establishes a physical connection. At this time, the PC sends a series of LCP packets (encapsulated into multiple PPP frames) to the router. These packets and their responses select some PPP parameters to be used, and then the network layer is cultivated, and the NCP assigns a temporary IP address to the newly connected PC, so that the PC becomes the host on the Internet.

When the user communication is finished, the NCP releases the network layer connection and reclaims the original assigned IP address. Then LCP releases the data link layer connection, and finally the physical layer connection.

The above process can be described in figure 2.

Fig. 2 PPP protocol process state diagram

When the line is at rest, there is no physical layer connection. When the carrier signal of the modem is detected and the physical layer connection is established, the line enters the established state, and LCP begins to negotiate some options. Enter the authentication state after the negotiation is over. If the identity of both sides of the communication is successful, it will enter the network state. NCP configures the network rub, assigns an IP address, and then enters the open state for data communication. When the data transfer is finished, it goes to the terminated state. After the carrier stops, it returns to the static state.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report