Link Layer Dr. Mozafar Bag-Mohammadi Ilam University.

Slides:



Advertisements
Similar presentations
EE 4272Spring, 2003 Chapter 7 Data Link Control Objectives: Effective & reliable data communication between two directly connected transmitting-receiving.
Advertisements

Lecture 3, 1Spring 2003, COM1337/3501CCN: Direct Link Networks Direct Link Networks Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie,
CSCI-1680 Link Layer Reliability Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
5-1 Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path.
Spring 2002CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
CSCI 4550/8556 Computer Networks Comer, Chapter 7: Packets, Frames, And Error Detection.
EE 122: Error detection and reliable transmission Ion Stoica September 16, 2002.
1 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
The OSI Reference Model
1 Hardware Building Blocks Five Issues –Encoding –Framing –Error Detection –Reliable delivery –Access Mediation Direct Link Networks.
Chapter 5 Link Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 20.
Spring 2004 EE4272 Direct Link Networks (I) Hardware Building Blocks (nodes & links) 5 Issues before Exchanging Packets  Encoding  Framing  Error Detection.
Spring 2003CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Networking. Protocol Stack Generally speaking, sending an message is equivalent to copying a file from sender to receiver.
18-Aug-154/598N: Computer Networks Overview Direct link networks –Error detection - Section 2.4 –Reliable transmission - Section 2.5.
Introduction 1 Lecture 23 Link Layer (Error Detection/Correction) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Part 1: Overview of the Data Link layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose,
CS 640: Introduction to Computer Networks Aditya Akella Lecture 5 - Encoding and Data Link Basics.
EE 122: Encoding And Framing Ion Stoica September 9, 2002.
CSE331: Introduction to Networks and Security Lecture 3 Fall 2002.
14-Oct-15Computer Networks1 Reliable Transmission.
1 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
CSS CSS432 Point-to-Point Links Textbook Ch2.1.2 – 2.5 Professor: Munehiro Fukuda.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.
Univ. of TehranComputer Network1 Computer Networks Computer Networks (Graduate level) University of Tehran Dept. of EE and Computer Engineering By: Dr.
CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION.
Lecture 6: Framing and Error Detection-Data Link Layer Functions
27-Oct-15Computer Networks1 Outline Chapter 2: Direct Link Networks Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
4: DataLink Layer1 Chapter 4: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
Fall 2000Datacom 11 Outline Hardware Building Blocks Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful.
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.
Chapter 5 Link Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 Link Layer introduction,
1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION.
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 12: Reliability Slides used with permissions.
Spring 2001CS 5851 Outline Building Blocks Shannon’s Theorem Encoding 11. Physical Layer.
9-Jan-164/598N: Computer Networks Overview Performance metrics - Section 1.5 Direct link networks –Hardware building blocks - Section 2.1 –Encoding - Section.
5: DataLink Layer5a-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction.
Transport Layer: Sliding Window Reliability
Univ. of TehranIntroduction to Computer Network1 An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr.
1 Hardware Building Blocks Five Issues –Encoding –Framing –Error Detection –Reliable delivery –Access Media Direct Link Networks.
1 Point-to-Point Links: Encoding Encoding: Section 2.2 (Section 2.1 read on your own)
Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
1 Direct Link Networks: Reliable Transmission Sections 2.5.
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429/556 Introduction to Computer Networks Reliability Some slides used with permissions.
CSE331: Introduction to Networks and Security Lecture 4 Fall 2002.
Univ. of TehranComputer Network1 Computer Networks Computer Networks (Graduate level) University of Tehran Dept. of EE and Computer Engineering By: Dr.
Univ. of TehranIntroduction to Computer Network1 An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr.
Computer Networking Lecture 16 – Reliable Transport.
CS380 Int. to Comp. Networks Data Link Networks - Part II1 Reliable Transmission How to fix corrupted frames. –Error correcting codes too expensive –Should.
CS4470 Computer Networking Protocols
Getting Connected (Chapter 2 Part 1)
Data Link Networks Hardware Building Blocks Nodes & Links CS380
Data Link Layer.
Advanced Computer Networks
COMP/ELEC 429/556 Introduction to Computer Networks
CSS432 Point-to-Point Links Textbook Ch2.1 – 2.5
Link Layer and LANs Its not about how hard you hit... It's about how hard you can get hit and keep moving forward 5: DataLink Layer.
Reliable transmission
Point-to-Point Links Outline Encoding Framing Error Detection
Ion Stoica September 6, 2001 EE 122: Lecture 4 Ion Stoica September 6, 2001.
Advanced Computer Networks
Fundamentals of Computer Networks
Hardware Building Blocks
Transport Layer Outline Intro to transport UDP
Dr. Mozafar Bag-Mohammadi Ilam University
Error detection: Outline
EECS 122: EE122: Error Detection and Reliable Transmission
Data Link Layer. Position of the data-link layer.
Presentation transcript:

Link Layer Dr. Mozafar Bag-Mohammadi Ilam University

Contents 1. Overview 2. Encoding 3. Framing 4. Error detection 5. Acknowledgements & Timeouts

1. Overview: Link Layer

Link layer r Communication service between two physically connected devices: m host-router, router-router, host-host r unit of data: frame  implemented in “ adapter ” m e.g., PCMCIA card, Ethernet card m typically includes: RAM, DSP chips, host bus interface, and link interface application transport network link physical network link physical M M M M H t H t H n H t H n H l M H t H n H l frame phys. link data link protocol adapter card

Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header, trailer m implement channel access if shared medium,  ‘ physical addresses ’ used in frame headers to identify source, dest different from IP address! r Reliable delivery between two physically connected devices: m seldom used on low bit error link (fiber, some twisted pair) m wireless links: high error rates

Link Layer Services (more) r Flow Control: m pacing between sender and receivers 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

2.Encoding r Encode binary data onto signals r Bits flow is between network adaptors. r How to send clock information? m Extract from signals or data. r The simplest way is 0 as low signal and 1 as high signal. This is known as Non-Return to zero (NRZ) Bits NRZ

Problem with NRZ r Consecutive 0’s or 1’s may create problems. m Synchronization problem because of difference in the sender or receiver clocks. m The average of signals which is used to distinguish between low or high may move and make the decoding difficult. This is called baseline wander m Unable to recover clock

Alternative Encodings r Non-return to Zero Inverted (NRZI) m make a transition from current signal to encode a 1; stay at current signal to encode a zero m solves the problem of consecutive 1s r Manchester encoding m transmit XOR of the NRZ encoded data and the clock. m 0 is being encoded as a low to high transition and 1 as high to low. m It doubles the rate, then, it is only 50% efficient. m The rate signal changing is called baud rate.

Encodings (cont) Bits NRZ Clock Manchester NRZI

4B/5B Encoding r 4B/5B: The idea is insert extra bits to break the consecutive bit patterns. r every 4 bits of data encoded in a 5-bit code

4B/5B Encoding (cont) r 5-bit codes selected to have no more than one leading 0 and no more than two trailing 0s r thus, never get more than three consecutive 0s r resulting 5-bit codes are transmitted using NRZI r achieves 80% efficiency. r Unused code are used for control. I.e is for line is idle or for the line is dead. r FDDI is using this scheme.

3.Framing r How to distinguish between data and garbage. r Break sequence of bits into a frame r Typically implemented by network adaptor

Byte-oriented Approaches r Sentinel-based m delineate frame with special pattern: or STX, ETX, etc characters. m e.g., HDLC, SDLC, PPP HeaderBody CRC ASCII character 1 soh (start of header) ASCII character 4 eot (end of transmission) HeaderBody CRC

Byte-oriented Approaches m problem: special pattern or characters appear in the payload m solution: bit stuffing –sender: insert 0 after five consecutive 1s –receiver: delete 0 that follows five consecutive 1s

Byte stuffing

Byte-oriented Approaches (cont) r Counter-based m include payload length in the header m e.g., DDCMP protocol from DEC. m problem: count field corrupted m solution: catch when CRC fails

4.Error Detection r To send extra information to find error in the frame. r The simplest form is sending two copies, m inefficient. r Sending the sum of values (?) in the frame, checksum. m In Internet, consider 16 bits sequences and then use one- complement to find the result. r Sending parity, odd or even parity. m Odd parity of is

Internet Checksum Algorithm r View message as a sequence of 16-bit integers; sum using 16- bit ones-complement arithmetic; take ones-complement of the result. u_short cksum(u_short *buf, int count) { register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } return ~(sum & 0xFFFF); }

Error Detection r Two dimensional parity, adding one extra bit, parity bit, to code and also find the parity for each bit position for total data

Cyclic Redundancy Code (CRC) Add k bits of redundant data to an n-bit message Where k << n e.g., k = 32 and n = 12,000 (1500 bytes)

CRC(cont) r Represent n-bit message as n-1 degree polynomial m e.g., MSG= as M(x) = x 7 + x 4 + x 3 + x 1 r Let k be the degree of some divisor polynomial m e.g., C(x) = x 3 + x r Transmit polynomial T(x) that is evenly divisible by C(x) m shift left k bits, i.e., M(x)x k m subtract remainder of M(x)x k / C(x) from M(x)x k

CRC (cont) r Receiver polynomial T(x) + E(x) m E(x) = 0 implies no errors r Divide (T(x) + E(x)) by C(x); remainder zero if: m E(x) was zero (no error), or m E(x) is exactly divisible by C(x) r All operation is done in modulo 2 in which there is no carry. Then, the operation can be done by XOR only.

CRC(cont) Example: M(x)= , C(x) = R The final transmitted message is: T(x) =

Example

5.Acknowledgements & Timeouts

Stop-and-Wait r Problem: keeping the pipe full r Example  1.5Mbps link x 45ms RTT = 67.5Kb (8KB) m 1KB frames imples 1/8th link utilization SenderReceiver

Sliding Window r Allow multiple outstanding (un-ACKed) frames r Upper bound on un-ACKed frames, called window SenderReceiver T ime … …

SW: Sender  Assign sequence number to each frame ( SeqNum ) r Maintain three state variables:  send window size ( SWS )  last acknowledgment received ( LAR )  last frame sent ( LFS )  Maintain invariant: LFS - LAR <= SWS  Advance LAR when ACK arrives  Buffer up to SWS frames  SWS LARLFS ……

SW: Receiver r Maintain three state variables  receive window size ( RWS )  largest frame acceptable ( LFA )  last frame received ( LFR )  Maintain invariant: LFA - LFR <= RWS  Frame SeqNum arrives:  if LFR =< SeqNum < = LFA  accept  if SeqNum LFA  discarded r Send cumulative ACKs  RWS LFRLFA ……

Sequence Number Space  SeqNum field is finite; sequence numbers wrap around r Sequence number space must be larger then number of outstanding frames  SWS <= MaxSeqNum-1 is not sufficient  suppose 3-bit SeqNum field (0..7) m SWS=RWS=7 m sender transmit frames 0..6 m arrive successfully, but ACKs lost m sender retransmits 0..6 m receiver expecting 7, 0..5, but receives second incarnation of 0..5  SWS < (MaxSeqNum+1)/2 is correct rule  Intuitively, SeqNum “slides” between two halves of sequence number space

Concurrent Logical Channels r Multiplex 8 logical channels over a single link r Run stop-and-wait on each logical channel r Header: 3-bit channel num, 1-bit sequence num m 4-bits total m same as sliding window protocol r Maintain three state bits per channel m channel busy m current sequence number out m next sequence number in r Separates reliability from order