Data link layer


Published on


Published in: Education
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Data link layer

  1. 1. Guided By Presented ByMr. A. K. Khan Deepak Gupta (31320025)Assistant Professor Ankur Adhyapak(31320032)Dept. of Information Technology Medini Brahma(31320016)Assam University , Silchar Suraj Prakash Maurya(31320020) 2013-4-6 1
  2. 2. 1. Introduction2. Error Control3. Physical Address4. Multiple Access5. Framing6. Flow Control7. Summary8. Bibliography9. Website Visited2013-4-6 2
  3. 3.  Data Link Layer is the Second Layer in the OSI Model. Data Link Layer Receives The Service From Physical Layer and gives Service to the Network Layer. It makes the physical layer appears error-free to the upper layer (Network Layer). The data Link Layer is responsible for the Moving frames from one hop (node) to the next.2013-4-6 3
  4. 4. 2013-4-6 4
  5. 5. 2013-4-6 5
  6. 6. 1. Single-bit error2013-4-6 6
  7. 7. 2. Multiple-bit error3. Burst Error2013-4-6 7
  8. 8.  Errors Caused by Signal Attenuation , Noise. Receiver Detects Presence of Errors. Possible Actions  Signal Sender For Re-Transmission.  Drops Frame.  Correct bit Errors if Possible and Continue.2013-4-6 8
  9. 9. DDee Errors Detection uses The Concept of redundancy, which Means adding Extra bits at The End of Each Unit of data.2013-4-6 9
  10. 10. Three Types of Redundancy Check are Common : 1. Parity Check (A). Simple Parity Check (B). Two Dimensional Parity Check 2. Cyclic Redundancy Check (CRC) 3. Check Sum.2013-4-6 10
  11. 11.  In This Technique , a Redundant bit, Called a Parity bit is Added To The Every data Unit so That The Total Number of 1s (including The Parity bit) in The Unit becomes Even (or Odd).2013-4-6 11
  12. 12.  Ex : The data Unit 100100 becomes 110110Then in both data Unit Number of 1 is even.So we can conclude ,1. simple parity check can detect All single bit errors.2. It Can detect burst errors only if the total number of errors in each data unit is odd.2013-4-6 12
  13. 13.  In This Method, First We Calculate The Parity bit For Each Data Unit. Ex : As in Figure We have Four Data Unit. Then We Calculate The Parity bit For Each Column.2013-4-6 13
  14. 14. The Sender Send 11001111 10111011 01110010 01010011 01010101 Suppose The Receiver Receive 11111111 10110111 01110010 01010011 01010101 Lets Check The Parity bits 11111111 10110111 01110010 01010011 011010012013-4-6 14
  15. 15. But If--->Sender Send 11001111 10111011 01110010 01010011 01010101Suppose The Receiver Receive 01001101 00111001 01110010 01010011 01010101Lets Check The Parity bits 01001101 00111001 01110010 01010011 01010101So, if 2 bits in One Data Unit Damaged and 2 bits in Exactly The SamePositions in Another data Unit are Also Damaged, The Checker WillNot Detect an Error. 2013-4-6 15
  16. 16.  The Third and Most Powerful Technique of Error Detection is Cyclic Redundancy Check (CRC). It based on Binary Division.2013-4-6 16
  17. 17.  The Divisor of Size n is Predefined and Agreed Upon The both Sender and Receiver. Then , The Size of Redundant bits Should be n-1.Ex : Sender 2013-4-6 17
  18. 18. Receiver 2013-4-6 18
  19. 19.  The Last Error Detection Method , We Discuss here is CalledThe Checksum.The checksum is Used in The Internet by Several ProtocolsAlthough not at The Data Link Layer.Like The Others it is Also based on Redundancy. Traditionally, The Internet has been Using a 16-bit Checksum.2013-4-6 19
  20. 20. The Sender Calculates The Checksum by Following These Steps….Sender Side :1. The message is divided into 16-bit words.2. The value of the checksum word is set to 0.3. All words including the checksum are added using One’s Complement addition.4. The Sum is Complemented and becomes The Checksum.5. The Checksum is Sent With The Data.2013-4-6 20
  21. 21. The Receiver Uses The Following Steps For Error Detection. Receiver site 1. The Message (including Checksum) is Divided into 16-bit Words. 2. All Words are Added Using One’s Complement Addition. 3. The Sum is Complemented and becomes The New Checksum. 4. If The Value of Checksum is 0, The Message is Accepted ; Otherwise, it is Rejected.2013-4-6 21
  22. 22. Ex : here We Use 4 bit Checksum. Suppose We have To Send The Set of Data (7, 11, 12, 0, 6)2013-4-6 22
  23. 23.  Two methods 1. Error correction by Retransmission 2. Forward error correction (FEC)2013-4-6 23
  24. 24.  It Allows The Receiver To inform The Sender of Any Frame Lostor Damaged in Transmission. Coordinates The Re-Transmission of Those Frames by TheSender. This Process is Called Automatic Repeat Request (ARQ).For This We Use Three Common Flow Control Mechanisms : 1. Stop-and-Wait ARQ 2. Go-back-N ARQ 3. Selective-Repeat ARQ2013-4-6 24
  25. 25.  Receiver Can Use an Error Correcting Code , Which AutomaticallyCorrect Certain Errors.Hamming Code : Single bit Error Burst bit Error Hamming Code is Mainly Used To Solve Single bit Error. We Can Solve Burst bit Error Using The Concept of Single bit Error.2013-4-6 25
  26. 26. Single bit Error Receiver Reads a 1 bit as a 0 or 0 bit as a 1. To Correct This Error, The Receiver Simply Reverses The Value of The Altered bit. To do so We Must Know Which bit is in error. To Calculate The Number of Redundant bit r To Correct an data bit of Length m we Must Know The Relationship between r and m. So, if Data bit is m and Redundant bit is r, Then We have To Satisfy The Relation 2^r >= m+r+12013-4-6 26
  27. 27. Ex : If The Value of m is 7, The Relation will Satisfy if The MinimumValue of r is 4. 2^4 = 16 > 7+4+12013-4-6 27
  28. 28. If The Number of Data bit is 7, Then The Position of Redundant bits Are : 2^0=1 2^1=2 2^2=4 2^3=82013-4-6 28
  29. 29. 2013-4-6 29
  30. 30. 2013-4-6 30
  31. 31. Let Receiver receives 100101001012013-4-6 31
  32. 32. Burst Error Correction  Hamming Code Cannot Correct a burst Error Directly.  it is Possible To Rearrange The Data and Then Apply The code.  Instead of Sending All the bits in The data Unit Together, we can organize N units in a column.  Send The First bits of Each Followed by The Second bit of each, and so on.  In This Way, if a burst Error of M bit Occurs (M<N), Then The Error does not Corrupt M bit of Single Unit, it Corrupt Only 1 bit of Unit.  Then We Can Correct it Using Hamming Code Scheme.2013-4-6 32
  33. 33. 2013-4-6 33
  34. 34. 2013-4-6 34
  35. 35. Four Levels of Addressing Physical Logical Port Specific Addresses Addresses Addresses Addresses Data Link Layer Network layer Transport Layer Application Layer2013-4-6 35
  36. 36.  Physical Address is Also Known As Link Address.  It is the Address of a node as defined by its LAN or WAN.  It is Included in The Frame used by the Data Link Layer.  It is The Lowest Level Address. The Size and Format of These Address vary , depending on The Network.2013-4-6 36
  37. 37.  Ethernet uses a 6-byte (48 bits) Physical Address That is Imprinted on The Network Interface card (NIC) . Ex : Most LAN Use a 48-bit (6 byte) Physical Address Written as 12 hexadecimal digits , Every byte (2 hexadecimal digits) is Separated by a Colon , As Shown below.. 07:01:02:01:2C:4B A 6 byte (12 hexadecimal digits ) Physical Address.2013-4-6 37
  38. 38. 2013-4-6 38
  39. 39. 2013-4-6 39
  40. 40.  When nodes or stations are connected and use a common link , called amultipoint or broadcast link , we need a multiple-access protocol to coordinateaccess to the link. TAXANOMY OF MULTIPLE-ACCESS PROTOCOLS2013-4-6 40
  41. 41. In random access or contention method , no station is superior to anotherstation and none is assigned the control over another.At each instance a station that has a data to send uses a proceduredefined by the protocol to make a decision on whether or not to send . Thedecision depends on the state of the medium (idle or busy ).Two features give this method its name: there is no scheduled time for a station to transmit (i.e random access)No rules specify which station should travel next(i.e called contentionmethod)2013-4-6 41
  42. 42.  Earliest random access protocol developed in early1970. It was designed for radio wireless Lan.The medium was shared between stations .When a station sends the data , anotherstation may do at the same time .The data from the two stations collide and becomegarbled. 2013-4-6 42
  43. 43.  The original ALOHA protocol is called pure ALOHA . Each stations sends a frame when ever it has a frame to send . Since there is only one channel to share , the is a possibility ofcollisions between frames from different stations .FRAMES IN Pure ALOHA NETWORK 2013-4-6 43
  44. 44. Procedure for pure aloha protocol 2013-4-6 44
  45. 45. VULNERABLE TIME : is the time in which there is a possibility ofcollision. fig:- Vulnerable time in pure ALOHA protocol 2013-4-6 45
  46. 46. THROUGHTPUT :- is the average number of successful transmission. o FOR pure ALOHA S=G*e-2G where G is the average number of frames generated by the system .2013-4-6 46
  47. 47.  In slotted ALOHA we divide the time into slots of Tfr s andforce the stations to send only one at the beginning of the time slot.2013-4-6 47
  48. 48. VULNERABLE TIME :- is now reduced to one half i.e T fr Fig :- Vulnerable time for slotted ALOHA protocol .2013-4-6 48
  49. 49. Throughput :- the average number of successful transmission for slotted ALOHA is S=G*e-G The maximum number throughput Smax =0.368 when G=1.2013-4-6 49
  50. 50. CSMA requires that each station first lisens to the mediumbefore sending .The possibility of collision still exist because of propagation delay; when a station sends a frame, it still takes time for the first bit toreach every station and for every station to sense it.2013-4-6 50
  51. 51. Vulnerable time :- for CSMA is the propagation time Tp .2013-4-6 51
  52. 52. Persistence methods :- tells what a station should do if the channel is idle . 3 types of persistence methods  1-persistent  non persistent p-persistent2013-4-6 52
  53. 53. 2013-4-6 53
  54. 54. CSMA/CD augments the algorithm to handle the collision .Here a stationmonitors the medium after it sends a frame to see if the transmission wassuccessful . If so the station is finished . If however there is a collision , the frameis send again . 2013-4-6 54
  55. 55. Flow diagram2013-4-6 55
  56. 56. In wired network the received signal has almost the same energy as the sentsignal because the length of the cable is short or there are repeaters that amplifythe energy between the sende and the receiver . This means that in a collision, the detected energy almost doubles .Collisions are avoided through the use of CSMA/CA’s three strategies :-The interframe space (IFS)The contention windowacknowwledgements2013-4-6 56
  57. 57. FLOW DIAGRAM 2013-4-6 57
  58. 58.  In controlled access , the stations consult one another to findwhich station has the right to send . 3 popular controlled access methods are : 1. reservation 2. Polling 3. Token passing2013-4-6 58
  59. 59.  In reservation method , a station needs to make a reservation before sendingthe data .In each interval , a reservation frame precedes the data frame in thatinterval. If there are N stations in the system , the are exactly N reservation minis lotsin the reservation frame . Each minis lot belong to a station . When a stationneeds to send a data frame , it makes a reservation in its own minis lot. 2013-4-6 59
  60. 60. Polling works with topologies in which one device is designated as a primary station and the other devices are secondary stations. All data exchanges must be made through the primary device even when the ultimate destination is a secondary device.  The primary device controls the link.  The secondary devices follow its instructions.2013-4-6 60
  61. 61. Select Function The select function is used whenever the primary device has something to send.  Remember that the primary controls the link. If the primary is neither sending nor receiving data, it knows the link is available. Poll Function The poll function is used by the primary device to solicit transmissions from the secondary devices.  When the primary is ready to receive data, it must ask (poll) each device in turn if it has anything to send.2013-4-6 61
  62. 62. 2013-4-6 62
  63. 63. Logical Ring:  In a token-passing network, stations do not have to be physically connected in a ring. the ring can be a logical one.2013-4-6 63
  64. 64. In the token-passing method, the stations in a network areorganized in a logical ring. In other words, for each station, there is a predecessor and asuccessor. The predecessor is the station which is logically before thestation in the ring; the successor is the station which is after the station in thering.2013-4-6 64
  65. 65. 2013-4-6 65
  66. 66.  The transmitted bit stream by the physical layer is not guaranteed to be error free. It is up to the data-link layer to detect, and if necessary, to correct errors. The data-link layer breaks the bit stream up into discrete frames and compute the checksum for each frame. When a frame arrives at the destination, the checksum is recomputed.2013-4-6 66
  67. 67. Frames Are The Small data Units Created By Data Link Layer And The Process Of Creating Frames By The Data Link Layer Is Known As Framing. The easiest way to achieve framing is to insert time gaps between frames.  Networks rarely make any guarantees about timing.2013-4-6 67
  68. 68. 1. Character Count. 2. Starting & Ending Characters With Character Stuffing. 3. Starting & ending Flags With Bit Stuffing. 4. Physical Layer Coding Violation.2013-4-6 68
  69. 69.  This Method Specifies The Number Of Characters That Are Present In particular Frame.  This Information Is specified By using a Special Field In the Header Frame.  The problem with Character count algorithm is that the count can be distorted by a transmission error.2013-4-6 69
  70. 70.  In this Method Frame Starts & End With a special CharacterThat Mark The Beginning & End Of Frame. Each character Begins With the ASCII Character Sequence DLESTX (data link Escape Start Of Text ) And End With ASCII CharacterSequence DLE ETX (data link escape End Of text)2013-4-6 70
  71. 71. 2013-4-6 71
  72. 72.  In this Method , Each Begins & Ends With a Special Bit pattern 01111110 Called Flags.  There for Each frame starts With 01111110& also Ends with 01111110.  The Main Problem arises in this Method When The Flag byte 01111110 Appear as data.  This Problem Is Handled By technique called Bit stuffing That Is similar To character stuffing.2013-4-6 72
  73. 73. 2013-4-6 73
  74. 74.  This Framing Method Is Used only In those network In whichEncoding On The Physical Medium Contain some Redundancy. Some LANs Encode Each Bit Of Data By using two Physical Biti.e. Manchester coding is Used. In this method Bit 1 Is encoded into high-low(10) Pair And Bit 0Is Encoded Into low-high(01)pair shown in figure.2013-4-6 74
  75. 75. TDMA – Time Division Multiple Access FDMA – Frequency Division Multiple Access CDMA – Code Division Multiple Access2013-4-6 75
  76. 76. FDMA - Large room divided up into small rooms. Each pair ofpeople takes turns speaking.TDMA – Large room divided up into small rooms. Three pairs ofpeople per room, however, each pair gets 20 seconds to speak.CDMA – No small rooms. Everyone is speaking in differentlanguages. If voice volume is minimized, the number of peopleis maximized.2013-4-6 76
  77. 77. Efficiency of TDMA frame:2013-4-6 77
  78. 78.  Flexible bit rate No frequency guard band required No need for precise narrowband filters Easy for mobile or base stations to initiate and execute hands off Extended battery life TDMA installations offer savings in base station equipment, space and maintenance The most cost-effective technology for upgrading a current analog system to digital2013-4-6 78
  79. 79. Requires network-wide timing synchronization  Requires signal processing fro matched filtering and correlation detection  Demands high peak power on uplink in transient mode  Multipath distortion2013-4-6 79
  80. 80. Number of FDMA ChannelsIn the U.S. each cellular carrier is allocated 416 channels where:2013-4-6 80
  81. 81.  If channel is not in use, it sits idle  Channel bandwidth is relatively narrow (30kHz)  Simple algorithmically, and from a hardware standpoint  Fairly efficient when the number of stations is small and the traffic is uniformly constant  Capacity increase can be obtained by reducing the information bit rate and using efficient digital code  No need for network timing  No restriction regarding the type of baseband or type of modulation2013-4-6 81
  82. 82.  The presence of guard bands  Requires right RF filtering to minimize adjacent channel interference  Maximum bit rate per channel is fixed  Small inhibiting flexibility in bit rate capability  Does not differ significantly from analog system2013-4-6 82
  83. 83. Spread Spectrum Multiple Access Technologies2013-4-6 83
  84. 84. Many users of CDMA use the same frequency, TDD or FDD may be used  Multipath fading may be substantially reduced because of large signal bandwidth  No absolute limit on the number of users  Easy addition of more users  Impossible for hackers to decipher the code sent  Better signal quality  No sense of handoff when changing cells2013-4-6 84
  85. 85. As the number of users increases, the overall quality of service decreases  Self-jamming  Near- Far- problem arises2013-4-6 85
  86. 86. 2013-4-6 86
  87. 87.  Flow control refers to a set of procedures (protocols) used to restrict the amount of data that the sender can send before waiting for acknowledgment.  It is one of the most important duties of the data link layer.2013-4-6 87
  88. 88.  Now let us see how the data link layer can combineframing, flow control, and error control by using protocols toachieve the delivery of data from one node to another. We divide the discussion of protocols as follows -2013-4-6 88
  89. 89. All the protocols we discuss are unidirectional.  Although special frames, called acknowledgment (ACK) and negative acknowledgment(NAK) can flow in the opposite direction for flow and error control purposes, data flow in only one direction.2013-4-6 89
  90. 90.  An ideal channel in which no frames are lost, duplicated, or corrupted. We introduce two protocols for this type of channel. 1. Simplest Protocol 2. Stop-and-wait2013-4-6 90
  91. 91.  We assume that the receiver can immediately handle any frame it receives with a processing time that is small enough to be negligible.  The data link layer of the receiver immediately removes the header from the frame and hands the data packet to its network layer, which can also accept the packet immediately.2013-4-6 91
  92. 92. Sender-site algorithm2013-4-6 92
  93. 93. Receiver-site algorithm2013-4-6 93
  94. 94. The sender sends one frame, stops until it receives confirmationfrom the receiver (okay to go ahead), and then sends the next frame. 2013-4-6 94
  95. 95. Sender-site algorithm2013-4-6 95
  96. 96. Sender-site algorithm2013-4-6 96
  97. 97. Receiver-site algorithm2013-4-6 97
  98. 98.  Although the Stop-and-Wait Protocol gives us an idea of how to add flow control to its predecessor, noiseless channels are nonexistent. We discuss three protocols in this section that use error control. 1. Stop-and-Wait Automatic Repeat Request 2. Go-Back-N Automatic Repeat Request 3. Selective Repeat Automatic Repeat Request2013-4-6 98
  99. 99.  Adds a simple error control mechanism to the Stop-and-Wait Protocol. When the frame arrives at the receiver site, it is checked and if it is corrupted, it is silently discarded. The detection of errors in this protocol is manifested by the silence of the receiver. The corrupted and lost frames need to be resent in this protocol.2013-4-6 99
  100. 100.  To identify a frame we number the frames.  Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires.  The ACK frame for this protocol has a sequence number field.2013-4-6 100
  101. 101.  Sequence numberIn Stop-and-Wait ARQ, we use sequence numbers to number theframes. The sequence numbers are based on modulo-2 arithmetic. Acknowledgement numberIn Stop-and-Wait ARQ, the acknowledgment number alwaysannounces in modulo-2 arithmetic the sequence number of the nextframe expected. 2013-4-6 101
  102. 102. Sender-site algorithm2013-4-6 102
  103. 103. Sender-site algorithm2013-4-6 103
  104. 104. Receiver-site algorithm2013-4-6 104
  105. 105. 2013-4-6 105
  106. 106.  In this protocol we can send several frames before receiving acknowledgments; we keep a copy of these frames until the acknowledgments arrive. Sequence number  In the Go-Back-N Protocol, the sequence numbers are modulo 2 raise to the power m, where m is the size of the sequence number field in bits.2013-4-6 106
  107. 107. Sliding WindowIn this protocol, the sliding window is an abstract concept that defines the rangeof sequence numbers that is the concern of the sender and receiver.The range which is the concern of the sender is called the send sliding window;the range that is the concern of the receiver is called the receive sliding window.2013-4-6 107
  108. 108. Sliding WindowThe send window is an abstract concept defining an imaginary box of size 2m-1 with three variables: Sf, Sn and Ssize.The send window can slide one or more slots when a valid acknowledgmentarrives.2013-4-6 108
  109. 109. Sliding Window The receive window is an abstract concept defining an imaginary box of size 1 with one single variable Rn• The window slides when a correct frame has arrived; sliding occurs one slot at a time.2013-4-6 109
  110. 110. Send Window SizeFor m=22013-4-6 110
  111. 111. Sender-site algorithm 2013-4-6 111
  112. 112. Sender-site algorithm2013-4-6 112
  113. 113. Sender-site algorithm2013-4-6 113
  114. 114.  This protocol does not resend N frames when just one frame is damaged.  It is more efficient for noisy links, but the processing at the receiver is more complex. Windows  The send window maximum size can be 2 raise to the power (m-1)2013-4-6 114
  115. 115.  The size of the receive window is the same as the size of the send window (2m- I ).  The Selective Repeat Protocol allows as many frames as the size of the receive window to arrive out of order and be kept until there is a set of in- order frames to be delivered to the network layer.2013-4-6 115
  116. 116. Window Sizes For m=22013-4-6 116
  117. 117. Sender-site algorithm2013-4-6 117
  118. 118. Sender-site algorithm2013-4-6 118
  119. 119. Receiver-site algorithm2013-4-6 119
  120. 120. Receiver-site algorithm 2013-4-6 120
  121. 121. Data Link Layer makes the physical layer appears error-free to theupper layer (Network Layer). The data Link Layer is responsible for the Moving frames fromone hop (node) to the next. The data Link Layer adds reliability to the physical layer byadding mechanisms to detect and retransmit or lost frames. it also uses a mechanism to recognize duplicate frames. Ethernet uses a 6-byte (48 bits) Physical Address That isImprinted on The Network Interface card (NIC) .2013-4-6 121
  122. 122. When nodes or stations are connected and use a common link, called a multipoint or broadcast link , we need a multiple-accessprotocol to coordinate access to the link. The data-link layer breaks the bit stream up into discrete framesand compute the checksum for each frame. Flow control refers to a set of procedures (protocols) used torestrict the amount of data that the sender can send before waitingfor acknowledgment. Although the Stop-and-Wait Protocol gives us an idea of how toadd flow control to its predecessor, noiseless channels arenonexistent. 2013-4-6 122
  123. 123. Data Communication and Networking Fourth Edition Behrouz A. Forouzan and Sophia Chung Fegan  Computer Network 4th Edition By Tanenbaum   123
  124. 124. Thank You2013-4-6 124