CompSci 356: Computer Network Architectures Lecture 4: Link layer: Encoding, Framing, and Error Detection Xiaowei Yang

Slides:



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

COS 461 Fall 1997 COS 461: Networks and Distributed Computing u Prof. Ed Felten u u.
1 Chapter 2 Agenda Announcements / updates Gayle Laakman McDowell, 10/11, 4:30pm, UW2-005 GUIs / IDEs for remotely accessing uw1-320-lab Other references.
Lecture 3, 1Spring 2003, COM1337/3501CCN: Direct Link Networks Direct Link Networks Textbook: Computer Networks: A Systems Approach, L. Peterson, B. Davie,
1 Link Layer: Motivation Message M A B Problem: Given a message M at a node A consisting of several packets, how do you send the packets to a “neighbor”
Spring 2002CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Fundamentals of Computer Networks ECE 478/578 Lecture #3: Encoding and Framing Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
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.
1 Hardware Building Blocks Five Issues –Encoding –Framing –Error Detection –Reliable delivery –Access Mediation Direct Link Networks.
Spring 2004 EE4272 Direct Link Networks (I) Hardware Building Blocks (nodes & links) 5 Issues before Exchanging Packets  Encoding  Framing  Error Detection.
Chapter 2 : Direct Link Networks (Continued). So far... Modulation and Encoding Link layer protocols Error Detection -- Parity Check.
Spring 2003CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
CS 164: Slide Set 3: Chapter 2 Direct Link Networks.
Framing and Encoding EECS 122: Lecture 26 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
Error Detection and Reliable Transmission EECS 122: Lecture 24 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
Data Link Layer IS250 Spring 2010
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.
ECE 4450:427/527 - Computer Networks Spring 2015
CSCI-1680 Physical Layer Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
CSE331: Introduction to Networks and Security Lecture 3 Fall 2002.
CSS CSS432 Point-to-Point Links Textbook Ch2.1.2 – 2.5 Professor: Munehiro Fukuda.
Error Coding Transmission process may introduce errors into a message.  Single bit errors versus burst errors Detection:  Requires a convention that.
CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION.
Advanced Computer Networks Chapter 2: Direct Link Networks.
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.
CSE 461: Bits and Bandwidth Next Topic  Focus: How do we send a message across a wire?  The physical / link layers: 1. Different kinds of media 2.
Layer Two Data Link Layer Collects bits from layer 1 and organizes into frames Passes bits that make up frames to layer 1 for transmission Concerned with.
Fall 2000Datacom 11 Outline Hardware Building Blocks Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
1 CHAPTER 2 HARDWARE BUILDING BLOCK ENCODING FRAMING ERROR DETECTION.
Link Layer Dr. Mozafar Bag-Mohammadi Ilam University.
CSCI-1680 Physical Layer Based partly on lecture notes by David Mazières, Phil Levis, John Jannotti Rodrigo Fonseca.
Computer Science Division
Computer Networks Lecture 2: Data Link Based on slides from D. Choffnes Northeastern U. and P. Gill from StonyBrook University Revised Autumn 2015 by S.
Spring 2001CS 5851 Outline Building Blocks Shannon’s Theorem Encoding 11. Physical Layer.
Data Link Layer (Layer 2, L2) 염익준. 2 Cables Used to connect nodes in the same room or building. CableTypical BandwidthsDistances Cat-5 twisted pair Thin-net.
9-Jan-164/598N: Computer Networks Overview Performance metrics - Section 1.5 Direct link networks –Hardware building blocks - Section 2.1 –Encoding - Section.
Physical Layer Issues and Methods Outline Physical Layer Overview Non-Return to Zero Manchester 4B/5B.
Point-to-Point Links: Framing
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 6: Datalink layer problems Slides used.
Physical Layer Issues and Methods Outline Physical Layer Ethernet Technology Physical Layer Encoding Final Exam Review - ??
1 Chapter 2: Direct Link Networks (Part One) Dr. Rocky K. C. Chang 30 January 2004.
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.
CSE331: Introduction to Networks and Security Lecture 2 Fall 2002.
CS 457 – Lecture 3 Link Layer Protocols Fall 2011.
CS4470 Computer Networking Protocols
Simple Parity Check The simplest form of error detection is the parity check used with ASCII codes, originally on asynchronous modem links Each 7 bit ASCII.
Getting Connected (Chapter 2 Part 1)
The University of Adelaide, School of Computer Science
Data Link Networks Hardware Building Blocks Nodes & Links CS380
Prof. Athirai Irissappane
Data Link Layer.
Advanced Computer Networks
CSCI-1680 Physical Layer Link Layer I
2. Getting connected (part 1)
Point-to-Point Links Outline Encoding Framing Error Detection
Ion Stoica September 6, 2001 EE 122: Lecture 4 Ion Stoica September 6, 2001.
Error Detection Neil Tang 9/26/2008
Fundamentals of Computer Networks
Hardware Building Blocks
Dr. Mozafar Bag-Mohammadi Ilam University
Home work project #1 Develop and fully debug your program on the Cushing 208 lab. Machines - planet lab machines may not have good development environment.
EECS 122: EE122: Error Detection and Reliable Transmission
Data Link Layer. Position of the data-link layer.
Presentation transcript:

CompSci 356: Computer Network Architectures Lecture 4: Link layer: Encoding, Framing, and Error Detection Xiaowei Yang

Overview Review – Physical links – Link/network performance metrics Bandwidth / throughput Latency / delay Bandwidth * delay product Link layer functions – Encoding – Framing – Error detection – Reliable transmission (if have time)

The simplest network is one link plus two nodes Hi Alice… ?

Recap: Put bits on the wire Each node (e.g. a PC) connects to a network via a network adaptor. The adaptor delivers data between a node’s memory and the network. A device driver is the program running inside the node that manages the above task. At one end, a network adaptor encodes and modulates a bit into signals on a physical link. At the other end, a network adaptor reads the signals on a physical link and converts it back to a bit.

Different types of physical links Wired links – Copper – Fiber optics Wireless links – Wifi, WiMax, Bluetooth, ZigBee, …

Commonly Used Physical Links Different links have different transmission ranges – Signal attenuation Cables – Connect computers in the same building Leased lines – Lease a dedicated line to connect far-away nodes from telephone companies

Cables CAT-5: twisted pair Coaxial: thick and thin Fiber 10BASE2 cable, thin-net 200m 10Base4, thick-net 500m CAT-5

Leased lines Tx series speed: multiple of 64Kpbs – Copper-based transmission DS-1 (T1): 1,544, 24*64kpbs DS-2 (T2): 6,312, 96*64kps DS-3 (T3): 44,736, 672*64kps OC-N series speed: multiple of OC-1 – Optical fiber based transmission OC-1: Mbps OC-3: Mbps OC-12: Mbps

Last mile links Wired links – POTS: Kbps (Plain old telephone service) – ISDN: Kbps (Integrated Services Digital Network) – xDSL: 128Kbps-100Mbps (over telephone lines) Digital Subscriber Line – CATV: 1-40Mpbs (shared, over TV cables) Wireless links – Wifi, WiMax, Bluetooth, …

Central OfficeSubscriber premises Local loop Runs on existing copper 18,000 feet at 1.544Mbps 9,000 at Mbps ADSL Mpbs Kpbs Central office Nbrhood optical Network unit Subscriber premises OC links 13-55Mpbs feet of copper VDSL (Very high) Symmetric xDSL wiring Must install VDSL transmission hardware

Wireless links Wireless links transmit electromagnetic signals through space – Used also by cellular networks, TV networks, satellite networks etc. Shared media – Divided by frequency and space FCC determines who can use a spectrum in a geographic area, ie, “licensing” – Auction is used to determine the allocation – Expensive to become a cellular carrier Unlicensed spectrum – WiFi, Bluetooth, Infrared

Link Performance Metrics Propagation delay – How long it takes for one bit to travel from one end of a link to the other end Bandwidth – How many bits a link can transmit in a unit time – Each bit is a pulse on the wire Must have certain width for the receiver to decode it

Latency and Throughput Latency of a message = Propagation + Transmit + Queue Propagation = Distance/SpeedOfWave Transmit = Size/Bandwidth Throughput = Size / Latency

Example 1Mbps, 100ms, 1MB data – Latency = 1MB/1Mbps + 100ms = 8.1s – Throughput = 1MB/8.1s ≈ 1Mbps 1Gbps, 100ms, 1MB data – Latency = 1MB/1Gbps + 100ms = 108ms – Throughput = 1MB/108ms = 74.1Mbps < 1Gbps Why?

Delay × Bandwidth Product Measures the volume of a pipe – The maximum number of bits can be in transit through the pipe at any given instant To achieve high throughput, one should keep the pipe full

High speed versus low speed links

Link-layer functions Most functions are completed by adapters – Encoding – Framing – Error detection – Reliable transmission (if have time)

Overview Review – Physical links – Link/network performance metrics Bandwidth / throughput Latency / delay Bandwidth * delay product Link layer functions – Encoding – Framing – Error detection – Reliable transmission (if have time)

Encoding Encoding is the process to turn binary data (bits, 0s and 1s) into physical signals sent over a physical link Done by a piece of hardware on a network adaptor High and low signals, ignore modulation Simplest one: 1 to high, 0 to low

Non-return to zero 1 to high, 0 to low Not good for decoding – Baseline wander Consecutive 1s or 0s cause the average signal level to drift – Receiver uses it to distinguish high/low signals – Clock recovery Receiver uses transition to 1s or 0s as clock boundaries to synchronize clock

Solution 1: Nonreturn to zero inverted (NRZI) A transition from current signal encodes 1 No transition encodes 0 Does it solve all problems? – Not for consecutive 0s NRZI

Solution 2: Manchester encoding Clock XOR NRZ – 1: high  low; 0: low  high – Drawback: doubles the rate at which signals are sent Baud rate: signal change rate Bit rate = half of baud rate. 50% efficient

Final solution: 4B/5B Key idea: insert extra bits to break up long sequences of 0s or 1s 4-bit of data are encoded in a 5-bit code word – 16 data symbols, 32 code words  choose the good codes that do not have long sequence of 0s – At most one leading 0, two trailing 0s – For every pair of codes, no more than three consecutive 0s 5-bit codes are sent using NRZI

Exercise: – What’s the high/low signal sequence? 4-bit data symbol 5-bit code bit data symbol 5-bit code

Overview Link layer functions – Encoding – Framing – Error detection

Framing Now we’ve seen how to transmit bitstreams But nodes send blocks of data (frames) – A’s memory  adaptor  adaptor  B’s memory An adaptor must determine the boundary of frames Block of data

Variety of Framing Protocols Framing: determining where the frame begins and ends – Why is it an important task of an adaptor? Frames may belong to different apps Need to decide when to deliver them Design choices – Byte-oriented protocols: the smallest unit of data is a byte Sentinel approach Byte-counting approach – Bit-oriented protocols – Clock-based framing

Byte-oriented protocols: the sentinel approach View each frame as a collection of bytes (characters) Use special characters SYN, ETX to detect frame start and end What if special characters appear in a data stream? – Insert data link escape (DLE) characters – Character stuffing Transmitted from the leftmost bit Binary Synchronous Communication (BISYNC) by IBM in late 60s

Point-to-Point Protocol (PPP) A data link protocol used to establish a direction connection between two nodes – Internet dialup access More recent, RFC 1661, 1994 Flag: ; Address & Control: default Protocol: demultiplexing – IP, Link Control Protocol, …, Checksum: two or four bytes Link Control Protocol – Set up and terminate the link – Negotiate other parameters such as maximum receive unit

Byte-oriented protocols: the byte counting approach Use a byte count field to detect the end of a frame. The corruption of the count field may cause back-to- back frame losses – A similar problem may occur in the sentinel approach. Corrupted ETX DDCMP by DECNET

Bit-oriented protocols View a frame as a collection of bits is the beginning and ending sequence The sequence is also transmitted when the links are idle Bit-stuffing for data – Sender: inserts a 0 after every five consecutive 1’s – Receiver: after five consecutive 1’s, If the next bit is 0, removes it If the next bit is 1 – If the next bit is 0 (i.e. the last 8 bits are ), then frame ends – Else error; discard frame, wait for next to receive Frames are of variable length, dependent on the data – Mainly because of stuffing High-level data link control (HDLC) protocol

An exercise Suppose a receiver receives the following bit sequence – What’s the resulting frame after removing stuffed bits? Indicate any error.

Clock-based Framing Synchronous Optical Network (SONET) – A complex protocol Each frame is 125 us long, 810bytes = 125 us * 51.84Mbps – 9 rows of 90 bytes each – First 3 bytes are overhead – First two bytes of each frame has a special pattern marking the start of a frame When the special pattern turns up in the right place enough times (every 810B), a receive concludes it’s in sync. STS-1/OC-1 frame Mbps The slowest SONET link

Synchronized timeslots as placeholder Real frame data may float inside

Overview Link layer functions – Encoding – Framing – Error detection

Error detection Error detection code adds redundant information to detect errors – Analogy: sending two copies of the same message – Parity – Checksum – CRC Error correcting code: more sophisticated code that can correct errors

Two-dimensional parity Even parity bit – Make an even number of 1s in each row and column Detect all 1,2,3-bit errors, and most 4-bit errors A sample frame of six bytes

Internet checksum algorithm Basic idea – Add all the words transmitted and then send the sum. – Receiver does the same computation and compares the sums IP checksum – Adding 16-bit short integers using 1’s complement arithmetic – Take 1’s complement of the result Used by lab 1 and lab 2 to detect bit errors

1’s complement -x is each bit of x inverted If there is a carry bit, add 1 to the sum Example: 4-bit integer – -3: 1100 (invert of 0011) – -4: 1011 (invert of 0100) – = = 1000 (invert of 0111 (8))

IP checksum implementation uint16_t cksum (const void *_data, int len) { const uint8_t *data = _data; uint32_t sum; for (sum = 0;len >= 2; data += 2, len -= 2) sum += data[0] 0) sum += data[0] 0xffff) sum = (sum >> 16) + (sum & 0xffff); sum = htons (~sum); return sum ? sum : 0xffff; }

Remarks Can detect 1 bit error But not all two-bits – One increases the sum, and one decreases it Efficient for software implementation – Needs to be done for every packet inside a router!

Cyclic Redundancy Check A branch of finite fields High-level idea: – Represent an n+1-bit message with an n degree polynomial M(x) – Divide the polynomial by a k-bit divisor C(x) – k-bit CRC: remainder after divided by a degree-k divisor polynomial – Send Message + CRC that is dividable by C(x)

Polynomial arithmetic modulo 2 – B(x) can be divided by C(x) if B(x) has higher degree – B(x) can be divided once by C(x) if of same degree – Remainder of B(x)/C(x) = B(x) – C(x) – Substraction is done by XOR each pair of matching coefficients

CRC algorithm 1.Multiply M(x) by x^k. Add k zeros to Message. Call it T(x) 2.Divide T(x) by C(x) and find the remainder 3.Send P(x) = T(x) – remainder Append remainder to T(x) P(x) dividable by C(x)

An example 8-bit msg – Divisor (3bit CRC) – 1101

How to choose a divisor Complicated Intuition: unlikely to be divided evenly by an error Corrupted msg is P(x) + E(x) If E(x) is single bit, then E(x) = x i If C(x) has the first and last term nonzero, then detects all single bit errors Find C(x) by looking it up in a book

Hardware implementation Very efficient: XOR operations 0 to k-1 registers (k-bit shift registers) If n th (n < k) term is not zero, places an XOR gate x 3 + x 2 + 1

Summary Link performance metrics reviewed Link layer functions – Encoding – Framing – Error detection Parity, Checksum, CRC Next lecture – Reliable transmission – Multi-access link