Presentation on theme: "Lecture 12 Layer 2 – Data Link Layer Protocols"— Presentation transcript:
1Lecture 12 Layer 2 – Data Link Layer Protocols CS 453 Computer NetworksLecture 12Layer 2 – Data Link LayerProtocols
2Error Detection There are two forms of error control Error CorrectionBoth involve adding extra bits to the communication streamError detection - sensing and handling errors – resend, drop, …Error correction – sensing and correcting errors with available information
3Error Detection Think about this – What is the simplest way to detect errors in transmitted frames?Send each frame twiceCompare, if different – probable errorIs this efficient?Why?Is it fool-proof?What kind of errors could slip by?
4Error Detection You’re right (I hope) It is not efficient It reduces effective data rate in halfRepetitive errors to the same bit sequences would slip throughConsistently dropping the first five bits
5Error Detection Parity bits Simple form of error detection Even or odd parityFor 7 bits add an 8th bit such that the number of 1 bits is an even number (even parity)..…or odd (odd parity)If parity is even and the receiver gets a byte with an odd number of 1s, then error1111Parity bitData bits
6Error Detection Parity bits Very efficient – adds one bit per 7 bits Not very powerful – can detect 1 bit errors
7Error Detection Two Dimensional Parity Imagine data stream as matrix 6 byte data streamAdd parity bit per byte (simple parity)Add a parity byte where each bit is a parity bit for that bit position across the bytes in the frameFrom Peterson & Davie (2003) pg. 90
8Error Detection Two Dimensional Parity Fairly efficient Add 14 bits of redundant information to a 42 bit data streamFairly powerfulCan detect all 1, 2 and 3 bit errorsCan detect some 4 bit errorsWhy can it detech multibit errorsCan 2D parity be used to correct errors?
9Error Detection Internet Checksum Add the words in a data stream Suppose you have a stream of 16 bit integersAdd them using ones complement arithmeticSender calculates checksum…then sends data stream+checksumReceiver receives data stream+checksumReceive calculates new checksum on received data streamCompares it to the received checksumIf match – probably no errorIf no match – probably error
10Error Detection Internet Checksum Very efficient Fairly weak Only a few bits for a very long data streamFairly weakFor example, a dropped bit in one word and a spuriously added bit in another word would not be detected - would result in same ckecksumEasy to implement in hardware or software
11Error Detection CRC – Cyclic Redundancy Check More generally knows an polynomial codeCRC data stream…d bitsr bitsD: data bit from senderR: CRC bit
12Error Detection CRC – Cyclic Redundancy Check Sender and Receiver must agree on a r+1 bit pattern – referred to as GSome things to considerCRC calculations are done with base 2 arithmeticaddition/subtraction done with XORmultiplication/division done with left/right register shifts
13Error Detection CRC – Cyclic Redundancy Check What to use for R D * 2r XOR R = nGsays that D * 2r XOR R is an even multiple of G…or divisible with no remainderIf we XOR R to both sides of aboveD * 2r = nG XOR RIf we divide D * 2r by G the remainder is RR = remainder(D * 2r /G)Based on Kurose & Ross, Computer Networking: a top down structured approach using the Internet (2005) pg. 428
14from: Peterson & Davie (2003) pg.95 Error DetectionCRC – Cyclic Redundancy Checkconsider – original message DD =left shift 3 bit positions (multiply)Divide by GRemainder = Rfor CRC checkif R is subtracted from D…D-R is evenly divisible by GIf receiver gets D,R where (D-R ) /G has remainder there is an errorfrom: Peterson & Davie (2003) pg.95
15Error Detection CRC – Cyclic Redundancy Check CRC is very powerful Can detect multibit errorsCan detect burst errors < r+1 bitsSo where does G come from?MathematicsThere are lots of codes, predeterminedFor example-CRCIEEE