Computer Networks. Data Link Layer



Similar documents
CMPE 150 Winter 2009

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

Chapter 3: Sample Questions, Problems and Solutions Bölüm 3: Örnek Sorular, Problemler ve Çözümleri

Data Link Layer Overview

Data Link Layer. Flow Control. Flow Control

High-Level Data Link Control

Transport Layer Protocols

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

Stop And Wait. ACK received; transmit frame 2 CS 455 3

Sheet 7 (Chapter 10)

LLC: Frame Construction. Layer 2: Division into two Parts. Error-detecting and -correcting Codes. Error-correcting Codes

Computer Networks. Chapter 5 Transport Protocols

OSI Model. Application Presentation Session Transport Network Data Link Physical. EE156 Computer Network Architecture

Data Link Protocols. 5.4 Framing

Applied Data Communication Lecture 14

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT COMPUTER NETWORKS

Module 1. Introduction. Version 2 CSE IIT, Kharagpur

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Indian Institute of Technology Kharagpur. TCP/IP Part I. Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology

Review of Error Detection of Data Link Layer in Computer Network

DATA COMMUNICATION AND NETWORKS

Digital Audio and Video Data

LAN Switching Computer Networking. Switched Network Advantages. Hubs (more) Hubs. Bridges/Switches, , PPP. Interconnecting LANs

[Prof. Rupesh G Vaishnav] Page 1

A Transport Protocol for Multimedia Wireless Sensor Networks

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Distributed Real-Time Systems (TI-DRTS) Track 2. CAN-BUS Introduction. Version Ref. VECTOR application note & Motorola note

Written examination in Computer Networks

Operating Systems and Computer Networks / Datenverarbeitung 2 / Data Processing 2

Computer Networks UDP and TCP

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

0,2 D(0) A(1) D(1) 1,3 D(2) 0,2 D(0) A(1) D(1) 1,3 D(2) D(3) D(3) D(1) D(1) A(4) D(2) 4,6 D(3) A(4) 4,6 GO BACK 3 SELECTIVE REJECT WINDOW SLIDES

Protocols and Architecture. Protocol Architecture.

Data Communications & Networks. Session 6 Main Theme Reliable Data Transfer. Dr. Jean-Claude Franchitti

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

PROPERTY MANAGEMENT SYSTEM

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

Access Control: Firewalls (1)

Ethernet. Ethernet. Network Devices

Application Protocols for TCP/IP Administration

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

How To Design A Layered Network In A Computer Network

WAN Data Link Protocols

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

Networking Test 4 Study Guide

Security (II) ISO : Security Architecture of OSI Reference Model. Outline. Course Outline: Fundamental Topics. EE5723/EE4723 Spring 2012

The finite field with 2 elements The simplest finite field is

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

EKSAMEN / EXAM TTM

Welcome to the Introduction to Controller Area Network web seminar My name is William Stuart, and I am a Applications Engineer for the Automotive

The OSI Model and the TCP/IP Protocol Suite

IP - The Internet Protocol

Ring Local Area Network. Ring LANs

A study of Skype over IEEE networks: voice quality and bandwidth usage

Chapter 9. IP Secure

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Implementing and testing tftp

(Refer Slide Time: 02:17)

PRODUCT MANUAL SKX OPEN SKX ADVANCE ZN1RX-SKXOPEN. Edition 2 Version 1.1

6.02 Fall 2012 Lecture #5

TCP in Wireless Mobile Networks

Channel Bonding in DOCSIS 3.0. Greg White Lead Architect Broadband Access CableLabs

Guide to TCP/IP, Third Edition. Chapter 3: Data Link and Network Layer TCP/IP Protocols

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

GATE CS Topic wise Questions Computer Network

FIREWALLS & NETWORK SECURITY with Intrusion Detection and VPNs, 2 nd ed. Chapter 2 An Introduction to Networking

Data Link Protocols. TCP/IP Suite and OSI Reference Model

COMPUTER NETWORKS REVIEW QUESTIONS AND PROBLEMS

DATA COMMUNICATIONS AND NETWORKING. Solved Examples

EITF25 Internet Techniques and Applications L5: Wide Area Networks (WAN) Stefan Höst

Error detection using CRC

The internetworking solution of the Internet. Single networks. The Internet approach to internetworking. Protocol stacks in the Internet

Mobile Communications Chapter 9: Mobile Transport Layer

RTP / RTCP. Announcements. Today s Lecture. RTP Info RTP (RFC 3550) I. Final Exam study guide online. Signup for project demos

Visualizations and Correlations in Troubleshooting

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

RS-485 Protocol Manual

Lecture 2: Protocols and Layering. CSE 123: Computer Networks Stefan Savage

3.4 SLIDING WINDOW PROTOCOLS

CCNA R&S: Introduction to Networks. Chapter 5: Ethernet

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

CAN Specification 2.0, Part B page 1 PART B. CAN in Automation, Am Weichselgarten 26, D Erlangen

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

Process Control and Automation using Modbus Protocol

TCP Session Management (SesM) Protocol Specification

Data Link Protocols. Link Layer Services. Framing, Addressing, link access: Error Detection:

Mathematical Modelling of Computer Networks: Part II. Module 1: Network Coding

TCP over Wireless Networks

Asynchronous Transfer Mode: ATM. ATM architecture. ATM: network or link layer? ATM Adaptation Layer (AAL)

Overview of Asynchronous Transfer Mode (ATM) and MPC860SAR. For More Information On This Product, Go to:

MLPPP Deployment Using the PA-MC-T3-EC and PA-MC-2T3-EC

EE4367 Telecom. Switching & Transmission. Prof. Murat Torlak

Internetworking. Problem: There is more than one network (heterogeneity & scale)

15-441: Computer Networks Homework 2 Solution

Multiple Choice Questions

Transcription:

Computer Networks The Data Link Layer 1 Data Link Layer Application Transport Network DLL PHY 2

What does it do? What functions it performs? Typically: Handling transmission errors, a.k.a., error control. Flow control. Framing. 3 Framing 4

DLL and the Stack (a) Virtual communication (b) Actual communication 5 DLL Between Routers 6

The DLL and PHY The PHY delivers raw sequence of bits. Unreliable service. The DLL must detect and, in some cases, correct errors. 7 DLL s Error Control Break bit stream into frames. Check if frames arrived correctly. If not: Discards frame. In some cases also request retransmisssion. 8

Not trivial. Different methods. Framing 9 Framing: Using Counters (a) Without errors. (b) With one error. 10

Main problem? Character Counter 11 Framing: Flag Byte Each frame starts and ends with special bytes: flag bytes. Two consecutive flag bytes indicate end of frame and beginning on new frame. Problem? What if flab bit pattern occurs in data? 12

Byte Stuffing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. 13 Byte Stuffing (Cont d) Single ESC: part of the escape sequence. Doubled ESC: single ESC is part of data. De-stuffing. Problem: What if character encoding does not use 8-bit characters? 14

Bit Stuffing Allows character codes with arbitrary bits per character. Each frames begins and ends with special pattern. Example: 01111110. When sender s DLL finds 5 consecutive 1 s in data stream, stuffs 0. When receiver sees 5 1 s followed by 0, destuffs. 15 Bit Stuffing: Example (a) Original data. (b) Data as they appear on the line. (c) Data after de-stuffing. 16

Error Control 17 Error Control Reliable delivery. Hop-by-hop! Detecting errors. Detecting and correcting errors. 18

Acknowledgments Special control info (in the case of the DLL, control frame) acknowledging receipt of data. Positive and negative ACKs. ACKs. NACKs. Are ACKs sufficient? 19 Timers. Retransmission. Duplicate detection. Reliable Delivery 20

Flow Control Handles mismatch between sender s and receiver s speed. Receiver s buffer limitation. Feedback-based flow control. Explicit permission from receiver. Rate-based flow control. Implicit mechanism for limiting sending rate. DLL typically uses feedback-based flow control. 21 Error Detection and Correction Add control information to the original data being transmitted. Error detection: enough info to detect error. Need retransmissions. Error correction: enough info to detect and correct error. A.k.a., forward error correction (FEC). 22

Why? Error detection versus error correction. Cost-efficiency? Environment. Application. 23 What s an error? Frame = m data bits + r bits for error control. n = m + r. Given the original frame f and the received frame f, how many corresponding bits differ? Hamming distance (Hamming, 1950). 24

Hamming Distance: Examples 25 Hamming Distance If f and f are Hamming distance of d apart, there needs to be d single-bit errors to convert f to f. Error detecting/correcting properties of a code depend on the code s Hamming distance. To detect d errors, need code with Hamming distance d+1. Need d+1 single-bit errors to change a valid f to a valid f. If receiver sees invalid f, it knows an error occurred. 26

Parity Bit Simple error detecting code. Even- or odd parity. Example: Transmit 1011010. Add parity bit 1011010 0 (even parity) or 1011010 1 (odd parity). Code with single parity bit has Hamming distance of 2! Any single bit error produces frame with wrong parity. 27 Error Correcting Codes To correct d errors, need 2d+1distance code. Code words are 2d+1 apart. With d changes, original frame is closer than any other valid frame. 28

Error Correction: Example Suppose code with 4 valid words: 0000000000, 0000011111, 1111100000, 1111111111. Hamming distance is 5. Possible to correct double errors. Example: If 0000000111 arrives at receiver, receiver assumes original must have been 0000011111. But if triple error changes 0000000000 into 0000000111, not able to correct it properly. 29 Hamming Code Check bits in power-of-two positions. Each check bit verifies a set of data bits. A data bit is checked by multiple check bits. 30

Hamming Code Bits in positions that are power of 2 are check bits. The rest are data bits. Each check bit used in parity (even or odd) computation of collection of bits. Example: check bit in position 11, checks for bits in positions, 11 = 1+2+8. Similarly, bit 11 is checked by bits 1, 2, and 8. 31 Hamming Code (Cont d) Parity computations: 11: 1, 2, 8-6: 2, 4 10: 2, 8-5: 1, 4 9: 1, 8-3: 1, 2 7: 1, 2, 4 32

Hamming Code: Example 1 Data: 1001101 using even parity (counting from right to left). 1 0 0 1 1 0 1 11 10 9 8 7 6 5 4 3 2 1 1 1: 1, 3, 5, 7, 9, 11 1 0 0 1 1 1 0 0 1 0 1 11 10 9 8 7 6 5 4 3 2 1 2: 3, 6, 7, 10, 11 33 Hamming Code: Example 2 What if instead of 1 0 0 1 1 1 0 0 10 1, receiver gets 1 0 0 1 0 1 0 0 1 0 1? 11 10 9 8 7 6 5 4 3 2 1. Receiver takes frame received and re-computes check bits. 1: 3, 5, 7, 9, 11: 1, 1, 0, 1, 0, 1 => 1 2: 3, 6, 7, 10, 11: 0, 1, 1, 0, 0, 1 => 1 4: 5, 6, 7 : 0, 0, 1, 0 => 1 8: 9, 10, 11: 1, 0, 0, 1 => 0 0 1 1 1 Result: Bit in position 0 1 1 1 is wrong! 34

How much code redundancy? How many check bits needed, i.e., given m data bits, how many more bits (r) are needed to allow all single-bit errors to be corrected? Resulting frame is m + r. (m+r+1) <= 2 r. Given m, then find r. Example: If m = 7 (ASCII 7 code), minimum r is 4. 35 Hamming Code: Example 7-bit. Hamming codes can only correct single errors.. But, to correct bursts of errors, send column by column. 36

Error Detecting Codes Typically used in reliable media. Examples: parity bit, polynomial codes (a.k.a., CRC, or Cyclic redundancy Check). 37 Polynomial Codes Treat bit strings as representations of polynomials with coefficients 1 s and 0 s. K-bit frame is coefficient list of polynomial with k terms (and degree k-1), from x k-1 to x 0. Highest-order bit is coefficient of x k-1, etc. Example: 110001 represents x 5 + x 4 +x 0. Generator polynomial G(x). Agreed upon by sender and receiver. 38

CRC Checksum appended to frame being transmitted. Resulting polynomial divisible by G(x). When receiver gets checksummed frame, it divides it by G(x). If remainder, then error! 39 Cyclic Redunancy Check At Transmitter, with M = 1 1 1 0 1 1, compute 2 r M= 1 1 1 0 1 1 0 0 0 with G = 1 1 0 1 T = 2 r M + R [note G starts and ends with 1 ] R = 1 1 1 Transmit T= 1 1 1 0 1 1 1 1 1 40

Cyclic Redundancy Check At the Receiver, compute: Note remainder = 0 no errors detected 41 CRC Performance Errors go through undetected only if divisible by G(x) With suitably chosen G(x) CRC code detects all single-bit errors. And more 42

Flow + Error Control 43 Flow + Error Control How do Layer 2 protocols implement them? What s a frame? F H Payload T F. What s F?. What s in T?. What s in H? 44

Flow + Error Control Frame revisited. Layer 2 encapsulation/decapsulation. Flags. Trailer: checksum. Header: type, sequence number, ack. 45 Header and Trailer Trailer typically has checksum. How is it used/processed? Header has: type, sequence number, and ack. 46

Stop-and-Wait Simplest form of flow control. How does it work? (assume error-free channel) (1) Send 1 frame; (2) Wait for ACK. (3) Go to 1. 47 Stop-and-Wait: Pros and Cons Very simple! But, poor link utilization. High data rates. Long propagation delay. 48

Noisy Channels From Stallings: Data and Computer Communications 49 Stop-and-Wait in Noisy Channels Need timers, retransmissions, and duplicate detection. Use sequence numbers. Why? Distinguish frames. How large (e.g., in number of bits) are sequence numbers? 50

ARQ Protocols Automatic Repeat Request. Protocols that wait for ACK before sending more data. ACKs now are used for flow AND error control. What can happen? At receiver: frame arrives correctly, frame arrives damaged, or frame does not arrive. At sender: ACK arrives correctly, ACK arrives damaged, or ACK does not arrive. 51 ARQ Protocols Sender: Send frame 0. Start timer. If ACK 0, arrives, send frame 1. If timeout, re-send frame 0. Receiver: **Waits for frame. If frame arrives, check if correct sequence number. Then send ACK for that frame. Go to (**) 52

Simplex: Simplex versus Duplex Transmission Send data in one channel and control in another channel. Duplex: Send data and control on the same chanel. 53 Can we do better? Can we do better? Piggybacking. Bi-directional transmission. Wait for data packet and use that to piggyback the ACK. Use ACK field: only a few additional bits in the header. But, how long should Layer 2 wait to send an ACK? ACK timers! 54

Can we do even better? In Stop and Wait, only 1 frame outstanding at any given point in time. What s the problem with that? Loooong pipes. S R Fat pipes. S R 55 Sliding Window Protocols Window: number of outstanding frames at any given point in time. So what s the window size of Stop and Wait? Every ACK received, window slides. 56

Sliding Window: Example A sliding window of size 1, with a 3-bit sequence number.(a) Initially; (b) After the first frame has been sent; (c) After the first frame has been received;(d) After the first acknowledgement has been received. 57 Sliding Window: Basics Allows multiple frames to be in transit at the same time. Receiver allocates buffer space for n frames. Transmitter is allowed to send n (window size) frames without receiving ACK. Frame sequence number: labels frames. 58

Sliding Window: Receiver Receiver ack s frame by including sequence number of next expected frame. Cumulative ACK: ack s multiple frames. Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack s receipt of 2, 3, and 4. 59 More Sliding Window Sender maintains sequence numbers it s allowed to send; receiver maintains sequence number it can receive. Sequence numbers are bounded; if frame reserves k-bit field for sequence numbers, then they can range from 0 2 k -1 k. Transmission window shrinks each time frame is sent, and grows each time an ACK is received. 60

Example: 3-bit sequence number and window size 7 A (Sender) B (Receiver) 0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 3 4 5 6 7 0 1 2 3 4 0 0 1 2 3 4 5 6 7 0 1 2 3 4 1 2 0 1 2 3 4 5 6 7 0 1 2 3 4 ACK 3 0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 3 4 5 6 7 0 1 2 3 4 3 4 0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 3 4 5 6 7 0 1 2 3 4 5 ACK 4 6 0 1 2 3 4 5 6 7 0 1 2 3 4 0 1 2 3 4 5 6 7 0 1 2 3 4 61 One-Bit Sliding Window Protocol Two scenarios: (a) Normal case. (b) Abnormal case. Notation is (seq, ack, packet number). An * indicates where a network layer accepts packet. ACK indicates last sequence number received. 62

Bandwidth-Delay Product How large should the sender s window be? Function of how fat is the pipe? S BW R RTT W = BW*RTT/data size 63 Pipelining Receiver s window size is 1: discard frames after error with no ACK. Go Back N Receiver s window size is large: buffers all frames until error Selective Repeat recovered. Pipelining and error recovery. Effect on error when (a) Receiver s window size is 1. (b) Receiver s window size is large. 64

Example DLL Protocols High-Level Data Link Control (HDLC). Point-to-Point Protocol (PPP). 65 HDLC ISO standard. Flag Identifies host. ACK, seq. # CRC 66

Internet s DLL. Router-to-router. Home user-to-isp. RFC 1661, etc. PPP PPP is a multi-protocol framing mechanism that can be used over multiple PHYs (dial-up, dedicated point-to-point connections). 67 The Data Link Layer in the Internet 68

PPP Frame Type of protocol in the payload Default value; no need for addresses. Default value: unumbered frame; No rexmissions. 69