Introduction to Computer Networks. 03 Data Link Layer Introduction

Similar documents
Data Link Layer Overview

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

Data Link Layer Overview

Data Link Layer Overview

Data Link Layer Overview

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

Chapter 5 Link Layer and LANs

CSC 401 Data and Computer Communications Networks

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

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

Chapter 6 The Link Layer and LANs

CSCI-1680 Link Layer I Rodrigo Fonseca

Link layer, LANs: outline. Chapter 5-1 Link Layer. Link layer: introduction. Link layer services

Computer Networking. Lecture 4 - Coding and Error Control

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

CSE 123A Computer Networks

Links. CS125 - mylinks 1 1/22/14

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

ECE 4450:427/527 - Computer Networks Spring 2017

Some portions courtesy Robin Kravets and Steve Lumetta

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

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

CS 455/555 Intro to Networks and Communications. Link Layer

CS 4453 Computer Networks Winter

The Link Layer and LANs. Chapter 6: Link layer and LANs

Computer Networks LECTURE 10 ICMP, SNMP, Inside a Router, Link Layer Protocols. Assignments INTERNET CONTROL MESSAGE PROTOCOL

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

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

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

Lecture 6 Datalink Framing, Switching. From Signals to Packets

CSC 4900 Computer Networks: The Link Layer

5th Slide Set Computer Networks

Ch. 7 Error Detection and Correction

Chapter 5 Link Layer. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 16

Data Link Layer: Multi Access Protocols

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

UNIT I FUNDAMENTALS & LINK LAYER

Chapter 5: Link layer

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

Data Link Layer. Srinidhi Varadarajan

Chapter 5 Link Layer. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

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

PART III. Data Link Layer MGH T MGH C I 204

Link Layer and LANs 안상현서울시립대학교컴퓨터 통계학과.

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

Computer and Network Security

CSE 461: Framing, Error Detection and Correction

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

Lecture 8 Link Layer: functionality, error detection, media access algorithm

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

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

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

Lecture 19. Principles behind data link layer services Framing Multiple access protocols

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

Data Link Layer. Overview. Links. Shivkumar Kalyanaraman

Review. Some slides are in courtesy of J. Kurose and K. Ross

Networking Link Layer

Chapter 10 Error Detection and Correction. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Data Link Layer: Overview, operations

Module 10 Data Link Layer CS655! 10-1!

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

Transmission SIGNALs

UNIT I FUNDAMENTALS & LINK LAYER

Data Link Layer. Indian Institute of Technology Madras

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.

Chapter 5 Link Layer and LANs

DATA LINK LAYER UNIT 7.

CC451 Computer Networks

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

Lecture / The Data Link Layer: Framing and Error Detection

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

CS422 Computer Networks

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

Where we are in the Course

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

Chapter 3. The Data Link Layer

The Data Link Layer Chapter 3

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

Lecture 8 The Data Link Layer part I. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

CSCI-1680 Link Layer Reliability John Jannotti

Chapter V: Link Layer

CSCI-1680 Link Layer Reliability Rodrigo Fonseca

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

Chapter 10 Error Detection and Correction 10.1

Topics. Link Layer Services (more) Link Layer Services LECTURE 5 MULTIPLE ACCESS AND LOCAL AREA NETWORKS. flow control: error detection:

Data Link Protocols. High Level Data. Control Protocol. HDLC Framing ~~~~~~~~ Functions of a Data Link Protocol. Framing PDUs. Addressing Destination

UNIT-II 1. Discuss the issues in the data link layer. Answer:

Module 4 Data Link Layer CS655! 4-1!

Inst: Chris Davison

Message, Segment, Packet, and Frame Link-layer services Encoding, framing, error detection, transmission control Error correction and flow control

Lecture 20: Link Layer

CS321: Computer Networks Error Detection and Correction

Link Layer and LANs. Our Goals. Link Layer

CSCD 330 Network Programming

CS 43: Computer Networks The Link Layer. Kevin Webb Swarthmore College November 28, 2017

CS254 Network Technologies. Lecture 2: Network Models & Error Detection and Correction. Dr Nikos Antonopoulos

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

Lecture 6 The Data Link Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

CSE 123: Computer Networks

Transcription:

Introduction to Computer Networks 03 Data Link Layer Introduction

Link Layer 1 Introduction and services 2 Link Layer Services 2.1 Framing 2.2 Error detection and correction 2.3 Flow Control 2.4 Multiple access protocols 2.5 Switching 3 Ethernet

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

Link Layer Services framing, link access: encapsulate datagram into frame, adding header, trailer channel access if shared medium MAC addresses used in frame headers to identify source, dest different from IP address! reliable delivery between adjacent nodes We ll talk more about this when we discuss the Transport Layer seldom used on low bit-error link (fiber, some twisted pair)

Link Layer Services (more) flow control: pacing between adjacent sending and receiving nodes error detection: errors caused by signal attenuation, noise. receiver detects presence of errors: signals sender for retransmission or drops frame error correction: receiver identifies and corrects bit error(s) without resorting to retransmission

Where is the link layer implemented? in each and every host link layer implemented in adaptor (aka network interface card NIC) Ethernet card, PCMCI card, 802.11 card implements link, physical layer attaches into host s system buses combination of hardware, software, firmware application transport network link link physical cpu controller physical transmission host schematic memory host bus (e.g., PCI) network adapter card

Adaptors Communicating datagram datagram controller controller sending host frame datagram receiving host sending side: encapsulates datagram in frame adds error checking bits, flow control, etc. receiving side looks for errors,, flow control, etc extracts datagram, passes to upper layer at receiving side

From Signals to Packets Analog Signal Digital Signal Bit Stream 0 0 1 0 1 1 1 0 0 0 1 Packets 0100010101011100101010101011101110000001111010101110101010101101011010111001 Header/Body Header/Body Header/Body Packet Transmission Sender Receiver

Link Layer 1 Introduction and services 2 Link Layer Services 2.1 Framing 2.2 Error detection and correction 2.3 Flow Control 2.4 Multiple access protocols 2.5 Switching 3 Ethernet

Framing Byte Stuffing (also called sentinel) - Approach To view each frame as a collection of bytes (characters) rather than bits E.g. BISYNC (Binary Synchronous Communication) Protocol Developed by IBM (late 1960) Frame parts are denoted by sending special characters E.g. Syn 0x10 in BISYNC What happens when the special character is encountered in the data stream? Escape: DLE character in BISYNC

Framing BISYNC sentinel approach Frames transmitted beginning with leftmost field Beginning of a frame is denoted by sending a special SYN (synchronize) character Data portion of the frame is contained between special sentinel character STX (start of text) and ETX (end of text) SOH : Start of Header DLE : Data Link Escape CRC: Cyclic Redundancy Check BISYNC Frame Format

Framing Byte-counting approach DDCMP count : how many bytes are contained in the frame body If count is corrupted Framing error DDCMP Frame Format

Framing Bit-Stuffing Approach HDLC : High Level Data Link Control Beginning and Ending Sequences 0 1 1 1 1 1 1 0 HDLC Frame Format If the body contains five consecutive 1 s the sender inserts 0 before transmitting the next bit

Framing HDLC Protocol The receiving side: 5 consecutive 1 s Next bit is 0 : Stuffed, so discard it Next bit is 1: Either end of the frame or an error 6 consecutive 1 s Look at the next bit If 0 ( 01111110 ) End of the frame marker If 1 ( 01111111 ) Error, discard the frame, wait for 01111110

Ethernet Framing Preamble is 7 bytes of 10101010 followed by one byte of 10101011 With Manchester code, 10101 becomes 10 01 10 01 10, which looks like 1 00 11 00 11 0, which looks like a square wave Allows receivers to recognize start of transmission after idle channel 8 Bytes 6 Bytes 6 Bytes 2 Bytes 4 Bytes Each frame is followed by a minimum of 12 bytes of idle time called the Inter-frame Gap (IFG)

Clock-Based Framing Used by SONET and SDH Fixed size frames (810 bytes) Look for start of frame marker that appears every 810 bytes Will eventually sync up

Link Layer 1 Introduction and services 2 Link Layer Services 2.1 Framing 2.2 Error detection and correction 2.3 Flow Control 2.4 Multiple access protocols 2.5 Switching 3 Ethernet

Error Coding Transmission process may introduce errors into a message. Single bit errors versus burst errors Detection: Requires a convention that some messages are invalid Hence requires extra bits Correction Forward error correction: many related code words map to the same data word Detect errors and retry transmission

Error Detection D = Data protected by error checking, may include header fields EDC= Error Detection and Correction bits (redundancy) Error detection not 100% reliable! Protocol may miss some errors, but rarely Larger EDC field yields better detection and correction

Error Coding We ll discuss several error detection and correction codes: One dimension parity bit Error detection Internet checksum Error detection Two dimension parity Error detection and correction CRC Error detection

Parity Checking Single Bit Parity: Detect single bit errors

Internet Checksum Algorithm Not used at the datalink level Add up all the words that are transmitted and then transmit the result The result is called the checksum The receiver compares the result with the received checksum If any transmitted data, including the checksum itself, is corrupted, the receiver knows that an error occurred

Internet Checksum Algorithm Consider the data being checksummed as a sequence of 16-bit integers. Add them together using 16-bit ones complement arithmetic and then take the ones complement of the result. That 16-bit number is the checksum

Internet Checksum Algorithm In ones complement arithmetic, a negative integer x is represented as the complement of x; Each bit of x is inverted. When adding numbers in ones complement arithmetic, a carryout from the most significant bit needs to be added to the result.

Internet Checksum Algorithm To add two numbers represented in one s complement, one does a conventional binary addition, but it is then necessary to add any resulting carry back into the resulting sum Ones complement example: 1111111 11111110 (-1) + 00000010 ( 2) --------------- 100000000 +1 00000001

Internet Checksum Algorithm Easy to calculate From RFC 1071 (1988): /* Compute Internet Checksum for "count" bytes * beginning at location "addr". */ register long sum = 0; while( count > 1 ) { /* This is the inner loop */ sum += * (unsigned short) addr++; count -= 2; } /* Add left-over byte, if any */ if( count > 0 ) sum += * (unsigned char *) addr; /* Fold 32-bit sum to 16 bits */ while (sum>>16) sum = (sum & 0xffff) + (sum >> 16); checksum = ~sum; Easy to update if we have an existing checksum and we ve changed a few bits in a packet

Basic Concept: Hamming Distance Hamming distance of two bit strings = number of bit positions in which they differ. If the valid words of a code have minimum Hamming distance D, then D-1 bit errors can be detected. If the valid words of a code have minimum Hamming distance D, then [(D-1)/2] bit errors can be corrected. 1 0 1 1 0 1 1 0 1 0 HD=2 HD=3

Example: Parity What is the minimum Hamming distance between to valid code words using a single parity bit? How many bit errors can always be detected with parity? If there are more bit errors, how often will they be detected? What is [(D-1)/2] for parity? How many bit errors can be corrected with parity?

2D Parity 0 0

Cyclic Redundancy Check (CRC) Reduce the number of extra bits and maximize protection Based on polynomial arithmetic mod 2 Polynomial Arithmetic Modulo 2: Given a bit string 110001 we can associate a polynomial on a single variable x for it: 1.x 5 +1.x 4 +0.x 3 +0.x 2 +0.x 1 +1.x 0 = x 5 +x 4 +1 and the degree is 5.

Cyclic Redundancy Check (CRC) The coefficients are a single bit 0 or 1 Odd coefficients correspond to 1 (mod 2) Even coefficients correspond to 0 (mod 2) This way addition and multiplication can be performed: We can even do division:

Cyclic Redundancy Check (CRC) Let M(x) be a message polynomial and C(x) be a generator polynomial. Let M(x)/C(x) leave a remainder of 0. When M(x) is sent and M (x) is received we have M (x) = M(x)+E(x) The receiver computes M (x)/c(x) and if the remainder is nonzero, then an error has occurred. The only thing the sender and the receiver should know is C(x).

Cyclic Redundancy Check (CRC) How to create a frame with CRC: Let D(x) be an m bit message without CRC Let C(x) be an r bit generator (r<m) Append r-1 zero bits to the end of the message, so it contains m+r-1 bits and corresponds to x r D(x) Calculate the remainder R of the division x r D(x)/C(x) Subtract R from x r D(x) using modulo 2 subtraction (same as addition) The result is the frame M(x) to be transmitted.

Cyclic Redundancy Check (CRC)

Cyclic Redundancy Check (CRC) Now we send The receiver calculates

Cyclic Redundancy Check (CRC) A Second example (from a different book)

Cyclic Redundancy Check (CRC) Properties of Generator Polynomial Let M(x) represent what the sender sent and M (x) = M(x) + E(x) is the received string. A 1 in E(x) represents that in the corresponding position in M(x) the message the bit is flipped. We know that M(x)/C(x) leaves a remainder of 0, but if E(x)/C(x) leaves a remainder of 0, then either E(x) = 0 or C(x) is factor of E(x). When C(x) is a factor of E(x) we have problem; errors go unnoticed. If there is a single bit error then E(x) = x i, where i determines the bit in error. If C(x) contains two or more terms it will never divide E(x), so all single bit errors will be detected.

Cyclic Redundancy Check (CRC) Six generator polynomials that have become international standards are: CRC-8 = x 8 +x 2 +x+1 CRC-10 = x 10 +x 9 +x 5 +x 4 +x+1 CRC-12 = x 12 +x 11 +x 3 +x 2 +x+1 CRC-16 = x 16 +x 15 +x 2 +1 CRC-CCITT = x 16 +x 12 +x 5 +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

Link Layer 1 Introduction and services 2 Link Layer Services 2.1 Framing 2.2 Error detection and correction 2.3 Flow Control 2.4 Multiple access protocols 2.5 Switching 3 Ethernet

A Naïve Protocol Sender simply sends to the receiver whenever it has packets. Potential problem: sender can outrun the receiver. Receiver too slow, buffer overflow,.. Not always a problem: receiver might be fast enough. Sender Receiver

Adding Flow Control Stop and wait flow control: sender waits to send the next packet until the previous packet has been acknowledged by the receiver. Receiver can pace the receiver Sender Receiver

Stop & Wait Sender RTT Receiver Time Max Throughput = 1 pkt Roundtrip Time

Window Flow Control Stop and wait flow control results in poor throughput for long-delay paths: packet size/ roundtrip-time. Solution: receiver provides sender with a window that it can fill with packets. The window is backed up by buffer space on receiver Receiver acknowledges the a packet every time a packet is consumed and a buffer is freed Sender Receiver

Go-Back-N Sender RTT Receiver Time Max Throughput = Window Size Roundtrip Time

Flow Control Stop & Wait as well as Go-Back-N (GBN) are called ARQ protocols (Automatic Repeat request) Used for flow control and reliability In reality both ARQ and flow control is often not implemented or used at L2 E.g. regular Ethernet, just uses CRC for error detection We ll discuss both flow control and ARQ in the transport layer.

These slides were based on: CMU s 15-441 course with permission from Roger Dannenberg and Srinivasan Seshan Computer Networking: A Top Down Approach, 5th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. Computer Networks: A Systems Approach, 5e. Larry L. Peterson and Bruce S. Davie