Η παρουσίαση φορτώνεται. Παρακαλείστε να περιμένετε

Η παρουσίαση φορτώνεται. Παρακαλείστε να περιμένετε

DataLink Layer1 Topic 2 Data Link Layer Part A The majority of the slides in this course are adapted from the accompanying slides to the books by Larry.

Παρόμοιες παρουσιάσεις


Παρουσίαση με θέμα: "DataLink Layer1 Topic 2 Data Link Layer Part A The majority of the slides in this course are adapted from the accompanying slides to the books by Larry."— Μεταγράφημα παρουσίασης:

1 DataLink Layer1 Topic 2 Data Link Layer Part A The majority of the slides in this course are adapted from the accompanying slides to the books by Larry Peterson and Bruce Davie and by Jim Kurose and Keith Ross. Additional slides and/or figures from other sources and from Vasos Vassiliou are also included in this presentation.

2 DataLink Layer2 The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m link layer addressing m reliable data transfer, flow control m sharing a broadcast channel: multiple access m examine various link layer technologies

3 DataLink Layer3 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 a datagram from one node to an adjacent node over a link

4 DataLink Layer4 Link layer: context r Datagram transferred by different link protocols over different links: m e.g., Ethernet on first link, frame relay on intermediate links, on last link r Each link protocol provides different services m e.g., may or may not provide reliable data transfer over link transportation analogy r trip from Princeton to Lausanne m limo: Princeton to JFK m plane: JFK to Geneva m train: Geneva to Lausanne r tourist = datagram r transport segment = communication link r transportation mode = link layer protocol r travel agent = routing algorithm

5 DataLink Layer5 Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header, trailer m channel access if shared medium m “MAC” addresses used in frame headers to identify source, dest different from IP address! r Flow Control: m pacing between adjacent sending and receiving nodes

6 DataLink Layer6 Link Layer Services (more) r Error Detection: m errors caused by signal attenuation, noise. m receiver detects presence of errors: signals sender for retransmission or drops frame r Error Correction: m receiver identifies and corrects bit error(s) without resorting to retransmission r Reliable delivery between adjacent nodes m Retransmissions 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?

7 DataLink Layer7 Link access r link layer implemented in “adaptor” (aka NIC) m Ethernet card, PCMCIA card, 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, reliable data transfer (rdt), flow control, etc m extracts datagram, passes to receiving node r adapter is semi- autonomous r link & physical layers sending node frame rcving node datagram frame adapter link layer protocol

8 DataLink Layer8 Link access Placement of the data link protocol.

9 DataLink Layer9 Framing r A frame also includes: m Destination Address (in Header) m Error Detection Code (in Trailer)

10 DataLink Layer10 Framing A character stream. (a) Without errors. (b) With one error.

11 DataLink Layer11 Framing (2) (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.

12 DataLink Layer12 Framing (3) Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing.

13 DataLink Layer13 Flow Control and Error Control r Fundamental mechanisms that determine performance r Can be implemented at different levels: link, network, or application r Difficult to model performance r Simplest case: point-to-point link m Constant propagation m Constant data rate m Probabilistic error rate m Traffic characteristics

14 DataLink Layer14 Error Control r Used to recover lost or damaged PDUs r Involves error detection and PDU retransmission r Implemented together with flow control in a single mechanism r Performed at various protocol levels

15 DataLink Layer15 Types of Error r An error occurs when a bit is altered between transmission and reception r Single bit errors m One bit altered m Adjacent bits not affected m White noise r Burst errors m Length B m Contiguous sequence of B bits in which first last and any number of intermediate bits in error m Impulse noise m Fading in wireless m Effect greater at higher data rates

16 DataLink Layer16 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

17 DataLink Layer17 Error Detection Process

18 DataLink Layer18 Parity Checking r Additional bits added by transmitter for error detection code r Parity m Value of parity bit is such that character has even (even parity) or odd (odd parity) number of ones m Even number of bit errors goes undetected

19 DataLink Layer19 Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors Detect up to 4 bit errors 0 0 Odd parity example

20 DataLink Layer20 Internet checksum Sender: r treat segment contents as sequence of 16-bit integers r checksum: addition (1’s complement sum) of segment contents r sender puts checksum value into checksum field Receiver: r compute checksum of received segment r check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? More later …. Goal: detect “errors” in transmitted segment (note: used at transport layer only)

21 DataLink Layer21 Cyclic Redundancy Check r For a block of k bits transmitter generates n bit sequence r Transmit k+n bits which is exactly divisible by some number r Receive divides frame by that number m If no remainder, assume no error

22 DataLink Layer22 Cyclic Redundancy Check 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, HDCL)

23 DataLink Layer23 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

24 DataLink Layer24 Error-Detecting Codes Calculation of the polynomial code checksum.

25 DataLink Layer25 Framing, Error Control and noise r Suppose that we have a frame of size n bits and the bit error probability = p (independent from the bit error probability in any other bit). r Probability of correct (no error) transmission of frame = (1-p) n r The larger the frame, the larger the error probability! r The smaller the frame, the larger the ratio of overhead information trasnmitted r If the error probability is “small”, then the receiver can ask for a retransmission. r If the error probability is “large”, then the it may be more effective to use a forward error correction code FEC.

26 DataLink Layer26 Error Correction r Correction of detected errors usually requires a data block to be retransmitted r Not appropriate for wireless applications m Bit error rate is high Lots of retransmissions m Propagation delay can be long (satellite) compared with frame transmission time Would result in retransmission of frame in error plus many subsequent frames r Need to correct errors on basis of bits received

27 DataLink Layer27 Working of Error Correction r Add redundancy to transmitted message r Can deduce original in face of certain level of error rate r E.g. block error correction code m In general, add (n – k ) bits to end of block Gives n bit block (codeword) All of original k bits included in codeword m Some FEC map k bit input onto n bit codeword such that original k bits do not appear

28 DataLink Layer28 Error Correction Process r Each k bit block mapped to an n bit block (n>k) m Codeword m Forward error correction (FEC) encoder r Codeword sent r Received bit string similar to transmitted but may contain errors r Received code word passed to FEC decoder m If no errors, original data block output m Some error patterns can be detected and corrected m Some error patterns can be detected but not corrected m Some (rare) error patterns are not detected Results in incorrect data output from FEC

29 DataLink Layer29 Error Correction Process

30 DataLink Layer30 Error-Correcting Codes Use of a Hamming code to correct burst errors.

31 DataLink Layer31 Κυκλικός Κώδικας Πλεονασμού (Cyclic Redundancy Check CRC). r Βασισμένη στη θεωρία των πεπερασμένων πεδίων.  Κάθε συρμός (bit stream) αντιπροσωπεύει ένα πολυώνυμο M(x)  ( n +1)-bit συρμός αντιπροσωπεύει πολυώνυμο βαθμού n.  1001  M(x) = 1x 3 +0x 2 +0x 1 +1x 0 = x 3 +x 0  Επιλογή διαιρέτη: Πολυώνυμο C(x) βαθμού k το οποίο γνωρίζουν ο αποστολέας και παραλήπτης.  Ο αποστολέας στέλνει το πολυώνυμο P(x) το οποίο είναι βαθμού n+k (δηλαδή n+k+1 bits).  Το πολυώνυμο P(x) επιλέγεται έτσι ώστε το υπόλοιπο της διαίρεσης P(x) / C(x) να είναι 0. m Ο παραλήπτης κάνει τη διαίρεση και αν υπάρχει υπόλοιπο τότε το δεδομένο πλαίσιο έχει κάποιο σφάλμα. m Εάν δεν υπάρχει υπόλοιπο, τότε πιθανότατα το πλαίσιο παραλήφθηκε σωστά.

32 DataLink Layer32 Ιδιότητες Διαίρεσης Πολυωνύμων  Ένα πολυώνυμο Τ(x) διαιρείται από το C(x) εφόσον το Τ(x) είναι μεγαλύτερου βαθμού από το C(x).  Ένα πολυώνυμο Τ(x) διαιρείται από το C(x) εφόσον το Τ(x) είναι ίσου βαθμού με το C(x).  Το υπόλοιπο της διαίρεσης Τ(x) / C(x) βρίσκεται με την αφαίρεση του C(x) από το Τ(x).  Η αφαίρεση του πολυωνύμου C(x) από το Τ(x) βρίσκεται απλά με την πράξη «αποκλειστικό ή» (Exclusive-OR (XOR)) σε κάθε ζεύγος αντίστοιχων συντελεστών.

33 DataLink Layer33 Κυκλικός Κώδικας Πλεονασμού  Ο αποστολέας θέλει να μεταδώσει τα δεδομένα που αντιστοιχούν στο πολυώνυμο M(x).  Αποστολέας και παραλήπτης συμφωνούν τον διαιρέτη C(x) ο οποίος είναι βαθμού k.  Ο αποστολέας πολλαπλασιάζει M(x) επί x k για να δημιουργήσει το πολυώνυμο T(x), δηλαδή T(x) = x k M(x).  Ο αποστολέας διαιρεί το Τ(x) δια C(x) και βρίσκει το υπόλοιπο R(x).  Αφαιρείται το R(x) από το Τ(x) και το αποτέλεσμα P(x) = Τ(x) - R(x) αποτελεί το συρμό ή πλαίσιο που αποστέλλεται στον παραλήπτη.

34 DataLink Layer34 Παράδειγμα r Ο αποστολέας θέλει να στείλει το συρμό r Αντίστοιχο πολυώνυμο:  Πολυώνυμο Διαίρεσης C(x)= x 3 +x 2 +1  Πολλαπλασιάζουμε το M(x) επί x 3 με αποτέλεσμα r Το οποίο αντιστοιχεί στο συρμό r Στη συνέχει εκτελούμε τη διαίρεση

35 DataLink Layer35 Παράδειγμα Η αφαίρεση αντιστοιχεί στην πράξη Exclusive-OR (XOR) Για συντομία οι μεταβλητές x δεν χρησιμοποιούνται αλλά απλά εννοούνται.

36 DataLink Layer Παράδειγμα Ο αποστολέας θα στείλει τον συρμό Μήνυμα CRC

37 DataLink Layer Παράδειγμα: Επαλήθευση παραλήπτη Υπόλοιπο =0, οπόταν πιθανότατα δεν υπάρχουν σφάλματα

38 DataLink Layer38 Πολυώνυμα Διαίρεσης C(x) CRCΠολυώνυμο CRC-8 CRC-10 CRC-12 x 8 +x 2 +x 1 +1 x 10 +x 9 +x 5 +x 4 +x 1 +1 x 12 +x 11 +x 3 +x 2 +x 1 +1 CRC-16 CRC-CCITT CRC-32 x 16 +x 15 +x 2 +1 x 16 +x 12 +x 5 +1 x 32 +x 26 +x 23 +x 22 +x 16 +x x 11 +x 10 +x 8 +x 7 +x 5 +x 4 +x 2 +x 1 +1


Κατέβασμα ppt "DataLink Layer1 Topic 2 Data Link Layer Part A The majority of the slides in this course are adapted from the accompanying slides to the books by Larry."

Παρόμοιες παρουσιάσεις


Διαφημίσεις Google