Networking Protocols and OSI Model
1.3 OSI LAYER FUNCTIONS .1 Physical Layer
1.3.2 Data Link Layer
The data link layer is responsible for transmitting a group of bits between the adjacent nodes. The group of bits is generally called as frame. The network layer passes a data unit to the data link layer. At this stage, the data link layer adds the header and trailer information to this, as shown in Fig. 1.8. This now becomes a data unit to be passed to the physical layer.
The header (and trailer, which is not shown, but is instead assumed to be present) contains the addresses and other control information. The addresses at this level refer to the physical addresses of the adjacent nodes in the network, between which the frame is being sent. Thus, these addresses change as the frame travels from
12
different nodes on a route from the source node to the destination node. The addresses of the end nodes, i.e., those of the source and destination nodes, are already a part of data unit transferred from the network layer to the data link layer. Therefore, it is not a part of the header and trailer added and deleted at the data link layer.
Hence, they remain unchanged as the frame moves through different nodes from the source to the destination.
Fig. 1.8 Data link layer between adjacent nodes
Let us illustrate this by an example. Let us refer to Fig. 1.2. Let us imagine that node A wants to send a packet to node D. Let us imagine that we use the datagram approach. In this case, the logical (i.e., IP) addresses of nodes A and D, say ADDL (A) and ADDL (D) are the source and destination addresses. The data unit passed by the network layer to the data link layer will contain them. The data unit will look as it is shown in Fig. 1.9.
Let us call this as DN.
Fig. 1.9 Data unit at the network layer (DN)
When this data unit (DN) is passed from the network layer at node A to the data link layer at node A, the following happens.
(i) The routing table is consulted, which mentions the next node to which the frame should be sent for a specific destination node, which is node D in this case. Let us imagine that the next node is F, based on the congestion conditions at that time, i.e., the path A-F is selected.
(ii) At this juncture, the data link layer at node A forms a data unit, say DD, which looks, as shown in Fig. 1.10. We will notice that DD has encapsulated DN and added the physical addresses of A and F (i.e., those of the NICs of A and F) as ADDP (A) and ADDP (F) to it.
(iii) Using the physical addresses of adjacent nodes A and F, the packet moves from node A to node F after performing the flow control functions, as discussed later (i.e., checking if node F is ready to accept a frame from A and at what data rate, etc.). Here, the packet is passed on from the data link layer to the network layer of node F after performing the error-control function (i.e., verifying that the packet is error-free). Here, ADDP (A) and ADDP (F) are removed and DN is recovered. Now, this DN needs to
13 be sent to the next hop to reach node D. For this, the final destination address, i.e., ADDL (D), is extracted from DN. The frame now has to be sent from node F to node D.
Fig. 1.10 Data unit at the data link layer (DD) at node A
(iv) Again, the routing algorithm is performed at node F using ADDR (D) as the final destination, and the congestion conditions, etc., and a path is chosen. Let us say that the chosen path is FG.
(v) The network layer at node F passes DN to the data link layer at node F. Here, the physical addresses of F and G are added to form the data unit at the data link layer at node F, as shown in Fig. 1.11.
Fig. 1.11 Data unit at data link layer (DD) at node F
(vi) This continues until the data unit at data link layer DD reaches node D. There again, the physical addresses are removed to get the original DN, which is passed on to the network layer at node D. the network layer verifies ADDL (A) and ADDL (D), ensures that the packet is meant for itself, removes these addresses, and sends the actual data to the transport layer at node D.
The data link layer also performs the flow control function. Based on the speeds of the CPUs, transmission, buffer size and congestion condition, it is determined whether the frame/packet can be sent to the adjacent node, and if so, at what speed. If it can be sent, the node is ready to send the data. However, we have to make sure that the medium is free to carry the frame/packet.
If the connection is a multipoint type (i.e., the medium is shared), then the problem of who should send how much data at what times, has to be solved. This problem typically arises in Local Area Networks (LANs), and is solved by the Media Access Control (MAC) protocol. Therefore, in LANs, the data ink layer is split into two sub-layers, as shown in Fig. 1.12. In this case, LLC takes care of normal data link layer functions, such as error control and flow control, etc.
Fig. 1.12 Data link layer in LANs
14
In Wide Area Networks (WANs), where mostly point-to-point connections are used, this problem does not arise.
Thus, the data link layer performs the following functions.
Addressing Headers and trailers are added, containing the physical addresses of the adjacent nodes, and removed upon a successful delivery.
Flow control This avoids overwriting the receiver’s buffer by regulating the amount of data that can be sent.
Media Access Control (MAC) In LANs, it decides who can send data, when and how much.
Synchronization Headers have bits, which tell the receiver when a frame is arriving. It also contains bits to synchronize its timing to know the bit interval to recognize the bit correctly. Trailers mark the end of a frame, apart from containing the error control bits.
Error control It checks the CRC to ensure the correctness of the frame. If incorrect, it asks for retransmission.
Again, here there are multiple schemes (positive acknowledgement, negative acknowledgement, go-back-n, sliding window, etc.).
Node-to-node delivery Finally, it is responsible for error-free delivery of the entire frame to the next adjacent node (node-to-node delivery).