CS 3700 Networks and Distributed Systems Data Link (The Etherknot - - PowerPoint PPT Presentation

cs 3700
SMART_READER_LITE
LIVE PREVIEW

CS 3700 Networks and Distributed Systems Data Link (The Etherknot - - PowerPoint PPT Presentation

CS 3700 Networks and Distributed Systems Data Link (The Etherknot Notwork) Revised 9/14/16 Data Link Layer 2 Function: Send blocks of data (frames) between Application physical devices Regulate access to the physical media


slide-1
SLIDE 1

CS 3700


Networks and Distributed Systems

Data Link (The Etherknot Notwork)

Revised 9/14/16

slide-2
SLIDE 2

Data Link Layer

2

Function:

Send blocks of data (frames) between

physical devices

Regulate access to the physical media

Key challenge:

How to delineate frames? How to detect errors? How to perform media access control (MAC)? How to recover from and avoid collisions?

Application

Presentation

Session Transport Network Data Link Physical

slide-3
SLIDE 3

❑ Framing ❑ Error Checking and Reliability ❑ Media Access Control

802.3 Ethernet

802.11 Wifi

Outline

3

slide-4
SLIDE 4

Framing

4

Physical layer determines how bits are encoded Next step: how to encode blocks of data

slide-5
SLIDE 5

Framing

4

Physical layer determines how bits are encoded Next step: how to encode blocks of data

Packet switched networks Each packet includes routing information Data boundaries must be known so headers can be read

slide-6
SLIDE 6

Framing

4

Physical layer determines how bits are encoded Next step: how to encode blocks of data

Packet switched networks Each packet includes routing information Data boundaries must be known so headers can be read

Types of framing

Byte oriented protocols Bit oriented protocols Clock based protocols

slide-7
SLIDE 7

Byte Oriented: Byte Counting

5

Data

132

slide-8
SLIDE 8

Byte Oriented: Byte Counting

5

Sender: insert length of the data in bytes at the

beginning of each frame

Receiver: extract the length and read that many bytes

Data

132

132

slide-9
SLIDE 9

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data

Data

slide-10
SLIDE 10

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data

Data START END

slide-11
SLIDE 11

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data Problem: what if END appear in the data?

Data START END END

slide-12
SLIDE 12

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data Problem: what if END appear in the data?

Add a special DLE (Data Link Escape) character before END

Data START END END DLE

slide-13
SLIDE 13

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data Problem: what if END appear in the data?

Add a special DLE (Data Link Escape) character before END What if DLE appears in the data? Add DLE before it.

Data START END END DLE DLE DLE

slide-14
SLIDE 14

Byte Oriented: Sentinel Approach

6

Add START and END sentinels to the data Problem: what if END appear in the data?

Add a special DLE (Data Link Escape) character before END What if DLE appears in the data? Add DLE before it. Similar to escape sequences in C

■ printf(“You must \”escape\” quotes in strings”); ■ printf(“You must \\escape\\ forward slashes as well”); Used by Point-to-Point protocol, e.g. modem, DSL, cellular

Data START END END DLE DLE DLE

slide-15
SLIDE 15

Bit Oriented: Bit Stuffing

7

Data

slide-16
SLIDE 16

Bit Oriented: Bit Stuffing

7

Add sentinels to the start and end of data

Both sentinels are the same Example: 01111110 in High-level Data Link Protocol (HDLC)

Data 01111110 01111110

slide-17
SLIDE 17

Bit Oriented: Bit Stuffing

7

Add sentinels to the start and end of data

Both sentinels are the same Example: 01111110 in High-level Data Link Protocol (HDLC)

Sender: insert a 0 after each 11111 in data

Known as “bit stuffing”

Receiver: after seeing 11111 in the data…

111110 remove the 0 (it was stuffed) 111111 look at one more bit

■ 1111110 end of frame ■ 1111111 error! Discard the frame Disadvantage: 17% overhead at worst

Data 01111110 01111110

slide-18
SLIDE 18

Synchronous Optical Network

Transmission over very fast optical links STS-n, e.g. STS-1: 51.84 Mbps, STS-768: 36.7 Gbps

STS-1 frames based on fixed sized frames

9*90 = 810 bytes

Clock-based Framing: SONET

8

90 Byte Columns 9 Rows

Payload

Overhead

Special start pattern

slide-19
SLIDE 19

Synchronous Optical Network

Transmission over very fast optical links STS-n, e.g. STS-1: 51.84 Mbps, STS-768: 36.7 Gbps

STS-1 frames based on fixed sized frames

9*90 = 810 bytes

Physical layer details

Bits are encoded using NRZ Payload is XORed with a pseudorandom 127-bit pattern to

avoid long sequences of 0 and 1

Clock-based Framing: SONET

8

slide-20
SLIDE 20

❑ Framing ❑ Error Checking and Reliability ❑ Media Access Control

802.3 Ethernet

802.11 Wifi

Outline

9

slide-21
SLIDE 21

Dealing with Noise

10

The physical world is inherently noisy

Interference from electrical cables Cross-talk from radio transmissions, microwave ovens Solar storms

How to detect bit-errors in transmissions? How to recover from errors?

slide-22
SLIDE 22

Naïve Error Detection

11

Idea: send two copies of each frame if (memcmp(frame1, frame2) != 0) { OH NOES, AN ERROR! } Why is this a bad idea?

slide-23
SLIDE 23

Naïve Error Detection

11

Idea: send two copies of each frame if (memcmp(frame1, frame2) != 0) { OH NOES, AN ERROR! } Why is this a bad idea? Extremely high overhead Poor protection against errors

■ Twice the data means twice the chance for bit errors

slide-24
SLIDE 24

Parity Bits

12

Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1011110 0110100 1101001 0001110

slide-25
SLIDE 25

Parity Bits

12

Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1011110 0110100 1101001 0001110

slide-26
SLIDE 26

Parity Bits

12

Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110

slide-27
SLIDE 27

Parity Bits

12

Detects 1-bit errors and some 2-bit errors Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110 1

slide-28
SLIDE 28

Parity Bits

12

Detects 1-bit errors and some 2-bit errors Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110 1

slide-29
SLIDE 29

Parity Bits

12

Detects 1-bit errors and some 2-bit errors Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110 1 10

slide-30
SLIDE 30

Parity Bits

12

Detects 1-bit errors and some 2-bit errors Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110 1 10

slide-31
SLIDE 31

Parity Bits

12

Detects 1-bit errors and some 2-bit errors Not reliable against bursty errors Idea: add extra bits to keep the number of 1s even

Example: 7-bit ASCII characters + 1 parity bit

0101001 1 1 1 1 1011110 0110100 1101001 0001110 1 10

slide-32
SLIDE 32

Two Dimensional Parity

13

0101001 1101001 1011110 0001110 0110100 1011111

slide-33
SLIDE 33

Two Dimensional Parity

13

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1

Parity bit for each row

slide-34
SLIDE 34

Two Dimensional Parity

13

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011

Parity bit for each row Parity bit for each column

slide-35
SLIDE 35

Two Dimensional Parity

13

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Parity bit for each row Parity bit for each column Parity bit for the parity byte

slide-36
SLIDE 36

Two Dimensional Parity

13

Can detect all 1-, 2-, and 3-bit errors, some 4-bit errors

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Parity bit for each row Parity bit for each column Parity bit for the parity byte

slide-37
SLIDE 37

Two Dimensional Parity

13

Can detect all 1-, 2-, and 3-bit errors, some 4-bit errors 14% overhead

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Parity bit for each row Parity bit for each column Parity bit for the parity byte

slide-38
SLIDE 38

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

slide-39
SLIDE 39

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Odd number

  • f 1s

Odd Number of 1s

1

slide-40
SLIDE 40

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Odd number

  • f 1s

Odd Number of 1s

1 1

slide-41
SLIDE 41

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Odd Number of 1s

1 1

Odd number

  • f 1s
slide-42
SLIDE 42

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0

Odd Number of 1s

1 1

Odd number

  • f 1s

1

slide-43
SLIDE 43

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0 1 1

Odd number

  • f 1s

1

Odd number

  • f 1s
slide-44
SLIDE 44

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0 1 1

Odd number

  • f 1s

1

Odd number

  • f 1s
slide-45
SLIDE 45

Two Dimensional Parity Examples

14

0101001 1101001 1011110 0001110 0110100 1011111 1 1 1 1 1111011 0 1 1 1

slide-46
SLIDE 46

Checksums

15

Idea:

Add up the bytes in the data Include the sum in the frame

Use ones-complement arithmetic Lower overhead than parity: 16 bits per frame But, not resilient to errors

Why?

Used in UDP

, TCP , and IP

Data START END Checksum

slide-47
SLIDE 47

Checksums

15

Idea:

Add up the bytes in the data Include the sum in the frame

Use ones-complement arithmetic Lower overhead than parity: 16 bits per frame But, not resilient to errors

Why?

Used in UDP

, TCP , and IP

Data START END Checksum

0101001 1101001= 10010010 +

slide-48
SLIDE 48

Checksums

15

Idea:

Add up the bytes in the data Include the sum in the frame

Use ones-complement arithmetic Lower overhead than parity: 16 bits per frame But, not resilient to errors

Why?

Used in UDP

, TCP , and IP

Data START END Checksum

0101001 1101001= 10010010 + 0 1

slide-49
SLIDE 49

Cyclic Redundancy Check (CRC)

16

Uses field theory to compute a semi-unique value for a

given message

Much better performance than previous approaches

Fixed size overhead per frame (usually 32-bits) Quick to implement in hardware Only 1 in 232 chance of missing an error with 32-bit CRC

Details are in the book/on Wikipedia Today, cryptographic hashes are more common

e.g. MD5, SHA1, SHA256, SHA512

slide-50
SLIDE 50

What About Reliability?

17

How does a sender know that a frame was received?

What if it has errors? What if it never arrives at all?

Sender Receiver Time

slide-51
SLIDE 51

What About Reliability?

17

How does a sender know that a frame was received?

What if it has errors? What if it never arrives at all?

Sender Receiver Time Frame

slide-52
SLIDE 52

What About Reliability?

17

How does a sender know that a frame was received?

What if it has errors? What if it never arrives at all?

Sender Receiver Time Frame A C K

slide-53
SLIDE 53

What About Reliability?

17

How does a sender know that a frame was received?

What if it has errors? What if it never arrives at all?

Sender Receiver Time Frame A C K

Acknowledgement

slide-54
SLIDE 54

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver

slide-55
SLIDE 55

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver Frame Timeout

slide-56
SLIDE 56

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver Frame A C K Timeout

slide-57
SLIDE 57

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver Frame A C K

slide-58
SLIDE 58

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver Frame A C K Frame Timeout

slide-59
SLIDE 59

Stop and Wait

18

Simplest form of reliability Example: Bluetooth

Sender Receiver Frame A C K Frame Timeout Frame

slide-60
SLIDE 60

Stop and Wait

18

Simplest form of reliability Example: Bluetooth Problems?

Sender Receiver Frame A C K Frame Timeout Frame

slide-61
SLIDE 61

Stop and Wait

18

Simplest form of reliability Example: Bluetooth Problems?

Utilization Can only have one frame in flight at

any time

Sender Receiver Frame A C K Frame Timeout Frame

slide-62
SLIDE 62

Stop and Wait

18

Simplest form of reliability Example: Bluetooth Problems?

Utilization Can only have one frame in flight at

any time

10Gbps link and 10ms delay

Need 100 Mbps to fill the pipe Assume packets are 1500B

1500B*8bit/(2*10ms) = 600Kbps

Utilization is 0.006%

Sender Receiver Frame A C K Frame Timeout Frame

slide-63
SLIDE 63

Sliding Window

19

Allow multiple outstanding, un-ACKed frames Number of un-ACKed frames is called the window

Sender Receiver Frames A C K s Window

slide-64
SLIDE 64

Sliding Window

19

Allow multiple outstanding, un-ACKed frames Number of un-ACKed frames is called the window

Sender Receiver Frames A C K s Window

Made famous by TCP

We’ll look at this in more detail later

slide-65
SLIDE 65

Should We Error Check in the Data Link?

20

Recall the End-to-End Argument Cons:

Error free transmission cannot be guaranteed Not all applications want this functionality Error checking adds CPU and packet size overhead Error recovery requires buffering

slide-66
SLIDE 66

Should We Error Check in the Data Link?

20

Recall the End-to-End Argument Cons:

Error free transmission cannot be guaranteed Not all applications want this functionality Error checking adds CPU and packet size overhead Error recovery requires buffering

Pros:

Potentially better performance than app-level error checking

slide-67
SLIDE 67

Should We Error Check in the Data Link?

20

Recall the End-to-End Argument Cons:

Error free transmission cannot be guaranteed Not all applications want this functionality Error checking adds CPU and packet size overhead Error recovery requires buffering

Pros:

Potentially better performance than app-level error checking

Data link error checking in practice

Most useful over lossy links Wifi, cellular, satellite

slide-68
SLIDE 68

❑ Framing ❑ Error Checking and Reliability ❑ Media Access Control

802.3 Ethernet

802.11 Wifi

Outline

21

slide-69
SLIDE 69

What is Media Access?

22

Ethernet and Wifi are both multi-access technologies

Broadcast medium, shared by many hosts Simultaneous transmissions cause collisions

■ This destroys the data

slide-70
SLIDE 70

What is Media Access?

22

Ethernet and Wifi are both multi-access technologies

Broadcast medium, shared by many hosts Simultaneous transmissions cause collisions

■ This destroys the data Media Access Control (MAC) protocols are required

Rules on how to share the medium Strategies for detecting, avoiding, and recovering from

collisions

slide-71
SLIDE 71

Strategies for Media Access

23

Channel partitioning

Divide the resource into small pieces Allocate each piece to one host Example: Time Division Multi-Access (TDMA) cellular Example: Frequency Division Multi-Access (FDMA) cellular

slide-72
SLIDE 72

Strategies for Media Access

23

Channel partitioning

Divide the resource into small pieces Allocate each piece to one host Example: Time Division Multi-Access (TDMA) cellular Example: Frequency Division Multi-Access (FDMA) cellular

Taking turns

Tightly coordinate shared access to avoid collisions Example: Token ring networks

slide-73
SLIDE 73

Strategies for Media Access

23

Channel partitioning

Divide the resource into small pieces Allocate each piece to one host Example: Time Division Multi-Access (TDMA) cellular Example: Frequency Division Multi-Access (FDMA) cellular

Taking turns

Tightly coordinate shared access to avoid collisions Example: Token ring networks

Contention

Allow collisions, but use strategies to recover Examples: Ethernet, Wifi

slide-74
SLIDE 74

Strategies for Media Access

23

Channel partitioning

Divide the resource into small pieces Allocate each piece to one host Example: Time Division Multi-Access (TDMA) cellular Example: Frequency Division Multi-Access (FDMA) cellular

Taking turns

Tightly coordinate shared access to avoid collisions Example: Token ring networks

Contention

Allow collisions, but use strategies to recover Examples: Ethernet, Wifi

slide-75
SLIDE 75

Contention MAC Goals

24

1.

Share the medium

Two hosts sending at the same time collide, thus causing

interference

If no host sends, channel is idle Thus, want one user sending at any given time

slide-76
SLIDE 76

Contention MAC Goals

24

1.

Share the medium

Two hosts sending at the same time collide, thus causing

interference

If no host sends, channel is idle Thus, want one user sending at any given time

2.

High utilization

TDMA is low utilization Just like a circuit switched network

slide-77
SLIDE 77

Contention MAC Goals

24

1.

Share the medium

Two hosts sending at the same time collide, thus causing

interference

If no host sends, channel is idle Thus, want one user sending at any given time

2.

High utilization

TDMA is low utilization Just like a circuit switched network

3.

Simple, distributed algorithm

Multiple hosts that cannot directly coordinate No fancy (complicated) token-passing schemes

slide-78
SLIDE 78

Contention Protocol Evolution

25

ALOHA

Developed in the 70’s for packet radio networks

slide-79
SLIDE 79

Contention Protocol Evolution

25

ALOHA

Developed in the 70’s for packet radio networks

Slotted ALOHA

Start transmissions only at fixed time slots Significantly fewer collisions than ALOHA

slide-80
SLIDE 80

Contention Protocol Evolution

25

ALOHA

Developed in the 70’s for packet radio networks

Slotted ALOHA

Start transmissions only at fixed time slots Significantly fewer collisions than ALOHA

Carrier Sense Multiple Access (CSMA)

Start transmission only if the channel is idle

slide-81
SLIDE 81

Contention Protocol Evolution

25

ALOHA

Developed in the 70’s for packet radio networks

Slotted ALOHA

Start transmissions only at fixed time slots Significantly fewer collisions than ALOHA

Carrier Sense Multiple Access (CSMA)

Start transmission only if the channel is idle

CSMA / Collision Detection (CSMA/CD)

Stop ongoing transmission if collision is detected

slide-82
SLIDE 82

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-83
SLIDE 83

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-84
SLIDE 84

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-85
SLIDE 85

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-86
SLIDE 86

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-87
SLIDE 87

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

slide-88
SLIDE 88

ALOHA

26

Topology: radio broadcast with multiple stations Protocol:

Stations transmit data immediately Receivers ACK all packets No ACK = collision, wait a random time then retransmit

A B C

  • Simple, but radical concept
  • Previous attempts all divided the channel
  • TDMA, FDMA, etc.
  • Optimized for the common case: few senders
slide-89
SLIDE 89

Tradeoffs vs. TDMA

27

In TDMA, each host must wait for its turn

Delay is proportional to number of hosts

In Aloha, each host sends immediately

Much lower delay But, much lower utilization

slide-90
SLIDE 90

Tradeoffs vs. TDMA

27

In TDMA, each host must wait for its turn

Delay is proportional to number of hosts

In Aloha, each host sends immediately

Much lower delay But, much lower utilization

ALOHA Frame ALOHA Frame

Time Sender A Sender B

slide-91
SLIDE 91

Tradeoffs vs. TDMA

27

In TDMA, each host must wait for its turn

Delay is proportional to number of hosts

In Aloha, each host sends immediately

Much lower delay But, much lower utilization

ALOHA Frame ALOHA Frame

Time Sender A Sender B 2*Frame_Width

slide-92
SLIDE 92

Tradeoffs vs. TDMA

27

In TDMA, each host must wait for its turn

Delay is proportional to number of hosts

In Aloha, each host sends immediately

Much lower delay But, much lower utilization

ALOHA Frame ALOHA Frame

Time Sender A Sender B 2*Frame_Width

Maximum throughput is ~18% of channel capacity

slide-93
SLIDE 93

Tradeoffs vs. TDMA

27

In TDMA, each host must wait for its turn

Delay is proportional to number of hosts

In Aloha, each host sends immediately

Much lower delay But, much lower utilization

ALOHA Frame ALOHA Frame

Time Sender A Sender B 2*Frame_Width

Maximum throughput is ~18% of channel capacity

Load Throughput

slide-94
SLIDE 94

Slotted ALOHA

28

Protocol

Same as ALOHA, except time is divided into slots Hosts may only transmit at the beginning of a slot

Thus, frames either collide completely, or not at all

37% throughput vs. 18% for ALOHA But, hosts must have synchronized clocks

slide-95
SLIDE 95

Slotted ALOHA

28

Protocol

Same as ALOHA, except time is divided into slots Hosts may only transmit at the beginning of a slot

Thus, frames either collide completely, or not at all

37% throughput vs. 18% for ALOHA But, hosts must have synchronized clocks

Load Throughput

slide-96
SLIDE 96

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator Repeater

slide-97
SLIDE 97

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator Repeater

slide-98
SLIDE 98

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator Repeater

slide-99
SLIDE 99

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

10Base2

Repeater

slide-100
SLIDE 100

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

Hub 10Base2

Repeater

slide-101
SLIDE 101

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

Hub 10Base2

Repeater

slide-102
SLIDE 102

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

Hub 10Base2

Repeater

slide-103
SLIDE 103

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

Hub

Hubs and repeaters are layer-1 devices, i.e. physical only

10Base2

Repeater

slide-104
SLIDE 104

Broadcast Ethernet

29

Originally, Ethernet was a broadcast technology

Tee Connector Terminator

Hub

Hubs and repeaters are layer-1 devices, i.e. physical only

10Base2

  • 10BaseT and 100BaseT
  • T stands for Twisted Pair

Repeater

slide-105
SLIDE 105

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium

slide-106
SLIDE 106

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

slide-107
SLIDE 107

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

2.

If carrier is present, wait for it to end

Sending would cause a collision and waste time

slide-108
SLIDE 108

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

2.

If carrier is present, wait for it to end

Sending would cause a collision and waste time

3.

Send a frame and sense for collision

slide-109
SLIDE 109

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

2.

If carrier is present, wait for it to end

Sending would cause a collision and waste time

3.

Send a frame and sense for collision

4.

If no collision, then frame has been delivered

slide-110
SLIDE 110

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

2.

If carrier is present, wait for it to end

Sending would cause a collision and waste time

3.

Send a frame and sense for collision

4.

If no collision, then frame has been delivered

5.

If collision, abort immediately

Why keep sending if the frame is already corrupted?

slide-111
SLIDE 111

Ethernet CSMA/CD

30

Carrier sense multiple access with collision detection Key insight: wired protocol allows us to sense the medium Algorithm

1.

Sense for carrier

2.

If carrier is present, wait for it to end

Sending would cause a collision and waste time

3.

Send a frame and sense for collision

4.

If no collision, then frame has been delivered

5.

If collision, abort immediately

Why keep sending if the frame is already corrupted?

6.

Perform exponential backoff then retransmit

slide-112
SLIDE 112

802.3 Ethernet

31

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-113
SLIDE 113

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why?

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-114
SLIDE 114

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why? Start Frame (SF) is 10101011

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-115
SLIDE 115

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why? Start Frame (SF) is 10101011 Source and destination are MAC addresses

E.g. 00:45:A5:F3:25:0C Broadcast: FF:FF:FF:FF:FF:FF

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-116
SLIDE 116

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why? Start Frame (SF) is 10101011 Source and destination are MAC addresses

E.g. 00:45:A5:F3:25:0C Broadcast: FF:FF:FF:FF:FF:FF

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-117
SLIDE 117

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why? Start Frame (SF) is 10101011 Source and destination are MAC addresses

E.g. 00:45:A5:F3:25:0C Broadcast: FF:FF:FF:FF:FF:FF

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-118
SLIDE 118

802.3 Ethernet

31

Preamble is 7 bytes of 10101010. Why? Start Frame (SF) is 10101011 Source and destination are MAC addresses

E.g. 00:45:A5:F3:25:0C Broadcast: FF:FF:FF:FF:FF:FF

Minimum packet length of 64 bytes, hence the pad

Preamble SF Source Dest. Length

7 1 6 6 2 Bytes

Data Checksum Pad

0-1500 0-46 4

slide-119
SLIDE 119

CSMA/CD Collisions

32

A B C D Time

Collisions can occur

Spatial Layout of Hosts

slide-120
SLIDE 120

CSMA/CD Collisions

32

A B C D Time t0

Collisions can occur

Spatial Layout of Hosts

slide-121
SLIDE 121

CSMA/CD Collisions

32

A B C D Time t0 t1

Collisions can occur

Spatial Layout of Hosts

slide-122
SLIDE 122

CSMA/CD Collisions

32

A B C D Time t0 t1

Collisions can occur Collisions are quickly detected

and aborted

Spatial Layout of Hosts D notices the collision B notices the collision

slide-123
SLIDE 123

CSMA/CD Collisions

32

A B C D Time t0 t1

Collisions can occur Collisions are quickly detected

and aborted

Note the role of distance,

propagation delay, and frame length

Spatial Layout of Hosts D notices the collision B notices the collision

slide-124
SLIDE 124

Distance

33

A B C D Time

Suppose we make the Ethernet

cable longer

Spatial Layout of Hosts

slide-125
SLIDE 125

Distance

33

A B C D Time t0 t1

Suppose we make the Ethernet

cable longer

Spatial Layout of Hosts Collision

slide-126
SLIDE 126

Distance

33

A B C D Time t0 t1

Suppose we make the Ethernet

cable longer

Both senders finish sending

before observing the collision

Spatial Layout of Hosts Collision

slide-127
SLIDE 127

Distance

33

A B C D Time t0 t1

Suppose we make the Ethernet

cable longer

Both senders finish sending

before observing the collision

Thus, they will both

erroneously believe their transmissions were successful

Spatial Layout of Hosts Collision

slide-128
SLIDE 128

Packet Length

34

A B C D Time

What if B sends a really short

packet?

Spatial Layout of Hosts

slide-129
SLIDE 129

Packet Length

34

A B C D Time t0 t1

What if B sends a really short

packet?

Spatial Layout of Hosts D notices the collision

slide-130
SLIDE 130

Packet Length

34

A B C D Time t0 t1

What if B sends a really short

packet?

Only one of the senders

notices the collision

B’s packet may be corrupted,

but it has no idea

Spatial Layout of Hosts D notices the collision

slide-131
SLIDE 131

Minimum Packet Sizes

35

slide-132
SLIDE 132

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

Propagation Delay (d) A B

slide-133
SLIDE 133

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting A B

slide-134
SLIDE 134

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting A B

slide-135
SLIDE 135

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting A B

slide-136
SLIDE 136

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting A B

B

slide-137
SLIDE 137

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting

  • 3. Time t + 2*d: Host A

detects the collision A B

B

slide-138
SLIDE 138

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting

  • 3. Time t + 2*d: Host A

detects the collision A B

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

B

slide-139
SLIDE 139

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting

  • 3. Time t + 2*d: Host A

detects the collision A B

min_frame_size / (2*bandwidth) * light_speed = max_cable_length (64B*8) / (2*107bps) * (2.5*108mps) = 6400 meters

B

slide-140
SLIDE 140

Minimum Packet Sizes

35

Why is the minimum packet size 64 bytes?

To give hosts enough time to detect collisions

What is the relationship between packet size and cable length?

A

Propagation Delay (d)

  • 1. Time t: Host A starts

transmitting

  • 2. Time t + d: Host B starts

transmitting

  • 3. Time t + 2*d: Host A

detects the collision A B

min_frame_size / (2*bandwidth) * light_speed = max_cable_length (64B*8) / (2*107bps) * (2.5*108mps) = 6400 meters

B

  • 10 Mbps Ethernet
  • Packet and cable lengths change for

faster Ethernet standards

slide-141
SLIDE 141

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

slide-142
SLIDE 142

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

102.4 kilometers

slide-143
SLIDE 143

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

102.4 kilometers

What is max cable length if bandwidth were changed to 1 Gbps ?

slide-144
SLIDE 144

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

102.4 kilometers

What is max cable length if bandwidth were changed to 1 Gbps ?

64 meters

slide-145
SLIDE 145

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

102.4 kilometers

What is max cable length if bandwidth were changed to 1 Gbps ?

64 meters

What if you changed min packet size to 1024 bytes and bandwidth to 1

Gbps?

slide-146
SLIDE 146

Cable Length Examples

36

min_frame_size / (2*bandwidth) * light_speed = max_cable_length

(64B*8) / (2*10Mbps) * (2.5*108mps) = 6400 meters

What is the max cable length if min frame size were changed to 1024 bytes?

102.4 kilometers

What is max cable length if bandwidth were changed to 1 Gbps ?

64 meters

What if you changed min packet size to 1024 bytes and bandwidth to 1

Gbps?

1024 meters

slide-147
SLIDE 147

Exponential Backoff

37

When a sender detects a collision, send “jam signal”

Make sure all hosts are aware of collision Jam signal is 32 bits long (plus header overhead)

Exponential backoff operates in multiples of 512 bits (64 bytes)

Select k ∈ [0, 2n – 1], where n = number of sequential collisions Wait k * 51.2µs before retransmission n is capped at 10, frame dropped after 16 collisions

Backoff time is divided into contention slots

slide-148
SLIDE 148

Exponential Backoff

38

Why is minimum backoff timer 512 bits? Minimum Ethernet packet size is also 512 bits

64 bytes * 8 = 512 bits

Coincidence? Of course not.

If the backoff time was <512 bits, a sender who waits and another who sends

immediately can still collide

slide-149
SLIDE 149

Maximum Packet Size

39

Maximum Transmission Unit (MTU): 1500 bytes Pros:

slide-150
SLIDE 150

Maximum Packet Size

39

Maximum Transmission Unit (MTU): 1500 bytes Pros: Bit errors in long packets incur significant recovery penalty

slide-151
SLIDE 151

Maximum Packet Size

39

Maximum Transmission Unit (MTU): 1500 bytes Pros: Bit errors in long packets incur significant recovery penalty Cons:

slide-152
SLIDE 152

Maximum Packet Size

39

Maximum Transmission Unit (MTU): 1500 bytes Pros: Bit errors in long packets incur significant recovery penalty Cons: More bytes wasted on header information Higher per packet processing overhead

slide-153
SLIDE 153

Maximum Packet Size

39

Maximum Transmission Unit (MTU): 1500 bytes Pros: Bit errors in long packets incur significant recovery penalty Cons: More bytes wasted on header information Higher per packet processing overhead Datacenters shifting towards Jumbo Frames 9000 bytes per packet

slide-154
SLIDE 154

Long Live Ethernet

40

Today’s Ethernet is switched

CSMA/CD is no longer necessary More on this later

1Gbit and 10Gbit Ethernet now common

100Gbit on the way Uses same old packet header Full duplex (send and receive at the same time) Auto negotiating (backwards compatibility) Can also carry power

slide-155
SLIDE 155

❑ Framing ❑ Error Checking and Reliability ❑ Media Access Control

802.3 Ethernet

802.11 Wifi

Outline

41

slide-156
SLIDE 156

802.3 Ethernet vs. Wireless

42

Ethernet has one shared collision domain

All hosts on a LAN can observe all transmissions

Wireless radios have small range compared to overall system

Collisions are local Collision are at the receiver, not the sender Carrier sense (CS in CSMA) plays a different role

802.11 uses CSMA/CA not CSMA/CD

Collision avoidance, rather than collision detection

slide-157
SLIDE 157

Hidden Terminal Problem

43

A B C

Radios on the same network cannot always hear each other

slide-158
SLIDE 158

Hidden Terminal Problem

43

A B C

Radios on the same network cannot always hear each other

slide-159
SLIDE 159

Hidden Terminal Problem

43

A B C

Collision!

Radios on the same network cannot always hear each other

slide-160
SLIDE 160

Hidden Terminal Problem

43

A B C

Collision! A cannot hear C C cannot hear A

Radios on the same network cannot always hear each other

slide-161
SLIDE 161

Hidden Terminal Problem

43

A B C

Collision! A cannot hear C C cannot hear A

Radios on the same network cannot always hear each other

Hidden terminals mean that sender-side collision detection is useless

slide-162
SLIDE 162

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

A B C D

slide-163
SLIDE 163

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

A B C D

slide-164
SLIDE 164

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

No collision

A B C D

No collision

slide-165
SLIDE 165

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

A B C D

slide-166
SLIDE 166

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

Carrier sense detects a busy channel

A B C D

slide-167
SLIDE 167

Exposed Terminal Problem

44

Carrier sensing is problematic in wireless

Carrier sense detects a busy channel

A B C D

Carrier sense can erroneously reduce utilization

slide-168
SLIDE 168

Reachability in Wireless

45

High level problem:

Reachability in wireless is not transitive Just because A can reach B, and B can reach C, doesn’t mean A can reach C

A B C D

slide-169
SLIDE 169

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver Host in Receiver’s Range Host in Sender’s Range

slide-170
SLIDE 170

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver Host in Receiver’s Range Host in Sender’s Range

Sense the channel

slide-171
SLIDE 171

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver RTS Host in Receiver’s Range Host in Sender’s Range RTS

Soft-reserve the channel Sense the channel

slide-172
SLIDE 172

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver RTS Host in Receiver’s Range Host in Sender’s Range RTS CTS CTS

Soft-reserve the channel The receiver is busy Sense the channel

slide-173
SLIDE 173

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver RTS Host in Receiver’s Range Host in Sender’s Range RTS CTS CTS Data Data

Soft-reserve the channel RTS but no CTS = clear to send The receiver is busy Sense the channel

slide-174
SLIDE 174

MACA

46

Multiple Access with Collision Avoidance

Developed in 1990

Sender Receiver RTS Host in Receiver’s Range Host in Sender’s Range RTS CTS CTS Data Data ACK ACK

Successful transmission Channel is idle

slide-175
SLIDE 175

Collisions in MACA

47

What if sender does not receive CTS or ACK?

Assume collision Enter exponential backoff mode

slide-176
SLIDE 176

802.11b

48

802.11

Uses CSMA/CA, not MACA

802.11b

Introduced in 1999 Uses the unlicensed 2.4 Ghz band

■ Same band as cordless phones, microwave ovens

5.5 and 11 Mbps data rates

■ Practical throughput with TCP is only 5.9 Mbps

11 channels (in the US). Only 1, 6, and 11 are orthogonal

slide-177
SLIDE 177

802.11b

48

802.11

Uses CSMA/CA, not MACA

802.11b

Introduced in 1999 Uses the unlicensed 2.4 Ghz band

■ Same band as cordless phones, microwave ovens

5.5 and 11 Mbps data rates

■ Practical throughput with TCP is only 5.9 Mbps

11 channels (in the US). Only 1, 6, and 11 are orthogonal

slide-178
SLIDE 178

802.11a/g

49

802.11a

Uses the 5 Ghz band 6, 9, 12, 18, 24, 36, 48, 54 Mbps

802.11g

Introduced in 2003 Uses OFDM to improve performance (54 Mbps) Backwards compatible with 802.11b

■ Warning: b devices cause g networks to fall back to CCK

slide-179
SLIDE 179

802.11n/ac

50

802.11n

Introduced in 2009 Multiple Input Multiple Output (MIMO)

■ Multiple send and receive antennas per devices (up to four) ■ Data stream is multiplexed across all antennas

Maximum 600 Mbps transfer rate (in a 4x4 configuration) 300 Mbps is more common (2x2 configuration)

802.11ac

8x8 MIMO in the 5 GHz band, 500 Mbps – 1 GBps rates

slide-180
SLIDE 180

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

slide-181
SLIDE 181

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

Sender Time Channel Busy

slide-182
SLIDE 182

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

Sender Time Channel Busy

Sense the channel

slide-183
SLIDE 183

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

Sender Time Channel Busy SIFS PIFS DIFS

slide-184
SLIDE 184

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

Sender Time Channel Busy SIFS PIFS DIFS Contention

slide-185
SLIDE 185

802.11 Media Access

51

MACA-style RTS/CTS is optional Distributed Coordination Function (DCF) based on… Inter Frame Spacing (IFS)

■ DIFS – low priority, normal data packets ■ PIFS – medium priority, used with Point Coordination Function (PCF) ■ SIFS – high priority, control packets (RTS, CTS, ACK, etc.)

Contention interval: random wait time

Sender Time Channel Busy SIFS PIFS DIFS Contention

Sense the channel

Transmit Data

slide-186
SLIDE 186

802.11 DCF Example

52

Sender 1 Time Sender 2 Sender 3 Channel Busy

slide-187
SLIDE 187

802.11 DCF Example

52

Sender 1 Time

Sense the channel

Sender 2 Sender 3 Channel Busy

slide-188
SLIDE 188

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Sender 2 Sender 3 Channel Busy

slide-189
SLIDE 189

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Sender 2 Sender 3 Channel Busy Contention

slide-190
SLIDE 190

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Sender 2 Sender 3 Channel Busy Contention

Sense the channel

slide-191
SLIDE 191

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Transmit Data Sender 2 Sender 3 Channel Busy Contention

slide-192
SLIDE 192

Channel Busy

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Transmit Data Sender 2 Sender 3 Channel Busy Contention

slide-193
SLIDE 193

Channel Busy

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Transmit Data Sender 2 Sender 3 Channel Busy Contention

Sense the channel Sense the channel

slide-194
SLIDE 194

Channel Busy

802.11 DCF Example

52

Sender 1 Time SIFS PIFS DIFS Transmit Data Sender 2 Sender 3 Channel Busy Contention

slide-195
SLIDE 195

801.11 is Complicated

53

We’ve only scratched the surface of 802.11

Association – how do clients connect to access points?

■ Scanning ■ What about roaming?

Variable sending rates to combat noisy channels Infrastructure vs. ad-hoc vs. point-to-point

■ Mesh networks and mesh routing

Power saving optimizations

■ How do you sleep and also guarantee no lost messages?

Security and encryption (WEP

, WAP , 802.11x)

This is why there are courses on wireless networking