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

Network foundation-data link layer

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

The data link layer performs two basic tasks:

Allow the upper layer to access the media using various technologies such as encapsulation into frames

Controls how data is placed on and received from the media using technologies such as media control access control (MAC) and error detection

The data link layer is responsible for exchanging frames between nodes through the media of the physical network. This includes the steps of encapsulating the layer 3 packet into a frame, placing the frame on the media, receiving the frame from the media, unencapsulating the frame, and restoring it to a packet.

Any packet sent to the network may be transmitted through different data link layer technologies and media. Therefore, packets are encapsulated into different frames as they pass through different media. For each hop in the path, usually a router, the frame is treated as follows:

Receive frames from the media

Decapsulate the frame to become a packet

Build a new frame suitable for the next medium

Forward the packet in the new frame to the next physical network segment

The process of creating a Fram

Frames are a key element of each data link layer protocol. The data link layer protocol needs control information to make the protocol work properly. Control information may provide the following information:

Which nodes are communicating with each other

The time at which communication begins and ends between nodes

What errors occurred during node communication

Then those nodes will participate in the communication.

The data link layer encapsulates packets into frames using headers and trailers to transmit packets over the local media.

Data link layer frames include the following elements:

Data-packets from the network layer

Frame header-contains control information (such as addressing information) and is at the beginning of the PDU

Trailer-contains control information added to the end of the PDU

Within the frame, each control field has a specific number of bits. The receiving node uses the data link layer framing technique to determine the bit packet of each field in the bit stream. As shown in the following figure, the control information is inserted into the header and trailer as different fields. This format enables physical information to have a structure that can be received by a node and decoded into a packet at the destination.

Typical field types include:

Start and stop indication fields-start and end limits for Fram

Addressing or naming fields-destination / source Devic

Type field-the type of PDU contained in the frame

Quality-Control Field

Data field-frame payload (network layer packet)

The field at the end of the frame forms the trailer. The purpose of these fields is to detect errors and mark the end of the frame.

Not all protocols contain all such fields. The standard of a specific data link layer protocol defines the actual frame format.

So far, the execution of OSI layers 3 to 7 that we have discussed is done in the software. The first layer is of course completed in hardware, especially the data link layer. As the middle layer between the software level and the physical communication process, it is divided into two sub-layers to support the operation of the actual network communication process.

The upper sublayer defines the software process to serve the network layer protocol.

The lower sublayer defines the media access process performed by the hardware

The two common LAN sublayers are:

The information put into the frame by logical Link Control (LLC) is used to determine the network layer protocol used by the frame, which allows multiple layer 3 protocols, such as IPv4 IPv6 and IPX, to use the same network interface and media

MAC provides data link layer addressing and data demarcation methods according to the physical signal requirements of the media and the type of data link layer protocol used.

Two common MAC (media access control methods) are:

Controlled access

Contention-based access

The following table describes the difference between the two

Method property sample controlled access

Token Ring FDDI is transmitted by only one site at a time

Sites that want to transmit must wait for their turn to be conflict-free. Some networks use token transmission methods based on contention-based access.

The station can transmit Ethernet wireless at any time.

There are conflicts and contention resolution mechanisms CSMA/CD for Ethernet and CSMA/CA for 802.11 wireless networks

Controlled access to shared media

When using controlled access to shared media, network devices access the media in turn, also known as periodic or deterministic access. If the device does not need to access the media, the opportunity to use the media is passed to the next device waiting to access the media. If the media places a frame on the media, other devices cannot place the frame on the media until the frame reaches its destination and is processed.

Although the controlled access to the shared media is orderly and provides predictable throughput, the determined method is too inefficient because each device must wait its turn to transmit frame information using the media.

Access to shared media based on contention

Contention-based access method, also known as non-deterministic access, allows any device to attempt to access shared media at any time. To prevent confusion on the media, these methods use the carrier sense multiple access (CSMA) process to first detect whether a signal is being transmitted on the media. If the media detects a carrier signal from another node, it indicates that another device is transmitting. If the device you are trying to transfer finds that the media is busy, it will wait and try again later. If no carrier signal is detected, the device will start transmitting the number. Ethernet and wireless networks use contention-based MAC.

The CSMA process can also fail, which can lead to conflicts if two devices are transmitted at the same time. If there is a conflict, the data sent by the two devices will be corrupted and need to be resent.

The contention media MAC does not have the overhead of controlled access because there is no mechanism to track which device is currently being accessed. However, the contention media can not expand well when the utilization rate is relatively high. With the increase of the utilization rate and number of nodes, the probability of successful access without conflict becomes smaller and smaller. In addition, because these conflicts reduce throughput, a recovery mechanism needs to be provided to correct errors.

CSMA is often used in conjunction with conflict resolution, and the two common conflict resolution methods are:

CSMA/CD conflict detection

CSMA/CA collision avoidance

In CSMA/CD, the device monitors the presence of a data signal in the media. If there is no signal, it means that the media is idle and the device can transmit data. If another device is subsequently detected as transmitting, all devices will stop sending and try again later. Traditional Ethernet is used in this way.

In CSMA/CA, the device checks for the presence of data signals in the media. If the media is idle, the device sends a notification over the media it wants to use. Then the device begins to transmit data. 802.11 wireless network is used in this way.

In a word, conflict detection is to find a solution to the problem after it occurs, while conflict avoidance is to provide guarantee for transmission in advance in the form of advance notice.

MAC without shared media

There is a special scenario in which in a point-to-point network topology, a node does not need to share media with other devices or determine whether the frame is sent to that node. So the data link layer protocol hardly needs to control non-shared media access for point-to-point transmission.

Network topology

Network topology refers to the interconnected layout relationship between network devices and them. We usually describe this relationship from two aspects: physical topology and logical topology.

A physical topology is the layout of the physical connections between nodes and them. Indicates that if media is used to interconnect devices, it is a physical topology.

Logical topology refers to the transmission of network frames from one node to another. This layout consists of virtual connections between network nodes, independent of the physical layout. These logical signal paths are defined according to the data link layer protocol. When controlling data access to the media, the data link layer "sees" the logical topology of the network. It is the logical topology that is encapsulated into frames and media control types of access control in the influencer network.

Several common network topology diagrams:

Focus on explaining the ring network topology:

In a logical ring topology, each node receives frames in turn. If the frame is not destined for that node, it passes the frame to the next node. This will allow the use of a media access control technique called token passing.

The node in the logical ring topology takes the frame from the ring, checks the address, and if it is not sent to that node, it puts the frame back on the ring. In the ring, the node of the ring between the source node and the destination node will check the frame for one week.

The encapsulated frame is the most important work of the data link layer, and the frame header contains the control information specified by the data link layer protocol for a specific network topology and media access. A typical frame header contains the following fields:

Frame start field-indicates the start position of the frame

Source and destination address fields

Priority / quality of Service field-indicates the special type of communication service to be processed

Type field-indicates the upper-layer services contained in the frame

Logical connection control field-used to establish a logical connection between nodes

Physical Link Control Field-used to establish media links

Flow Control Field-used to start and stop traffic through the media

Congestion Control Field-indicates congestion in the media

In the network layer protocol, we know that the network address of layer 3 remains the same in the process of routing, while the physical address of layer 2 is only used to transmit frames in the local network.

The role of the tail of the frame

Typical trailer fields include:

Frame check sequence-used to check the contents of the frame for errors

Stop field-used to indicate the end of the frame and to add content to small or fixed-size Fram

The function of the trailer is to determine whether the frame arrives without error. This process is called error detection. Error detection is achieved by placing a logical or mathematical summary of the bits that make up the frame into the end of the frame.

The frame check sequence (FCS) field is used to determine whether errors have occurred in the transmission and reception of the frame. Error detection is added to the data link because the data is transmitted through the media of that layer. For data, the medium is an unstable factor, and the signals on the media may be disturbed, lost, or damaged, thus changing the values of each bit of these signals. Most of the errors that have occurred can be identified by using the verification mechanism provided by the FCS field.

To ensure that the frame received at the destination node is consistent with the frame leaving the source node, the transmission node creates a logical summary of the frame content. It is known as the cyclic redundancy check CRC, and this value will be put into the frame check sequence FCS field of the frame to represent the content of the frame.

If the CRC generated by the initial node does not match the CRC calculated by the remote device that receives the data, it indicates that an error has occurred. When the frame arrives at the destination node, the receiving node calculates its own frame logical summary (CRC). The receiving node then compares the two CRC values. If the two values are the same, the frame is considered to have been delivered as it was sent. If the CRC value in the FCS field is different from the value calculated by the receiving node itself, the frame is discarded.

By comparing CRC, frame changes are detected, and CRC errors are usually caused by network noise or other errors in the data link. In Ethernet, the error may be due to a collision or transmission of corrupted data.

As we said earlier, the data link layer provides a transparent media transmission process for upper network communication, so different media transmission processes have different layer 2 protocols, and common layer 2 protocols are:

Ethernet

PPP

Advanced data Link Control (HDLC)

Frame Relay

ATM

Each protocol performs layer 2 media access control under a specific network topology.

The schematic diagram of the Ethernet frame is as follows:

Preamble-used for timing synchronization and also contains delimiters that mark the end of timing information

Destination address-48-bit destination node MAC address

Source address-48-bit source node MAC address

Type-indicates the type of upper layer protocol used to receive data after the Ethernet process is completed

Data or padding-PDU transmitted on the media, usually IPv4 packets

The frame check sequence FCS- is used to check the CRC value of damaged frames.

PPP in WAN

The Point-to-Point Protocol (PPP) is used to transfer frames between two nodes. The PPP standard is defined by RFC, which, unlike many data link layer protocols, is defined by electrical engineering organizations. PPP is a WAN protocol that can be implemented in many serial WAN. PPP is used in a variety of physical media, including twisted pair, optical cable, satellite transmission and virtual connections.

PPP adopts a hierarchical architecture. In order to meet the requirements of various media types, PPP establishes a logical connection called a session between two nodes. The PPP session hides the underlying physical media from the upper PPP protocol. These sessions also provide PPP with a method for encapsulating multiple protocols on a point-to-point link. Each protocol encapsulated on the link establishes its own PPP session.

PPP also allows two nodes to negotiate options in a PPP session:

Authentication-to establish point-to-point link communication, each end node of the PPP link requires PPP authentication

Compression-PPP compression reduces the size of data frames transmitted over network links. This can reduce the network transmission time.

Multilink-PPP multilink is a method of sending data frames using multiple links. This allows a single PPP session to be supported using multiple physical links

The following figure shows the basic fields of the PPP frame:

Flag-A byte that represents the beginning and end of the frame. Flag field includes binary sequence 01111110

Address-contains one byte of the standard PPP broadcast address. PPP does not assign a separate site address

Control-contains binary sequence 00000011, requiring data to be transmitted in unsorted frames

Protocol-two bytes that mark the protocol encapsulated in the data field in the frame. The latest value of the protocol field is specified in the RFC

Data-0 or more bytes containing datagrams for the protocol specified in the protocol field

Frame check sequence-usually 16 bits, agreed in advance that 32-bit FCE can be used in PPP implementation, thus providing error detection capability

LAN's wireless protocol:

802.11 is an extension of the 802 standard. It uses the same 802.2LLC and 48-bit addressing scheme as 802LAN. However, there are many differences between the MAC sublayer and the physical layer. In a wireless environment, some special factors need to be considered. Because there is no definite physical connectivity, external factors may interfere with data transmission and make access control difficult. In order to solve these problems, additional control functions are developed in the wireless standard.

The IEEE 802.11 standard, commonly known as Wi-Fi, is a contention system that uses CSMA/CA media access routines. CSMA/CA specifies a random fallback procedure for all nodes waiting for transmission. The time when media contention is most likely to occur is after the media becomes available, making the node back randomly for a period of time can greatly reduce the possibility of collision.

The 802.11 network also uses data link acknowledgement to determine that the frame has been successfully received. If the sending station does not detect an acknowledgement frame, the reason may be that the original data frame received or the acknowledgment is incomplete, the frame is retransmitted. This clear confirmation can overcome interference and other radio-related problems.

Other services supported in 802.11 are authentication, association (connectivity to wireless devices), and privacy (encryption)

The following figure briefly describes the frame structure in the following 802.11:

Sequence control structure:

Specific information in frame control:

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

Network Security

Wechat

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

12
Report