Presentation is loading. Please wait.

Presentation is loading. Please wait.

5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.

Similar presentations


Presentation on theme: "5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross."— Presentation transcript:

1 5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004. These ppt slides are originally from the Kurose and Ross’s book. But some slides are deleted and added for my own purpose, and some of them are modified.

2 5: DataLink Layer5-2 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing a broadcast channel: multiple access m link layer addressing m reliable data transfer, flow control: done! r instantiation and implementation of various link layer technologies

3 5: DataLink Layer5-3 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-Layer Addressing r 5.5 Ethernet r 5.6 Hubs and switches r 5.7 PPP r 5.8 Link Virtualization: ATM and MPLS

4 5: DataLink Layer5-4 Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m wired links m wireless links m LANs r layer-2 packet is a frame, encapsulates datagram “link” data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

5 5: DataLink Layer5-5 Link Layer Services r Framing m encapsulate datagram into frame, adding header, trailer r Link access m channel access if shared medium m “MAC” addresses used in frame headers to identify source, dest different from IP address! r Reliable delivery between adjacent nodes if needed m we learned how to do this already (chapter 3)! m seldom used on low bit error link (fiber, some twisted pair) m wireless links: high error rates Q: why both link-level and end-end reliability?

6 5: DataLink Layer5-6 Adaptors Communicating r link layer implemented in “adaptor” (aka NIC) m Ethernet card, PCMCI card, 802.11 card r sending side: m encapsulates datagram in a frame m adds error checking bits, rdt, flow control, etc. r receiving side m looks for errors, rdt, flow control, etc m extracts datagram, passes to rcving node r adapter is semi- autonomous r link & physical layers sending node frame rcving node datagram frame adapter link layer protocol

7 5: DataLink Layer5-7 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-Layer Addressing r 5.5 Ethernet r 5.6 Hubs and switches r 5.7 PPP r 5.8 Link Virtualization: ATM

8 5: DataLink Layer5-8 Error Detection EDC= Error Detection 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

9 5: DataLink Layer5-9 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0

10 5: DataLink Layer5-10 Cyclic Redundancy Check(CRC) r view data bits, D, as a binary number r choose r+1 bit pattern (generator), G r goal: choose r CRC bits, R, such that m exactly divisible by G (modulo 2) m receiver knows G, divides by G. If non-zero remainder: error detected! m can detect all burst errors less than r+1 bits r widely used in practice (ATM, HDLC)

11 5: DataLink Layer5-11 CRC Example Want: D. 2 r XOR R = nG equivalently: D. 2 r = nG XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ ] D.2rGD.2rG

12 5: DataLink Layer5-12 1 0 1 1 0 1 1 0 = Quotient (ignored) 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 = Remainder (FCS/CRC) + + + + + + + + CRC example: CRC computation(sender) Frame contents(M(x)): 11100110 with appended zeros(M(x) * 2 4 ): 11100110 0000 Generator polynomial(G(x)): 11001 Transmitted frame; 11100110 0110

13 5: DataLink Layer5-13 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + + + + + + + + 1 0 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 Error burst 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 1 + + + + + + + + CRC example: CRC check(receiver) Remainder ≠ 0: error detected Remainder = 0: no errors

14 5: DataLink Layer5-14 Error correction r Forward Error Correction(FEC) r Retransmission: aka ARQ(Automatic Repeat Request) m Stop-and-wait m Go-Back-N m Selective-Repeat r We already covered the retransmission methods in chap 3-4 when we deal with TCP reliable services.

15 5: DataLink Layer5-15 Stop-and-Wait ARQ I(0) I(1) I(2) I(3) I(4) ACK 0 timeout 중복된 (duplicate) 프레임은 폐기. ACK 1 ACK 2 ACK 3 ACK 4 데이터 프레임에 에러 ACK 에 에러 데이터 프레임에 에러가 발생하였다고 간주하고 재전송 데이터 프레임에 에러가 발생하였다고 간주하고 재전송 정상 동작 : 전송된 데이터에 대한 ACK 가 도착해야만 다음 번 데이터 전송

16 5: DataLink Layer5-16 Continuous ARQ I(0) I(1) I(2) I(3) I(4) I(5) I(6) I(4) I(5) I(6) I(7) I(0) I(1) I(7) I(0) I(1) I(2 3) I(4) timeout Retransmit all frames from I(4) Retransmit from I(7) Error on ACK(8) NAK(5) ACK(8) Error on I(4) ACK(1) I(0) I(1) I(2) I(3) I(4) I(5) I(6) I(4) I(7) I(0) I(1) I(2) I(3) I(4) I(1) I(5) I(6) I(7) ACK(1) timeout Retransmit only I(4) Retransmit only I(1) Error on ACK(2) NAK(4) ACK(2) Error on I(4) (a) Selective repeat(b) go-back-N............

17 5: DataLink Layer5-17 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-Layer Addressing r 5.5 Ethernet r 5.6 Hubs and switches r 5.7 PPP r 5.8 Link Virtualization: ATM

18 5: DataLink Layer5-18 Multiple Access Links and Protocols Two types of “links”: r point-to-point m PPP for dial-up access m point-to-point link between Ethernet switch and host r broadcast (shared wire or medium) m traditional Ethernet m upstream HFC m 802.11 wireless LAN

19 5: DataLink Layer5-19 Multiple Access protocols r single shared broadcast channel r two or more simultaneous transmissions by nodes: interference m collision if node receives two or more signals at the same time multiple access protocol r distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit r communication about channel sharing must use channel itself! m no out-of-band channel for coordination

20 5: DataLink Layer5-20 Ideal Mulitple Access Protocol Broadcast channel of rate R bps 1. When one node wants to transmit, it can send at rate R. 2. When M nodes want to transmit, each can send at average rate R/M 3. Fully decentralized: m no special node to coordinate transmissions m no synchronization of clocks, slots 4. Simple

21 5: DataLink Layer5-21 MAC Protocols: a taxonomy Three broad classes: r Channel Partitioning m divide channel into smaller “pieces” (time slots, frequency, code) m allocate piece to node for exclusive use r Random Access m channel not divided, allow collisions m “recover” from collisions r “Taking turns” m Nodes take turns, but nodes with more to send can take longer turns

22 5: DataLink Layer5-22 Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access r access to channel in "rounds" r each station gets fixed length slot (length = pkt trans time) in each round r unused slots go idle r example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle r TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load. r FDM (Frequency Division Multiplexing): frequency subdivided.

23 5: DataLink Layer5-23 Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access r channel spectrum divided into frequency bands r each station assigned fixed frequency band r unused transmission time in frequency bands go idle r example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle r TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load. r FDM (Frequency Division Multiplexing): frequency subdivided. frequency bands time

24 5: DataLink Layer5-24 Random Access Protocols r When node has packet to send m transmit at full channel data rate R. m no a priori coordination among nodes  two or more transmitting nodes ➜ “collision”, r random access MAC protocol specifies: m how to detect collisions m how to recover from collisions (e.g., via delayed retransmissions) r Examples of random access MAC protocols: m slotted ALOHA m ALOHA m CSMA, CSMA/CD, CSMA/CA

25 5: DataLink Layer5-25 Pure (unslotted) ALOHA r unslotted Aloha: simpler, no synchronization r when frame first arrives m transmit immediately r collision probability increases: m frame sent at t 0 collides with other frames sent in [t 0 -1,t 0 +1]

26 5: DataLink Layer5-26 CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame r If channel sensed busy, defer transmission r Human analogy: don’t interrupt others!

27 5: DataLink Layer5-27 CSMA collisions collisions can still occur: propagation delay means two nodes may not hear each other’s transmission collision: entire packet transmission time wasted spatial layout of nodes note: role of distance & propagation delay in determining collision probability

28 5: DataLink Layer5-28 CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA m collisions detected within short time m colliding transmissions aborted, reducing channel wastage r collision detection: m easy in wired LANs: measure signal strengths, compare transmitted, received signals m difficult in wireless LANs: receiver shut off while transmitting r human analogy: the polite conversationalist

29 5: DataLink Layer5-29 CSMA/CD collision detection

30 5: DataLink Layer5-30 “Taking Turns” MAC protocols channel partitioning MAC protocols: m share channel efficiently and fairly at high load m inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node! Random access MAC protocols m efficient at low load: single node can fully utilize channel m high load: collision overhead “taking turns” protocols look for best of both worlds!

31 5: DataLink Layer5-31 “Taking Turns” MAC protocols Polling: r master node “invites” slave nodes to transmit in turn r concerns: m polling overhead m latency m single point of failure (master) Token passing: r control token passed from one node to next sequentially. r token message r concerns: m token overhead m latency m single point of failure (token)

32 5: DataLink Layer5-32 Summary of MAC protocols r What do you do with a shared media? m Channel Partitioning, by time, frequency or code Time Division, Frequency Division m Random partitioning (dynamic), ALOHA, S-ALOHA, CSMA, CSMA/CD carrier sensing: easy in some technologies (wire), hard in others (wireless) CSMA/CD used in Ethernet CSMA/CA used in 802.11 m Taking Turns polling from a central site, token passing


Download ppt "5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross."

Similar presentations


Ads by Google