CSCI-1680 Link Layer I Rodrigo Fonseca

Similar documents
CSCI-1680 Link Layer Reliability Rodrigo Fonseca

CSCI-1680 Link Layer Reliability John Jannotti

Networking Link Layer

Point-to-Point Links. Outline Encoding Framing Error Detection Sliding Window Algorithm. Fall 2004 CS 691 1

CSMC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 4. September 09 CMSC417 Set 4 1

CS 640 Introduction to Computer Networks. Role of data link layer. Today s lecture. Lecture16

CSCI-1680 Physical Layer Link Layer I Rodrigo Fonseca

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 2.

CSE 461: Framing, Error Detection and Correction

EE 122: Error detection and reliable transmission. Ion Stoica September 16, 2002

Lecture 5. Homework 2 posted, due September 15. Reminder: Homework 1 due today. Questions? Thursday, September 8 CS 475 Networks - Lecture 5 1

2.4 Error Detection Bit errors in a frame will occur. How do we detect (and then. (or both) frames contains an error. This is inefficient (and not

High Level View. EE 122: Error detection and reliable transmission. Overview. Error Detection

Error Detection Codes. Error Detection. Two Dimensional Parity. Internet Checksum Algorithm. Cyclic Redundancy Check.

CSMC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. Nov 1,

Computer Network. Direct Link Networks Reliable Transmission. rev /2/2004 1

CSE 123A Computer Networks

Data Link Networks. Hardware Building Blocks. Nodes & Links. CS565 Data Link Networks 1

Introduction to Computer Networks. 03 Data Link Layer Introduction

Some portions courtesy Robin Kravets and Steve Lumetta

Problem Statement. Physical and Data Link Layer Overview. Five Tasks Encoding. Make two computers talk to each other

Links. CS125 - mylinks 1 1/22/14

Lecture 4: CRC & Reliable Transmission. Lecture 4 Overview. Checksum review. CRC toward a better EDC. Reliable Transmission

Transport Layer Marcos Vieira

Department of Computer and IT Engineering University of Kurdistan. Data Communication Netwotks (Graduate level) Data Link Layer

CompSci 356: Computer Network Architectures. Lecture 4: Link layer: Encoding, Framing, and Error Detection Ref. Chap 2.2, 2.3,2.4

Lecture 6: Reliable Transmission. CSE 123: Computer Networks Alex Snoeren (guest lecture) Alex Sn

Inst: Chris Davison

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 11, 2018

UNIT I FUNDAMENTALS & LINK LAYER

Overview. Performance metrics - Section 1.5 Direct link networks Hardware building blocks - Section 2.1 Encoding - Section 2.2 Framing - Section 2.

CSCI-1680 Transport Layer III Congestion Control Strikes Back Rodrigo Fonseca

Direct Link Networks. Framing. Lecture - Encoding & Framing 1. Problems. Areas for Discussion

Chapter 2: Getting Connected

Computer and Network Security

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 7

The Transport Layer Reliability

Housekeeping. Fall /5 CptS/EE 555 1

Data Link Layer: Overview, operations

From Signals to Packets Computer Networking. Link Layer: Implementation. Datalink Functions. Lecture 5 - Coding and Error Control

Data Link Layer (1) Networked Systems 3 Lecture 6

Data Link Layer. Srinidhi Varadarajan

CSE 123: Computer Networks

DATA LINK LAYER UNIT 7.

Computer Networking. Lecture 4 - Coding and Error Control

UNIT I FUNDAMENTALS & LINK LAYER

Lecture 7: Sliding Windows. CSE 123: Computer Networks Geoff Voelker (guest lecture)

CSE123A discussion session

Chapter 3. The Data Link Layer. Wesam A. Hatamleh

Direct Link Networks. Lecture - Encoding & Framing 1. Areas for Discussion. Problems

The data link layer has a number of specific functions it can carry out. These functions include. Figure 2-1. Relationship between packets and frames.

Direct Link Communication I: Basic Techniques. Data Transmission. ignore carrier frequency, coding etc.

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

ECE 4450:427/527 - Computer Networks Spring 2017

CSE 123: Computer Networks Alex C. Snoeren. HW 1 due NOW!

Where we are in the Course

Chapter 3. The Data Link Layer

CS422 Computer Networks

Reliable Transmission

Communications Software. CSE 123b. CSE 123b. Spring Lecture 3: Reliable Communications. Stefan Savage. Some slides couresty David Wetherall

Computer Networking. Reliable Transport. Reliable Transport. Principles of reliable data transfer. Reliable data transfer. Elements of Procedure

CSEP 561 Error detection & correction. David Wetherall

Data Link Layer. Overview. Links. Shivkumar Kalyanaraman

From Signals to Packets Computer Networking. Link Layer: Implementation. Network Delay. 06-datalink.ppt, , Fall

5th Slide Set Computer Networks

Overview. Data Link Technology. Role of the data-link layer. Role of the data-link layer. Function of the physical layer

Direct Link Networks (II)

CS 138: Communication I. CS 138 V 1 Copyright 2012 Thomas W. Doeppner. All rights reserved.

COMPUTER NETWORKS UNIT I. 1. What are the three criteria necessary for an effective and efficient networks?

Administrivia. FEC vs. ARQ. Reliable Transmission FEC. Last time: Framing Error detection. FEC provides constant throughput and predictable delay

Telecom Systems Chae Y. Lee. Contents. Flow Control Error Detection/Correction Link Control (Error Control) Link Performance (Utility)

SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY COMPUTER NETWORKS UNIT - II DATA LINK LAYER

Links Reading: Chapter 2. Goals of Todayʼs Lecture. Message, Segment, Packet, and Frame

L5: Building Direct Link Networks III. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

The Data Link Layer Chapter 3

Data Link Technology. Suguru Yamaguchi Nara Institute of Science and Technology Department of Information Science

2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLS Collision Free Protocols 2.3 FDDI 2.4 DATA LINK LAYER DESIGN ISSUES 2.5 FRAMING & STUFFING

CS 4453 Computer Networks Winter

CSE 123: Computer Networks

CS 43: Computer Networks. 16: Reliable Data Transfer October 8, 2018

Networked Systems and Services, Fall 2018 Chapter 2. Jussi Kangasharju Markku Kojo Lea Kutvonen

COMPUTER NETWORKS CS CS 55201

CS321: Computer Networks Error Detection and Correction

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

Lecture 6 Datalink Framing, Switching. From Signals to Packets

Reliable Byte-Stream (TCP)

1/29/2008. From Signals to Packets. Lecture 6 Datalink Framing, Switching. Datalink Functions. Datalink Lectures. Character and Bit Stuffing.

COMPUTER NETWORKS CS CS 55201

Direct Link Communication I: Basic Techniques. Data Transmission. ignore carrier frequency, coding etc.

NWEN 243. Networked Applications. Layer 4 TCP and UDP

CSCI-1680 Transport Layer I Rodrigo Fonseca

Ch. 7 Error Detection and Correction

Telematics. 5rd Tutorial - LLC vs. MAC, HDLC, Flow Control, E2E-Arguments

The Data Link Layer Chapter 3

End-to-End Protocols. End-to-End Protocols

Computer Networks. Shyam Gollakota

Data Communication & Computer Networks INFO

COMPUTER NETWORKS UNIT-3

Data Link Layer Overview

Flow Control, and Congestion Control

Transcription:

CSCI-1680 Link Layer I Rodrigo Fonseca Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti

Last time Physical layer: encoding, modulation Today Link layer framing Getting frames across: reliability, performance

Layers, Services, Protocols Application Transport Network Link Physical Service: user-facing application. Application-defined messages Service: multiplexing applications Reliable byte stream to other node (TCP), Unreliable datagram (UDP) Service: move packets to any other node in the network IP: Unreliable, best-effort service model Service: move frames to other node across link. May add reliability, medium access control Service: move bits to other node across link

Link Layer Framing

Framing Given a stream of bits, how can we represent boundaries? Break sequence of bits into a frame Typically done by network adaptor Bits Node A Adaptor Adaptor Node B Frames

Representing Boundaries Sentinels Length counts Clock-based Bits Node A Adaptor Adaptor Node B Frames

Sentinel-based Framing Byte-oriented protocols (e.g. BISYNC, PPP) Place special bytes (SOH, ETX, ) in the beginning, end of messages 8 8 8 8 8 16 SYN SYN SOH Header STX Body ETX CRC What if ETX appears in the body? Escape ETX byte by prefixing DEL byte Escape DEL byte by prefixing DEL byte Technique known as character stuffing

Bit-Oriented Protocols View message as a stream of bits, not bytes Can use sentinel approach as well (e.g., HDLC) 8 16 16 8 Beginning sequence Header Body HDLC begin/end sequence 01111110 CRC Use bit stuffing to escape 01111110 Ending sequence Always append 0 after five consecutive 1s in data After five 1s, receiver uses next two bits to decide if stuffed, end of frame, or error.

Length-based Framing Drawback of sentinel techniques Length of frame depends on data Alternative: put length in header (e.g., DDCMP) 8 8 8 14 42 16 SYN SYN Class Count Header Body CRC Danger: Framing Errors What if high bit of counter gets corrupted? Adds 8K to length of frame, may lose many frames CRC checksum helps detect error

Clock-based Framing E.g., SONET (Synchronous Optical Network) Each frame is 125μs long Look for header every 125μs Encode with NRZ, but first XOR payload with 127-bit string to ensure lots of transitions Overhead Payload 9 rows 90 columns

Error Detection Basic idea: use a checksum Compute small checksum value, like a hash of packet Good checksum algorithms Want several properties, e.g., detect any single-bit error Details later

Link Layer Getting Frames Across Reliability and Performance

Sending Frames Across Transmission Delay Propagation Delay Latency

Sending Frames Across Throughput: bits / s

Which matters most, bandwidth or delay? How much data can we send during one RTT? E.g., send request, receive file Request Response Time For small transfers, latency more important, for bulk, throughput more important

Performance Metrics Throughput - Number of bits received/unit of time e.g. 10Mbps Goodput - Useful bits received per unit of time Latency How long for message to cross network Process + Queue + Transmit + Propagation Jitter Variation in latency

Processing Latency Per message, small, limits throughput e.g. or 120μs/pkt Queue Highly variable, offered load vs outgoing b/w Transmission 100Mb pkt s 1500B B 8,333pkt /s 8b Size/Bandwidth Propagation Distance/Speed of Light

Reliable Delivery Several sources of errors in transmission Error detection can discard bad frames Problem: if bad packets are lost, how can we ensure reliable delivery? Exactly-once semantics = at least once + at most once

At Least Once Semantics How can the sender know packet arrived at least once? Acknowledgments + Timeout Stop and Wait Protocol S: Send packet, wait R: Receive packet, send ACK S: Receive ACK, send next packet S: No ACK, timeout and retransmit

Sender Receiver Frame 0 ACK 0 Time Frame 1 ACK 1 Frame 0 ACK 0

Sender Receiver Sender Receiver Frame Frame Time Timeout ACK Timeout ACK Frame Timeout ACK (a) (c) Sender Receiver Sender Receiver Frame Frame Timeout ACK Frame Timeout Timeout Timeout Frame ACK ACK (b) (d)

Stop and Wait Problems Duplicate data Duplicate acks Slow (channel idle most of the time!) May be difficult to set the timeout value

Duplicate data: adding sequence numbers Sender Receiver Frame 0 ACK 0 Time Frame 1 ACK 1 Frame 0 ACK 0

At Most Once Semantics How to avoid duplicates? Uniquely identify each packet Have receiver and sender remember Stop and Wait: add 1 bit to the header Why is it enough?

Going faster: sliding window protocol Still have the problem of keeping pipe full Generalize approach with > 1-bit counter Allow multiple outstanding (unacked) frames Upper bound on unacked frames, called window Sender Receiver Time

How big should the window be? Sender Receiver Time How many bytes can we transmit in one RTT? BW B/s x RTT s => Bandwidth-Delay Product

Maximizing Throughput Delay Bandwidth Can view network as a pipe For full utilization want bytes in flight bandwidth delay But don t want to overload the network (future lectures) What if protocol doesn t involve bulk transfer? Get throughput through concurrency service multiple clients simultaneously

Sliding Window Sender Assign sequence number (SeqNum) to each frame Maintain three state variables send window size (SWS) last acknowledgment received (LAR) last frame sent (LFS) LAR SWS LFS Maintain invariant: LFS LAR SWS Advance LAR when ACK arrives Buffer up to SWS frames

Sliding Window Receiver Maintain three state variables: receive window size (RWS) largest acceptable frame (LAF) last frame received (LFR) RWS LFR Maintain invariant: LAF LFR RWS Frame SeqNum arrives: if LFR < SeqNum LAF, accept if SeqNum LFR or SeqNum > LAF, discard Send cumulative ACKs LAF

Tuning Send Window How big should SWS be? Fill the pipe How big should RWS be? 1 RWS SWS How many distinct sequence numbers needed?

Example SWS = RWS = 5. Are 6 seq #s enough? Sender sends 0,1,2,3,4 All acks are lost Sender sends 0,1,2,3,4 again What are the possible views of the sender and receiver?

Tuning Send Window How big should SWS be? o Fill the pipe How big should RWS be? o 1 RWS SWS How many distinct sequence numbers needed? o SWS can t be more than half of the space of valid seq#s.

Summary Want exactly once At least once: acks + timeouts + retransmissions At most once: sequence numbers Want efficiency Sliding window

Error Detection and Correction

Error Detection Idea: have some codes be invalid Must add bits to catch errors in packet Sometimes can also correct errors If enough redundancy Might have to retransmit Used in multiple layers Three examples today: Parity Internet Checksum CRC

Simplest Schemes Repeat frame n times Can we detect errors? Can we correct errors? Voting Problem: high redundancy : n Example: send each bit 3 times Valid codes: 000 111 Invalid codes : 001 010 011 100 101 110 Corrections : 0 0 1 0 1 1

Parity Add a parity bit to the end of a word Example with 2 bits: Valid: 000 011 101 110 Invalid: 001 010 010 111 Can we correct? Can detect odd number of bit errors No correction

In general Hamming distance: number of bits that are different E.g.: HD (00001010, 01000110) = 3 If min HD between valid codewords is d: Can detect d-1 bit error Can correct (d-1)/2 bit errors What is d for parity and 3-voting?

2-D Parity 0101001 1 1101001 0 Parity bits Data 1011110 1 0001110 1 Parity byte 0110100 1 1011111 0 1111011 0 Add 1 parity bit for each 7 bits Add 1 parity bit for each bit position across the frame) Can correct single-bit errors Can detect 2- and 3-bit errors, most 4-bit errors Find a 4-bit error that can t be corrected

IP Checksum Fixed-length code n-bit code should capture all but 2 -n fraction of errors Why? Trick is to make sure that includes all common errors IP Checksum is an example 1 s complement of 1 s complement sum of every 2 bytes uint16 cksum(uint16 *buf, int count) { uint32 sum = 0; while (count--) if ((sum += *buf++) & 0xffff0000) // carry sum = (sum & 0xffff) + 1; return ~(sum & 0xffff); } Checking Do the sum again, including the checksum. If correct, the sum should be all 1 s (This is super fast to check)

How good is it? 16 bits not very long: misses how many errors? 1 in 2 16, or 1 in 64K errors Checksum does catch all 1-bit errors But not all 2-bit errors E.g., increment word ending in 0, decrement one ending in 1 Checksum also optional in UDP All 0s means no checksums calculated If checksum word gets wiped to 0 as part of error, bad news

From rfc791 (IP) This is a simple to compute checksum and experimental evidence indicates it is adequate, but it is provisional and may be replaced by a CRC procedure, depending on further experience.

CRC Error Detection with Polynomials Goal: maximize protection, minimize bits Consider message to be a polynomial in Z 2 [x] Each bit is one coefficient E.g., message 10101001 -> m(x) = x 7 + x 5 + x 3 + 1 Can reduce one polynomial modulo another Let n(x) = m(x)x 3. Let C(x) = x 3 + x 2 + 1. n(x) mod C(x) : r(x) Find q(x) and r(x) s.t. n(x) = q(x)c(x) + r(x) and degree of r(x) < degree of C(x) Analogous to taking 11 mod 5 = 1

Polynomial Division Example Just long division, but addition/subtraction is XOR Generator 1101 11111001 10011010000 Message 1101 1001 1101 1000 1101 1011 1101 1100 1101 1000 1101 101 Remainder

CRC Select a divisor polynomial C(x), degree k C(x) should be irreducible not expressible as a product of two lower-degree polynomials in Z 2 [x] Add k bits to message Let n(x) = m(x)x k (add k 0 s to m) Compute r(x) = n(x) mod C(x) Compute n'(x) = n(x) r(x) (will be divisible by C(x)) (subtraction is XOR, just set k lowest bits to r(x)!) Checking CRC is easy Reduce message by C(x), make sure remainder is 0

Why is this good? Suppose you send m(x), recipient gets m (x) E(x) = m (x) m(x) (all the incorrect bits) If CRC passes, C(x) divides m (x) Therefore, C(x) must divide E(x) Choose C(x) that doesn t divide any common errors! All single-bit errors caught if x k, x 0 coefficients in C(x) are 1 All 2-bit errors caught if at least 3 terms in C(x) Any odd number of errors if last two terms (x + 1) Any error burst less than length k caught

Common CRC Polynomials Polynomials not trivial to find Some studies used (almost) exhaustive search CRC-8: x 8 + x 2 + x 1 + 1 CRC-16: x 16 + x 15 + x 2 + 1 CRC-32: x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x 1 + 1 CRC easily computable in hardware

An alternative for reliability Erasure coding Assume you can detect errors Code is designed to tolerate entire missing frames Collisions, noise, drops because of bit errors Forward error correction Examples: Reed-Solomon codes, LT Codes, Raptor Codes Property: From K source frames, produce B > K encoded frames Receiver can reconstruct source with any K frames, with K slightly larger than K Some codes can make B as large as needed, on the fly

LT Codes Luby Transform Codes Michael Luby, circa 1998 Encoder: repeat B times 1. Pick a degree d 2. Randomly select d source blocks. Encoded block t n = XOR or selected blocks

LT Decoder Find an encoded block t n with d=1 Set s n = t n For all other blocks t n that include s n, set t n =t n XOR s n Delete s n from all encoding lists Finish if 1. You decode all source blocks, or 2. You run out out blocks of degree 1

Next class Link Layer II Ethernet: dominant link layer technology Framing, MAC, Addressing Switching