local area network and ethernet - tsinghua...

66
Local Area Network and Ethernet 2012/11/23 1 Dan LI CS Department, Tsinghua University

Upload: others

Post on 10-Apr-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Local Area Network and

Ethernet

2012/11/23 1

Dan LI

CS Department, Tsinghua University

Page 2: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Today’s Lecture

MAC (Medium Access Control)

Ethernet

Bridges and LAN switches

Reading list

2012/11/23 2

Page 3: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 1 – Sharing a Wire

Two hosts share a wire

One to send

The other to receive and wait to send

… But what if we want more hosts?

2012/11/23 3

Page 4: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 1 – Sharing a Wire

2012/11/23 4 4

Expensive! Can we share a wire?

Switches Wires for everybody!

Page 5: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 2 – Listen and Talk

Natural scheme – listen before you talk…

Works well in practice

yak yak…

2012/11/23 5

Page 6: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 2 – Listen and Talk

Natural scheme – listen before you talk…

Works well in practice

yada yada…

2012/11/23 6

Page 7: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 2 – Listen and Talk

Natural scheme – listen before you talk…

Works well in practice

But sometimes breaks down when two want to

speak at the same time

Why? How do we fix/prevent this?

yada

yada… yak yak…

2012/11/23 7

Page 8: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Problem 3 – Who is the Packet for?

Need to put an address on the packet

What should it look like?

How do you know what address you want to

send to?

2012/11/23 8

Page 9: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Multiple Access Methods

Fixed assignment

Partition channel so each node gets a slice of the bandwidth

Essentially circuit switching – thus inefficient

Examples: TDMA, FDMA, CDMA

Random access

Nodes contends equally for bandwidth and recover from collisions

Examples: Aloha, Ethernet

Token-based or reservation-based

Take turns using the channel

Examples: Token ring

2012/11/23 9

Page 10: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Random Access Protocols

When node has packet to send

Transmit at full channel data rate

No a priori coordination among nodes

Two or more transmitting nodes “collision”

Random access MAC protocol specifies

How to detect collisions

How to recover from collisions (e.g., via delayed retransmissions)

Examples of random access MAC protocols:

Slotted ALOHA and ALOHA

CSMA and CSMA/CD

2012/11/23 10

Page 11: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Aloha – Basic Technique

First random MAC developed

For radio-based communication in Hawaii (1970)

Basic idea:

When you’re ready, transmit

Receiver’s send ACK for data

Detect collisions by timing out for ACK

Recover from collision by trying after random delay

Too short large number of collisions

Too long underutilization

2012/11/23 11

Page 12: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Pure ALOHA

Simple idea

Let users transmit whenever they have data to be sent

Each station transmit frames arbitrarily

If collision occurs, the sender waits a random time

and sends it again

2012/11/23 12

N N-1 2 1

interface Bus channel

The model of ALOHA

Page 13: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Pure ALOHA Collision

2012/11/23 13

Collision reason:two station send frame simultaneously

1 2 N-1 N ...

Page 14: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Pure ALOHA Collision(cont’d)

2012/11/23 14

A1

new frame

B1

A2 A2

B1

collison

t1

t2 B2

A2 t3

B2 t4

B3

A3 Station A

Station B

Final effect A1 B1 A2 B2

t

t

t

Page 15: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Performance Analysis(1)

2012/11/23 15

Vulnerable period for the shaded frame.

Collides with

the start of the

shaded frame

Collides with

the end of the

shaded frame

t

0t 0t t0 2t t

0 3t t

Page 16: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Performance Analysis(2)

Assumptions

Fixed frame length, frame time is t

New frames generated and retransmitted according to Poisson

distribution

Parameters

Throughput S: mean successful frames per frame time 0 S 1

Network load G: mean frames per frame time G ≥ S

Successful transmission probability: P0=S/G

2012/11/23 16

Page 17: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Performance Analysis(3)

2012/11/23 17

P0= P [no other traffic being initiated during

the entire vulnerable period ]

= e –λ2t = e –2G

(P=(λT)K e-λT/K!)

Throughput: S = G P0 = G e -2G

Maximum throughput occurs when

G=0.5,

S=1/2e ≈ 0.184

Page 18: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Slotted Aloha

Principle: divide time into discrete intervals

Each interval corresponding to one frame

Each user must know slot boundaries (synchronization)

2012/11/23 18

A1

new frame

B3

A2 A2

B1

collision

t1

t2 B2 B2 B3

A3

station B

final effect A1 B1 A2 B2 A3

station A

Page 19: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Performance Analysis(1)

P0= P [ arrival interval> t ]

= e - λ t = e –G

Throughput S = G P0 = G e –G

Maximum throughput occurs when G=1,

S=1/e ≈ 0.368

2012/11/23 19

t t

Page 20: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

ALOHA Summary

2012/11/23 20

Throughput versus offered traffic for ALOHA systems

Page 21: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Expected Number of Transmissions

Pure ALOHA

P0=e-2G

Pk=e-2G(1-e-2G)k-1

E= kPk=e2G

Slotted ALOHA

P0=e-G

Pk=e-G(1-e-G)k-1

E= kPk=eG

2012/11/23 21

Page 22: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Today’s Lecture

MAC(Medium Access Control)

Ethernet

Bridges and LAN switches

Reading list

2012/11/23 22

Page 23: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Origin of Ethernet

First practical local area network, built at Xerox PARC in 70’s

“Dominant” LAN technology:

Cheap

Kept up with speed race: 10, 100, 1000 Mbps

2012/11/23 23

Metcalfe’s Ethernet

sketch

Page 24: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet

CSMA/CD

Backoff Algorithm

Frame Structure

Experiences with Ethernet

2012/11/23 24

Page 25: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet MAC – Carrier Sense

Basic idea Listen to wire before

transmission

Avoid collision with active transmission

Why didn’t ALOHA have this? In wireless, relevant

contention at the receiver, not sender Hidden terminal

Exposed terminal

2012/11/23 25

NY

CMU

Chicago

St.Louis

Chicago

CMU

NY

Hidden Exposed

Page 26: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet CSMA protocols

Station listens for a carrier before sending

Classification:

1-persistent CSMA

* Waits until it becomes idle, then transmits frame

immediately

* If a collision occurs, waits for a random amount of

time and start all over again

Non-persistent CSMA

* If the channel is busy, waits for a random amount of

time and sense channel again

2012/11/23 26

Page 27: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet CSMA Protocols (Cont.)

P-persistent CSMA (slotted channel)

If the channel is busy, waits to the next slot

If idle, transmits frame with probability of p

With a probability of q=1-p it defers to the next

slot,

If that slot is also idle, it either transmits or

defers again, with probabilities p and q.

Repeat the process

2012/11/23 27

Page 28: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

CSMA Comparison

1-persistent CSMA

High throughput and low delay with low load

Low throughput with high load

Non-persistent CSMA

High throughput with high load

p-persistent CSMA

Between 1-persistent CSMA and Non-persistent

CSMA

2012/11/23 28

Page 29: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Various Random Access Protocols

Comparison of the channel utilization versus load

for various random access protocols.

2012/11/23 29

Page 30: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

30

Ethernet Collision Detection

ALOHA has collision detection?

That was very slow and inefficient

Ethernet MAC

Listen while transmitting

If you notice interference assume collision

Why didn’t ALOHA have this?

Very difficult for radios to listen and transmit

Signal strength is reduced by distance for radio

Page 31: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Collisions

Collisions are caused when two adaptors

transmit at the same time

Both found line to be idle

Both had been waiting for a busy line to become

idle

Luckily, adaptors can sense collision based

on voltage differences

2012/11/23 31

Page 32: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Collisions (Cont.)

2012/11/23 32

A B

A B

A starts at

time 0

Message almost

there at time T

when B starts –

collision!

How can we be sure A knows about the collision?

Page 33: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Collision Detection

How can A know that a collision has taken

place?

There must be a mechanism to insure

retransmission on collision

A’s message reaches B at time T

B’s message reaches A at time 2T

So, A must still be transmitting at 2T

2012/11/23 33

Page 34: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Collision Detection (Cont.)

2012/11/23 34

A B

A B

A B

time = 0

time = T

time = 2T

Page 35: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

IEEE 802.3

Specifies max value of 2T to be 51.2us This relates to maximum distance of 2500m between

hosts

At 10Mbps it takes 0.1us to transmit one bit so 512 bits (64B) take 51.2us to send

So, Ethernet frames must be at least 64B long

14B header, 46B data, 4B CRC

Padding is used if data is less than 46B

Send jamming signal after collision is detected to insure all hosts see collision

48 bits signal

2012/11/23 35

Page 36: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Gigabit Ethernet

Minimum packet size requirement

Make min packet size larger!

6400B for 2500m LAN, 640B for 250m LAN

Make network smaller?

25m for 64B, which is too small

Gigabit Ethernet uses carrier extension for small packets and backward compatibility

Maximum packet size requirement

1500 bytes is not really “hogging” the network

Defines “jumbo frames” (9000 bytes) for higher efficiency

2012/11/23 36

Page 37: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Collision Free Protocols

Pure ALOHA, slotted ALOHA, CSMA and

CSMA/CD are contention based protocols

CSMA with collision detection CSMA/CD

Collision free protocols:

Pay constant overhead to achieve performance

guarantee

Good when network load is high

2012/11/23 37

Page 38: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Bit-Map based Protocol

Contention and data transmission periods

alternate

The contention period is divided into slots, with

1 bit-wide slots for each host in the network

If a host wants to transmit a packet, it sets its

contention slot equal to 1

Otherwise, it sets it to 0

The slots pass all hosts in sequence, so every

host is aware of who will transmit

2012/11/23 38

Page 39: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Bit-Map based Protocol (Cont.)

2012/11/23 39

1 1 1 1 1 1 2 4 5 6

01234567 01234567

0 4

data frame

But what if there are a large number of hosts in

the network?

The contention period will have to grow to

include them all

With a large number of hosts, the contention

period may be very long, leading to inefficiency

Page 40: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Binary Countdown Protocol

During Contention Period

Each host broadcasts its binary address one bit at a time, starting with the most significant bit

Bits transmitted simultaneously are boolean OR’d together

Arbitration rule

If a host sent a zero bit but the boolean OR results in a one bit, the host gives up and stops sending address bits

Whichever host remains after the entire address has been broadcast gets access to the medium

2012/11/23 40

Page 41: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Binary Countdown (Cont.)

2012/11/23 41

0 0 1 0 0 - - -

0 - - -

1 0 0 -

1 0 1 0

0 1 2 3

Bit Time Host

Addresses

0 1 0 1

1 0 0 1

1 0 1 0

Page 42: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Binary Countdown: Fairness

Stations with the highest addresses will always win

This is good if you want to implement priority, but bad if you want to give all hosts fair access to the channel

Used in CAN-bus networks (cars)

Solution:

Change the address of a host after a successful transmission

2012/11/23 42

Page 43: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Binary Countdown: Permuting Addresses

After successful transmission of host A, all

hosts with addresses less than host A add

one to their address, improving their priority

Host A changes its address to zero, giving it

the lowest priority

2012/11/23 43

Page 44: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Limited Contention Protocols

Collision based protocols (ALOHA,CSMA/CD) are good when the network load is low

Collision free protocols (bit map, binary countdown) are good when load is high

How about combining their advantages -- limited contention protocols

Behave like the ALOHA scheme under light load

Behave like the bitmap scheme under heavy load

2012/11/23 44

Page 45: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Limited Contention Protocols (Cont.)

Trick: partition the group of station and limit

the contention for each slot

Under light load, every one can try for each slot

like aloha

Under heavy load, only a small group can try for

each slot

How can we do it

2012/11/23 45

Page 46: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Adaptive Tree Walk Protocol

Treat stations as the leaf of a binary tree

At the first slot, all stations under the root

node can try to get the sending slot

If no conflict, fine

If conflict, only nodes under a subtree get to try

for the next one

Depth first search

Recursively

2012/11/23 46

Page 47: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Example

2012/11/23 47

0

1 2

3 4 5 6

A B C* D E* F* G H*

Page 48: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Example (Cont.)

Slot 0: C*, E*, F*, H* (all nodes under node 0 can try), conflict

Slot 1: C* (all nodes under node 1 can try), C sends

Slot 2: E*, F*, H*(all nodes under node 2 can try), conflict

Slot 3: E*, F* (all nodes under node 5 can try), conflict

Slot 4: E* (all nodes under E can try), E sends

Slot 5: F* (all nodes under F can try), F sends

Slot 6: H* (all nodes under node 6 can try), H sends

2012/11/23 48

Page 49: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet

CSMA/CD

Backoff Algorithm

Frame Structure

Experiences with Ethernet

2012/11/23 49

Page 50: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 50

Ethernet CSMA/CD Workflow

Packet?

Sense

Carrier

Discard

Packet

Send Detect

Collision

Jam channel

b=CalcBackoff();

wait(b);

attempts++;

No

Yes

attempts < 16

attempts == 16

Page 51: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 51

Ethernet CSMA/CD (Cont.)

Jam signal

Make sure all other transmitters are aware of collision; 48 bits;

Exponential backoff

If deterministic delay after collision, collision will occur again in lockstep

Why not random delay with fixed mean? Few senders needless waiting

Too many senders too many collisions

Goal

Adapt retransmission attempts to estimated current load

Page 52: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet Backoff Calculation

Exponentially increasing the random delay

Infer senders from the number of collisions

More senders increase wait time

First collision: choose K from {0,1}; delay is K x 512 bit transmission times

After second collision: choose K from {0,1,2,3}…

After ten or more collisions, choose K from {0,1,2,3,4,…,1023}

2012/11/23 52

Page 53: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Transmission Attempts

2012/11/23 53

0

100

200

300

400

500

600

Sec

onds

0 2 4 6 8 10 12Transmission Attempts

Page 54: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet

CSMA/CD

Backoff Algorithm

Frame Structure

Experiences with Ethernet

2012/11/23 54

Page 55: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 55

Ethernet Frame Structure

Sending adapter encapsulates IP datagram

(or other network layer protocol packet) in

Ethernet frame

Page 56: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 56

Ethernet Frame Structure (Cont.)

Preamble: 8 bytes

101010…1011

Used to synchronize receiver, sender clock rates

CRC: 4 bytes

Checked at receiver, if error is detected, the

frame is simply dropped

Page 57: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 57

Ethernet Frame Structure (Cont.)

Addresses: 6 bytes

Each adapter is given a globally unique address at manufacturing time

Address space is allocated to manufacturers 24 bits identify manufacturer

E.g., 0:0:15:* 3com adapter

Frame is received by all adapters on a LAN and dropped if address does not match

Special addresses

Broadcast – FF:FF:FF:FF:FF:FF is “everybody”

Range of addresses allocated to multicast Adapter maintains list of multicast groups node is interested in

Page 58: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

2012/11/23 58

Ethernet Frame Structure (Cont.)

Each protocol layer needs to provide some hooks to

upper layer protocols

Demultiplexing: identify which upper layer protocol packet

belongs to

E.g., port numbers allow TCP/UDP to identify target application

Ethernet uses Type field

Type: 2 bytes

Indicates the higher layer protocol, e.g., IP, IPv6, ARP

Page 59: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

59

Ethernet Frame Structure (Cont.)

Each protocol layer needs to provide some

hooks to upper layer protocols

Demultiplexing: identify which upper layer protocol

packet belongs to

E.g., port numbers allow TCP/UDP to identify target

application

Ethernet uses Type field

Type: 2 bytes

Indicates the higher layer protocol, e.g., IP, IPv6,

ARP

Page 60: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Address

2012/11/23 60

0 Single address

1 Group address

Destination address is

either single address or

group address (broadcast

= 111...111)

Addresses are defined on

local or universal basis

246 possible global

addresses

0 Local address

1 Global address

Page 61: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet

CSMA/CD

Backoff Algorithm

Frame Structure

Experiences with Ethernet

2012/11/23 61

Page 62: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

62

Why Did Ethernet Win?

Failure modes

Ethernet – node detached

Token rings – network unusable

Good performance in common case

Deals well with bursty traffic

Usually used at low load

Volume lower cost higher volume ….

Easy incremental deployment

Cheap cabling, etc

Page 63: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Why Did Ethernet Win? (Cont.)

You plug in the host and it basically works

No configuration at the data link layer

Today: may need to deal with security

Protocol is fully distributed

Broadcast based

In part explains the easy management

Some of the LAN protocols (e.g. ARP) rely on broadcast

Networking would be harder without ARP

2012/11/23 63

Page 64: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Experiences with Ethernet

Ethernets work best under light loads

Utilization over 30% is considered heavy

Network capacity is wasted by collisions

Most networks are limited to about 200 hosts

Specification allows for up to 1024

Most networks are much shorter

5 to 10 microsecond RTT

Ethernet is inexpensive, fast and easy to

administer

2012/11/23 64

Page 65: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

Ethernet Problems

Ethernet’s peak utilization is pretty low (like Aloha)

Peak throughput worst with

More hosts

More collisions needed to identify single sender

Smaller packet sizes

More frequent arbitration

Longer links

Collisions take longer to observe, more wasted bandwidth

Efficiency is improved by avoiding these conditions

2012/11/23 65

Page 66: Local Area Network and Ethernet - Tsinghua Universitythu-cmu.cs.tsinghua.edu.cn/curriculum/ACN/lectures/02_LAN and Eth… · Adaptive Tree Walk Protocol Treat stations as the leaf

66

Summary

CSMA/CD carrier sense multiple access with

collision detection

Why do we need exponential backoff?

Why does collision happen?

Why do we need a minimum packet size?

How does this scale with speed?

Ethernet

What is the purpose of different header fields?

What do Ethernet addresses look like?