Data link layer service

Source: Internet
Author: User

The service link layer of the data link layer is the lowest layer of the protocol stack. It is used to transmit network layer datagram to a node through a single link node in the path, different links on the path may have different link layer protocols. Link Layer channels include broadcast channels and point-to-point channels. For broadcast channels, due to the fact that many hosts are connected to the same communication channel, media access protocols are required to coordinate transmission and avoid conflicts. 1. The data unit for service link layer protocol exchange provided by the link layer is called a frame. Each link layer frame usually encapsulates a network layer packet. In order to send data packets from the source host to the target host, data packets must be transmitted on each link end-to-end. When a specific link is used, the transmission node encapsulates the data in the link layer frame, and then sends the frame to the link. The receiving node receives the frame and retrieves the data. Services provided by the link layer may include frame forming: encapsulating network layer data into link layer frames. Each link layer protocol has a corresponding protocol that defines its address format and its allocation method. Link Access: The Media Access Protocol specifies the rules for frame transmission on the link. Reliable delivery: When the Link Layer Protocol provides a reliable delivery service, it must ensure that no error is transmitted through the link layer for each network layer datagram. Reliable link layer delivery is often used for links that are prone to high error rates (such as wireless access). The purpose of reliable link layer delivery is to correct an error rather than performing a retransmission by a high-level protocol. Traffic control: each node of the link has a limited capacity of frame caching. traffic control is used to prevent sending nodes at one end of the link from flooding the receiving nodes at the other end. Error Detection: used to detect bits in frames and correct errors: it is similar to error detection. The difference is that it not only checks whether errors exist in frames, but also determines which bits are wrong. Half duplex and full duplex: In full duplex mode, both ends of the link can be transmitted at the same time, but in half duplex mode, no. The link layer functions by combining software and hardware. Software completion: the sender receives the datagram from the network layer, assembles the link layer address information, and activates the hardware controller to trigger the sender. The receiver responds to the hardware controller and handles errors, sending a datagram to the network layer link layer does not provide services to ensure data security. II. The most basic problem in the error detection and Error Correction Technology Network is that the receiver must be sure that the data it receives is the raw data sent without errors. To ensure this, an error detection mechanism is required to detect whether an error has occurred. There are three types of techniques for detecting errors in transmitted data: parity: an additional bit is used to enable the entire bit string to contain an even (even verification) or an odd (odd verification) bit 1. It is the basis for error detection box error correction. Test: The data is considered as a bits stream of n bits. an n-bit value is obtained after each unit is added. This value is used as an error detection bit. Take two bytes (16 bits) on the Internet. The transport layer uses this technology to detect errors. Cyclic Redundancy Detection: Also known as CRC detection. Each CRC standard can detect sudden errors smaller than r + 1 bits (For details, refer to CRC details ). This technology is more complex and used at the link layer, implemented by hardware. 3. Multi-Channel Access Protocol broadcast channels are common channels. When a broadcast channel is uploaded or transmitted, each node of the shared channel receives a copy. Because the broadcast channel is a shared channel, a technology is required to coordinate the access of multiple senders and receivers to one shared broadcast channel. The multi-channel access protocol is used for this purpose. There are many multi-channel access protocols, but they can be divided into three types: Channel Division protocol Random Access Protocol rotation Protocol 1. channel Division protocol channel division protocol includes: time division multiplexing TDM: it divides time into time frames and further divides time frames into N time slots, then, assign N time slots to each of the N nodes. Frequency Division Multiplexing: frequency division multiplexing is similar to time division multiplexing, but it is divided into frequency bands. Code Division Multiple Access (CDMA): Both TDM and OFDM can avoid collision and divide the bandwidth fairly among N nodes. However, each node can only use the bandwidth/N, so the efficiency is not high. CDMA assigns a different encoding for each node, and then each node uses its unique encoding to send data. If the encoding is carefully selected, the CDMA network allows different nodes to transmit at the same time. 2. in the Random Access Protocol, each transmission node is always sent at the same rate. When there is a collision, each node involved in the collision repeatedly resends its frame, the frame remains unchanged. However, when a node experiences a collision, it does not resend immediately, but waits for a random latency before the resend. Each node involved in a collision has an independent random latency. CSMA/CD protocol is an important common random access protocol. It works in the following way: a node listens to the channel before transmission. If frames from other nodes are being sent over the channel, then the node waits for a random period of time and then listens on the channel. If the listening channel is idle, the node starts frame transmission, which becomes CSMA (the carrier listens on multiple accesses ). The node will always listen on the channel during transmission. If it detects that another node is being transmitted, it will stop the transmission and use a protocol to determine when it should try the next transmission, this part of work is called CD (collison detection ). In this mode, the participants are all gentlemen and will only be used when no one is using the channel. If the user is also using the channel, the user will stop using it, this reduces the time spent on data that has been damaged by the channel. Therefore, this mode can improve the efficiency of the channel. 3. The rotation protocol has two working modes: polling protocol and Token transfer protocol. Polling Protocol: one node is specified as the master node. It polls each node and assigns them a bandwidth token Transfer Protocol. A special destination frame called a token is exchanged between nodes in a certain order, when the node receives the frame and has a frame to be sent, it holds the token; otherwise, it passes the token to the next node. 4. Link Layer addressing LAN (LAN) widely uses broadcast channels and multi-channel access protocols. When a datagram is transmitted in a link, its source address and destination address are specified by the link layer address. The link layer address is also known as the MAC address and the physical address. It is closely connected with the network adapter. For most LANs, the MAC address is 6 bytes in length. MAC addresses are managed and allocated by IEEE. The adapter producer buys an address block from the IEEE and sets an address of his own to the adapter. When the adapter sends a message to another adapter, it sets its MAC address as the link layer source address and the destination adapter address as the link layer destination address. There are three types of MAC addresses: unicast addresses: identifies a node multicast address: identifies a group of nodes broadcast addresses: identifies all nodes in the LAN physically, the network adapter can receive packets from the connected line, but whether or not to receive the packets depends on the link layer address of the packets and the working mode of the network adapter: if the network adapter works in the hybrid mode, then it receives all packets on the line. If the network adapter works in non-hybrid mode, it only receives packets (including unicast addresses, in a sense, link layer addresses are used to identify a network device on the road (further, to identify a device that owns the network adapter ), therefore, it is only effective in the local area (that is, the line range, or more accurately within a subnet. For example, you have two computers, one in Beijing, the other in Wuhan, and the other in MAC address, however, you cannot directly use the MAC address to allow communication between the two computers. Therefore, the link layer address works in a local range and is only valid locally. Further, after the link layer is available, you can build a network that can work in a local range. Within this network, devices can communicate with each other through the MAC address of the network adapter, however, the link layer only provides limited services, and the link layer is closely related to hardware, that is, the adapter. Therefore, to directly use this layer, a large amount of hardware-related details need to be processed, therefore, even in a local network, the link layer is not directly used for communication. 5. Ethernet is the most common communication protocol standard adopted by the existing LAN. It provides non-connection and unreliable services through the upstream protocol. When a packet needs to be sent, it encapsulates the packet in the Ethernet frame and sends it out. No matter whether the receiving end correctly receives the packet, the sender will not receive any notification, therefore, it provides a connectionless and unreliable service. 1. ethernet frame format 7-byte sequence 1-byte frame start character (SFD) 6-byte destination address 6-byte source address length/type field data field (minimum 46 bytes) fill fields with 4-byte data check and extended fields. This part mainly provides information for synchronization by the receiver, the value of 10 in 7 bytes is 10101011, which indicates whether the first byte of the starting destination address of the frame is used to indicate whether the destination address is an individual address or a family address 0 indicates an individual address, the second-to-last digit is used to specify whether the local address or the external address 0 represents the external address (when the address field is transmitted at the low position of each byte). If the value of this field is smaller than or equal to the maximum valid frame length, then it records the length of the data in the following data field, if it is greater than or equal to 1536, it specifies the protocol type filling Field of the MAC frame to ensure that the minimum frame length of the Data part meets the previous network requirements, and is used to check whether the data is transmitted incorrectly, it includes all fields from the target address to the filled field. The value of this field should be easily separated from the data, and her length ranges from 0-slotTime-minFrameSize (only valid for Half Duplex of m. CSMA/CD Ethernet adopts a bus-type network topology. As long as a computer sends data on the bus, the bus resources are occupied. Therefore, the work of the computer on the bus must be coordinated. CSMA/CD is used in Ethernet to solve this problem, that is, multi-point access/collision detection for carrier monitoring. Multi-Point Access: it refers to a bus-type network. Many computers connect to a bus through multi-point access. The essence of the Protocol is "carrier monitoring" and "collision detection ". Carrier listener: before sending data, each site must first check whether other computers on the bus are sending data. If so, do not send data temporarily to avoid collision. In fact, because the Ethernet Standard specifies that the data sent by the computer uses the Manchester encoded signal, there is no carrier on the bus, and the carrier listens to whether there is any data signal sent by other computers on the bus. Collision Detection: The computer sends data while detecting the signal voltage on the channel. When several stations send data on the bus at the same time, the voltage swing value on the bus will increase. When the signal voltage swing detected by a site exceeds the threshold, it is deemed that at least two sites on the bus are sending data at the same time, and a collision is sent, once a site discovers a collision on the bus, it must immediately stop sending. CSMA/CD algorithm: (1) Listen to the bus and check whether other nodes are sending (detect the carrier signal ). If a node is being sent, the listener continues until the channel is idle. (2) If no signal is detected, send the message. (3) continue to listen on the bus when sending the message. If the conflict is detected (4), otherwise the transmission of a frame is completed (4) the transmission congestion sequence (in the form of undefined) warning All nodes have detected a collision to ensure that all devices in the network stop sending. Turn (5) (5) Wait for a random period of time and start again from the first step. In the event of a conflict, Ethernet adopts the truncation Binary Index type Backoff Algorithm for backoff. A simple description of this algorithm is as follows: (1) determine the basic backoff time. Generally, the parameter k is defined as the contention period (2). It is equal to the number of retransmissions, but k cannot exceed 10, therefore, k = Min [retransmission times, 10]. (3) from a discrete Integer Set [0, 1 ,......, (2k-1)] Randomly extracts a number as r. The time required for retransmission is r times the basic backoff time (4) when the number of retransmission times reaches 16, the frame is discarded and reported to the senior management. The ratio of one-way bus transmission latency to frame transmission latency is as follows: a = C * t/L where t represents the end-to-end transmission latency, C Represents the data transmission rate, and L represents the frame length. The molecular C * t is the latency bandwidth product, or the length of the channel in bits, while the denominator is the frame length in bits. a describes the ability of the sender to fill up the channel, the smaller the value of a, the easier it is for the sender to fill up the channel. Maximum channel utilization (T0 + indicates the time when frame transmission occupies the line, T0 indicates the transmission time of the frame itself) SM = T0/(T0 +) = 1/(1 +) the smaller the value of a, the higher the channel utilization. 6. The link layer Switch Ethernet adopts a star topology, and each node is connected to a switch. The link layer switch receives links and forwards them to the outbound link. 1. Switch forwarding and filtering forwarding: determines the interface from which a frame should be sent out for filtering: The switch determines whether a frame should be forwarded to an interface or discarded. Vswitch forwarding and filtering are completed by using its internal table items. Vswitch Forwarding is based on the MAC address. A vswitch is self-learned. Its basic working process is to receive the source MAC address, interface, and aging time of a frame added to a forwarding table from an interface, if the table items with the same MAC address and interface exist, only the aging time is updated. If the table items with the same MAC address exist, but the interfaces are different, then, the original target address of the deleted frame is used as the keyword to query the forwarding table. If no table item is found, A table item is found for the packet forwarding to all interfaces except the interface for this frame, and the interface is different from the interface for receiving this frame, the packet is forwarded to the representation record interface and a representation is found. The interface is the same as the interface for receiving the frame, and the discarded packet is also indicated by an aging mechanism in the forwarding table, if the vswitch does not receive a frame with an address as the source address, the table items with this address as the key will be deleted from the forwarding table. 2. the nature of a vswitch allows you to build a network using a vswitch. Collision Elimination: After a vswitch is used to build a network, each segment of the link is exclusive, so the collision is eliminated, this avoids bandwidth waste caused by collision. Connect to a heterogeneous link: A vswitch can be used to connect links with different rates for easy management: When a vswitch is used to build a network, the administrator can detect the running status of the network through the vswitch, simplifying management.
 

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.