1 / 99

Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色

Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色. Chapter5 The Link Layer and Local Area Networks 起点中文阅读 http://www.qidian4.com. understand principles behind data link layer services: error detection & correction

rbonds
Download Presentation

Computer Networking A Top-Down Approach Featuring the Internet 计算机网络 - 自顶向下方法与 Internet 特色

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer NetworkingA Top-Down Approach Featuring the Internet计算机网络-自顶向下方法与Internet特色 Chapter5 The Link Layer and Local Area Networks 起点中文阅读 http://www.qidian4.com

  2. understand principles behind data link layer services: error detection & correction sharing a broadcast channel: multipleaccess link layer addressing reliable data transfer, flow control: done! implementation of various link layer technologies Ethernet:broadcast channel PPP:point to point channel Chapter Goals

  3. 5.1 Link Layer: Introduction and Services 5.2 Error-Detection and -Correction 5.3 Multiple Access Protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and Switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS Roadmap

  4. A link-layer protocol is used to move a datagram over an individuallink Links communication channels that connect adjacent nodes The PDU of a link-layer protocol is called Frame “link” 1. Link Layer Services 5.1 Introduction and Services

  5. Datagrams may be transferred by differentlinkprotocols over different links: e.g., Ethernet on first link, framerelay on intermediate links, 802.11 on the last link Different link protocol may provide differentservices e.g., may or may not provide rdt (reliable data transfer) over a link 1. Link Layer Services 5.1 Introduction and Services

  6. 1. Link Layer Services • Possible Services • Framing • Link Access • Reliable delivery • Flow Control • Error detection and correction • Half/Full duplex 5.1 Introduction and Services

  7. 1. Link Layer Services • Framing • encapsulate a datagram into a frame, adding header and trailer • The structureof a the frame is specified by the link layer protocol • LinkAccess • How to share a medium ? • Medium Access Control (MAC) protocol serves to coordinate the frame transmission of the many nodes 5.1 Introduction and Services

  8. 1. Link Layer Services • Reliabledeliverybetween adjacent nodes • Using ack and retransmission as TCP • we have learned how to do this already • seldom used on low bit error link • Such as fiber, some twisted pair media • wireless links: high error rates • Q: why both link-leveland end-end reliability? 5.1 Introduction and Services

  9. 1. Link Layer Services • Flow Control: • pacing adjacent sending and receiving nodes • Error Detection and Correction • errors caused by signal attenuation, noise. • receiver detects presence of errors: • informs sender for retransmission or drops frame • receiver identifies and corrects bit error (s) without resorting to retransmission • Full-duplex, Half-duplex, Simplex • with half duplex, nodes at both ends of a link can transmit, but not at same time. 5.1 Introduction and Services

  10. link layer protocol implemented in an adapter aka. Network Interface Card (NIC) Ethernet card, PCMCIA card, 802.11 card datagram frame frame rcving node link layer protocol sending node adapter adapter 2. Adapters Communicating 5.1 Introduction and Services

  11. datagram frame frame rcving node link layer protocol sending node adapter adapter 2. Adapters Communicating 5.1 Introduction and Services • sending side: • encapsulates datagram in a frame • addserrorchecking bits, rdt, flowcontrol, etc. • receiving side • checkingerrors, rdt, flowcontrol, etc • extracts datagram from frame and passes it to receiving node

  12. 2. Adapters Communicating • adapter is a semi-autonomous system • It can receive a frame, checkerrors and discard the corrupted frames without notifying other components • It interrupts the parent node onlyif it wants to pass datagram up the protocol stack • The parent node fullydelegated to the adapter the task of transmitting the datagram across the link • The adapter is typically housed in the box as the rest of the node 5.1 Introduction and Services

  13. 5.1 Link Layer: Introduction and Services 5.2 Error-Detection and -Correction 5.3 Multiple Access Protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and Switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS Roadmap

  14. Error Detection and Correction 5.2 Error Detection and Correction • EDC= ErrorDetection and Correction bits (redundancy) • D = Data protected by error checking, may include header fields • Error detection not 100%reliable! • protocol may miss some errors, but rarely • larger EDC field yields better detection and correction

  15. Error-Detection & -Correction Techniques • Parity Checks • Internet Checksumming • Cyclic redundancy Check 5.2 Error Detection and Correction

  16. 1. Parity Checks 5.2 Error Detection and Correction • 1.Single Bit Parity: Detect single bit errors • - Can detect odd number bits error odd even 1

  17. 0 0 1. Parity Checks 2.Two Dimensional Bit Parity: -can detect single bit errors -can correct single bit errors 5.2 Error Detection and Correction

  18. 1. Parity Checks 5.2 Error Detection and Correction 0 0 FEC: The ability of the receiver to both detect and correct errors

  19. 2. Internet Checksum • Sender • treat segment contents as sequence of 16-bit integers • checksum: addition (1’s complement sum) of segment contents • sender puts checksum value into checksumfield • Receiver: • the sum of the received data (including the checksum) = all 1 bits: • NO - error detected • YES - no error detected. 5.2 Error Detection and Correction

  20. 2. Checksumming 5.2 Error Detection and Correction • Checksumming methods require relatively little overhead, but provide relatively weak protection against errors • Why is checksumming used at the transport layer? • Transport layer is typically implemented in soft in a host as a part of OS.

  21. 3. Cyclic Redundancy Check • The data (D) are viewed as a d-bit binary number • The Sender chooses r additional bits (R, CRC bits) and appends them to theD, such that d+r bits is exactly divisible by G using modulo-2 arithmetic. • Sender and receiver both know the (r+1)-bitgenerator (G) • The receiver divides (d+r)-bit (D,R) by G. • If non-zero remainder: error detected! 5.2 Error Detection and Correction

  22. 3. Cyclic Redundancy Check • Modulo-2 algorithm • No addition carries • No subtraction borrows • The addition (+) and the subtraction (-) are identical and both are equivalent to the bitwiseexclusive-or (XOR) • For example: • 1011 XOR 0101 = 1110 • 1011 — 0101 = 1110 • 1011 + 0101 = 1110 5.2 Error Detection and Correction

  23. D.2r G R = remainder[ ] 3. Cyclic Redundancy Check How the Sender computes the R? Want: D.2rXORR = nG equivalently: D.2rXORRXORR = nG XORR D.2r = nG XORR equivalently: if we divide D.2r by G, want remainder R 5.2 Error Detection and Correction

  24. 3. Cyclic Redundancy Check • Example: • D=101110 G = 1001 • r =3 and T(D,000)=101110000 • T(D,R)=101110011 5.2 Error Detection and Correction • CRC can detect all burst errors less than r+1 bits. • CRC-32( international standard ) • =100000100110000010001110110110111

  25. 5.1 Link Layer: Introduction and Services 5.2 Error-Detection and -Correction 5.3 Multiple Access Protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and Switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS Roadmap

  26. Introduction Two types of links: • point-to-point • Only a sender and a receiver sits at each end • PPP for dial-up access • broadcast (shared wire or medium) • Many senders and receivers share the link • traditional Ethernet • WLAN • Upstream of HFC 5.3 Multiple Access Protocol

  27. Introduction • single shared broadcast channel • two or more simultaneous transmissions by nodes will cause interference • Collision-if node receives twoormore signals at the same time • Multiple Access Problem • How to coordinate the access of a sharedbroadcastchannel? 5.3 Multiple Access Protocol

  28. Introduction • multiple access protocol • distributed algorithm that determines how nodes share the channel, i.e., determine when and which node can transmit • communication about channel sharing must use channel itself! • no out-of-band channel for coordination 5.3 Multiple Access Protocol

  29. Introduction The requirements to multiple access protocol for a broadcast channel of rate R bps • When one node can transmit, it send at rate R. • When M nodes want to transmit over the channel, each can send at average rate R/M bps • Fully decentralized: • no special node to coordinate transmissions • no synchronization of clocks, slots • Simple 5.3 Multiple Access Protocol

  30. Introduction • CategoriesofMultiple Access Protocol • Channel Partitioning • divide channel into smaller “pieces” (time slots, frequency, code) • allocate piece to node for exclusive use • Random Access • channel not divided, allow collisions • “recover” from collisions • Taking turns • Nodes take turns, but nodes with more to send can take longer turns 5.3 Multiple Access Protocol

  31. 1. Channel Partitioning Protocols • TDM (Time Division Multiplexing) • Time divided into Frames and further divides each Frame into Nslots, each slot is then assigned to one of the N nodes • Nodes access to channel in "rounds" • unused slots go idle • FDM (Frequency Division Multiplexing) • CDMA (Code Division Multiplexing Access) 5.3 Multiple Access Protocol

  32. 1.1 TDMA • TDMA eliminates collisions and is perfectly fair, but has two drawbacks • each node gets adedicated transmission rate of R/N and the average rate is limited to R/N • a node mustalways wait for its turn 5.3 Multiple Access Protocol

  33. 1. Channel Partitioning Protocols • TDM (Time Division Multiplexing) • FDM (Frequency Division Multiplexing) • The spectrum is divided into frequencybands • each station assigned fixed frequency band • unused transmission time in each frequency bands goes idle • CDMA (Code Division Multiplexing Access) 5.3 Multiple Access Protocol

  34. time frequency bands 1.2 FDMA • advantages and drawbacks • can avoids collisions • share the channel fairly • a node is limited to a bandwidth of R/N • a node neednotwaitsfor its turn 5.3 Multiple Access Protocol

  35. 1. Channel Partitioning Protocols • TDM (Time Division Multiplexing) • FDM (Frequency Division Multiplexing) • CDMA (Code Division Multiplexing Access) • Assign a different code to each node • Each node encodes the data bits using its unique code • Different nodes can transmit simultaneously • Usually used in military systems in early time • Details discussed in wireless networking of Advanced Computer Networks 5.3 Multiple Access Protocol

  36. Introduction • CategoriesofMultiple Access Protocol • Channel Partitioning • Random Access • channel not divided, allow collisions • “recover” from collisions • Taking turns 5.3 Multiple Access Protocol

  37. 2. Random Access Protocols • When a node has a packet to send, it transmit the packet at fullchanneldatarateR bps. • no a prioricoordination among nodes • may cause collision • Each node involved in the collision repeatedlyretransmits its packet until the packet gets through withoutanycollision. • a node waits some time choosed randomly before retransmission 5.3 Multiple Access Protocol

  38. 2. Random Access Protocols • random access protocol specifies: • how to detect collisions? • how to recover from collisions? • Examples of random access protocols: • slottedALOHA • Pure ALOHA • CSMA, CSMA/CD, CSMA/CA 5.3 Multiple Access Protocol

  39. Assumptions allframes have same size: L bits time is divided into equal size slots time to transmit 1 frame: L/R nodes start to transmit frames only at beginning of slots nodes are synchronized if there 2 or more nodes transmitting in a slot, all nodes can detect the collision 2.1 Slotted ALOHA 5.3 Multiple Access Protocol

  40. 2.1 Slotted ALOHA 5.3 Multiple Access Protocol Operation • when node obtains fresh frame, it transmits in the next slot • If there is not a collision, node can send new frame in next slot • The sending node can detect the collision before the end of the slot • If there is a collision ,node retransmits frame in each subsequentslot with probability puntil success

  41. Advantages single active node can continuously transmit at fullrate of channel highly decentralized: only slots in nodesneedto be insynchronization simple 2.1 Slotted ALOHA 5.3 Multiple Access Protocol

  42. 2.1 Slotted ALOHA 5.3 Multiple Access Protocol Drawbacks • many wasted slots because of collision • successful slot:The slot which only one node transmit • idle slotsbecause of the probabilistic policy • nodes must detect the collision in less than time to transmit a packet • clock synchronization used to determine the start/end of one slot

  43. 2.1 Slotted ALOHA • Suppose N nodes with many frames to send, each transmits in each slot with probability p • Prob. that any node has a success = Np(1-p)N-1 5.3 Multiple Access Protocol Efficiency of slotted ALOHA is the long-run fraction of successful slots when there are many nodes, each with many frames to send

  44. 2.1 Slotted ALOHA 5.3 Multiple Access Protocol

  45. 2.2 Pure (un-Slotted) ALOHA unslotted ALOHA-no synchronization • when frame first arrives, transmit immediately • collision probability increases: • frame sent at t0 collides with other frames sent in [t0-L/r,t0+L/R] 5.3 Multiple Access Protocol

  46. 2.2 Pure (un-Slotted) ALOHA P(success by given node) = P(node transmits) .P(no other node transmits in [t0-L/R,t0] . P(no other node transmits in [t0,t0+L/R] = p . (1-p)N-1 . (1-p)N-1= p . (1-p)2(N-1) 5.3 Multiple Access Protocol

  47. 2.3CSMA CSMA:Carrier Sense Multiple Access • listenbeforetransmitting • If channel sensed idle, thentransmits entire frame immediately • If channel sensed busy, then waits a random amount of time and then senses the channel 5.3 Multiple Access Protocol

  48. collisions can still occur: • propagation delay means two nodes may not hear each other’s transmission spatial layout of nodes 2.3CSMA If all nodes perform carrier sensing, do collisions occur all the same? 5.3 Multiple Access Protocol note: the role of distance & propagation delay in determining collision probability collision: entire packet transmission time wasted

  49. 2.4CSMA/CD (collision detection) CSMA/CD: carrier sensing and deferral as in CSMA • collisions detected within short time • colliding transmissions aborted, reducing channel wastage 5.3 Multiple Access Protocol

  50. 2.4CSMA/CD (collision detection) • collision detection: • easy in wired LANs • measure signal strengths, compare transmitted, received signals • but difficult in wireless LANs • receiver shut off while transmitting for saving energy 5.3 Multiple Access Protocol

More Related