28
Data Link Layer IS250 Spring 2010 [email protected]

Data Link Layer IS250 Spring 2010 [email protected]

Embed Size (px)

Citation preview

Page 1: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

Data Link Layer

IS250Spring 2010

[email protected]

Page 2: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

2

Network Technologies

802.3 Ethernet 802.11 WiFi 802.16 WiMax DSL Cable modem Cellular (3G, 2.5G, …)

SONET, STS, OC …

LAN: local area network

MAN: metropolitan area network

WAN: wide area network

Backbone network Access network The “last mile” aka “first mile” aka “local loop”

Page 3: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

3

Link Layer Functionalities

Framing Error detection or correction Media access control

Page 4: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

4

Framing

Message transmitted over link as string of 0’s and 1’s

Sender and receiver has to agree where is the beginning and end of a message framing

A frame is a link layer message unit - The prelude and/or postlude are special characters or character sequences that help establish the beginning and end of the frame

- The header contains control information that is used by the network (e.g., network address; error detection)

- The payload contains data that is meaningful only for the sender and receiver

Page 5: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

5

Dealing with Errors

Data can be corrupted during transmission- Bits lost- Bit values changed

Frame includes additional information to help detect or correct errors- Set by sender; checked by receiver

Statistical guarantee

Page 6: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

6

Error Detection

Message M H = f(M) Transmitted T = M || H

Received R = M’ || H’

If H’ = f(M’) then no error

M

H

f

M H

M’ H’

Page 7: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

7

Error Detection Schemes

Parity- Send an additional parity bit (H) per character

- Even parity: if # of 1’s in character is odd, H = 1; else H = 0

- Odd parity: if # of 1’s in character is odd, H = 0; else H = 1

- Cannot detect even numbers of bit errors Checksum

- Treat data as sequence of integers- Compute and send arithmetic sum (H)- Handles multiple bit errors, but not all errors

Cyclic Redundancy Check (CRC)

Page 8: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

8

Checksum Examples

Checksum computed over data Checksum appended to frame

2nd bit reversed in each item, but checksum is the same

Page 9: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

9

Cyclic Redundancy Check

CRC is a mathematical function of data, computed as the remainder from a division of two binary numbers, one representing the message M, and the other a fixed divisor P.

Example: CRC-CCITT:- P(X) = x16 + x12 + x5 + 1; or- P = 10001000000100001

CRC-CCITT can detect:- all single/double bit errors- All odd-numbered bit errors- 100% of burst errors <= 16 bits- 99.997% of burst errors = 17 bits- 99.998% of burst errors >= 18 bits

Page 10: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

10

CRC Algorithm CRC can be computed and verified using binary long division

Numerical example- Use CRC scheme with P(x) = x5 + x4 + x + 1- P: 110011 (6 bits)- Message M: 11100011 (8 bits)- Divide M by P; use the remainder as the CRC (what we call ‘H’ on slide 6) [Note: remainder one bit shorter than P]

- Transmitted message T = M || H- Receiver performs CRC verification on received message T’: divide T’ by P will produce zero remainder if no error

Page 11: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

11

Numerical Example              10110110 110011 ) 1110001100000          110011            101111            110011             111000             110011               101100               110011                111110                110011                11010 = HT = M || H = 1110001111010

Page 12: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

12

Verification              10110110 110011 ) 1110001111010          110011            101111            110011             111001             110011               101010               110011                110011                110011                00000No error since remainder is 0

Page 13: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

14

Media Access Control

How do multiple, independent computers coordinate access to a shared communication medium?

Ethernet

Wi-Fi

Page 14: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

15

Local Area Networks

LAN characteristics:- High throughput- Relatively low cost

- Distance limitations

- Often rely on shared media

Different topologies

Page 15: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

16

Ethernet

Most widely deployed LAN technology

IEEE 802.3 standard Several generations

- Same frame format- Different data rates (10Mbps, 100Mbps, 1Gbps, 10Gbps)

- Different media (coax, twisted pair, fiber)

Page 16: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

17

Shared Medium

Shared medium used for all transmissions

Only one station transmit at any time

Stations take turns using medium

Media access control (MAC) policy ensures fairness

Page 17: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

18

Data Transmission in Ethernet

Only one station transmit at any time Signal propagates across entire cable All stations receive transmission CSMA/CD media access scheme

Page 18: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

19

CSMA/CD

Multiple access (MA)- Multiple computers attach to shared media

- Each uses same access algorithm Carrier Sense (CS)

- Wait until medium is idle- Begin to transmit frame

Simultaneous transmission possible

Page 19: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

20

CSMA/CD (2)

Two simultaneous transmissions- Interfere with one another- Called a collision

CSMA plus collision detection (CD)- Listen to medium during transmission- Detect whether another station’s signal interferes

- Back off from interference and try again

Page 20: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

21

Example

Page 21: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

22

Back-off after Collision

When collision occurs- Wait random time t1, 0 <= t1 <= d- Use CSMA and try again

If second collision occurs- Wait random time t2, 0 <= t2 <= 2d

Double range for each successive collision

Called exponential backoff

Page 22: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

23

Wireless Ethernet (Wi-Fi)

Uses unlicensed spectrum (ISM band)

Page 23: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

24

WLAN Media Access

Limited range- Not all stations receive all transmissions- Cannot use CSMA/CD

Example- Maximum transmission distance is d- Stations 1 and 3 do not receive each other’s transmissions

Known as the “hidden terminal” problem

Page 24: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

25

CSMA/CA

Collision avoidance (CA)- upon sensing idle channel, waits for a random backoff duration before attempting to transmit

RTS/CTS Mechanism- Handshake before data transmission- Request to Send (RTS): “X is about to send to Y”

- Clear to Send (CTS): “Y is about to receive from X”

- Data frame sent from X to Y- Collisions of control messages possible; but control messages are much shorter than data frames

Page 25: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

26

Addressing in Shared Medium

All stations on shared media receive all transmissions

Each frame contains address of intended recipient

Stations discard any frame addressed to another station

Shared media provide no confidentiality- Network analyzers can run in promiscuous mode- Designed for testing/debugging- Allows network interface to accept all packets

Page 26: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

27

Ethernet Addressing & Frame Format

Each station assigned unique 48-bit (6 byte) address- Known as Ethernet address, MAC address, or Physical address

Address assigned when network interface card (NIC) manufactured

Ethernet frame format:

/Size

Page 27: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

28

Ethernet Evolution

Original Ethernet: bus topology

Modern Ethernet: star topology

Ethernet hub: - Propagates each incoming

signal to all connections- noise and collisions also

propagated Ethernet switch:

- Operates on frames- Does not forward noise or

collisions- Understands addresses- Only forwards when necessary- Allows independent

transmission on different segments

Page 28: Data Link Layer IS250 Spring 2010 chuang@ischool.berkeley.edu

29

Layer 2 is not limited to LANs

Backbone operators (e.g., AT&T) deploy and operate long-haul copper-based or fiber-based digital circuits

SONET (Synchronous Optical Network) and SDH (Synchronous Digital Hierarchy) standards support framing, multiplexing, synchronization.

OC-192 9.953Gbps

OC-768 39.813Gbps