Lecture 22 Ethernet - University of California,...

40
Lecture 22 Ethernet EECS 122 University of California Berkeley

Transcript of Lecture 22 Ethernet - University of California,...

Page 1: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

Lecture 22Ethernet

EECS 122

University of CaliforniaBerkeley

Page 2: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

2EECS122 - Contents – Index -

EthernetOverviewPhysical LayerMACLearning and Spanning TreeVLANLink AggregationXON/XOFF802.11

ETHERNET

Page 3: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

3EECS122 - Contents – Index -

OverviewTypical SetupNamesOperationsPerspective

ETHERNET - Overview

Page 4: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

4EECS122 - Contents – Index -

Typical Setup

ETHERNET – Overview - Typical

Page 5: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

5EECS122 - Contents – Index -

NamesStructure

[rate][modulation][media or distance]10Base5 (10Mbps, baseband, coax, 500m)10Base-T (10Mbps, baseband, twisted pair)100Base-TX (100Mbps, baseband, 2 pair)100Base-FX (100Mbps, baseband, fiber)1000Base-CX for two pairs balanced copper cabling 1000Base-LX for long wavelength optical transmission 1000Base-SX for short wavelength optical transmission.

Wireless:Wi-Fi = 802.11Versions: a, b, g

ETHERNET – Overview - Names

Page 6: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

6EECS122 - Contents – Index -

OperationsHub: Single Collision Domain

MAC Protocol: Wait until silent (carrier sense)TransmitIf collision, wait random time & repeatCSMA/CD

ETHERNET – Overview – Operations

Page 7: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

7EECS122 - Contents – Index -

OperationsSwitch: No Collisions

Multiple transmissions are possibleSwitch stores packets that wait for same output

ETHERNET – Overview Operations

Page 8: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

8EECS122 - Contents – Index -

Perspective

Ethernet is wildly successful, partly due to low cost (compare with FDDI or Token Ring--- see text book)Some issues:

nondeterministic serviceno prioritiesmin frame size may be large

ETHERNET Overview - Perspective

Page 9: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

9EECS122 - Contents – Index -

Physical Layer

ETHERNET – Physical

Page 10: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

10EECS122 - Contents – Index -

Physical

ETHERNET Physical

Page 11: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

11EECS122 - Contents – Index -

MAC: Media Access ControlFrameMultiple Access

ETHERNET - MAC

Page 12: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

12EECS122 - Contents – Index -

Frame

7 byte preamble: alternating 1/0 combination producing 10Mhz square wave [@ 10Mbps] for 5.6 µsec; used for receiver synchronization

1 byte SFD (start of frame delimiter) 10101011

ETHERNET – MAC – Frame

Page 13: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

13EECS122 - Contents – Index -

FrameLength/Type field:

Type (Ethernet)indicates type of data contained in payloadissue: what is the length?

Length field (802.3)type info follows frame header

So, is it the type or length?“Ethernet”: types have values above 2048 (RFC894 for IP)802.3: length (RFC1042 for IP)

If length, next headers are LLC & SNAP (for IP)LLC (3 bytes): DSAP, SSAP, CTLSNAP (5 bytes): org code, type (above)

ETHERNET – MAC Frame

Page 14: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

14EECS122 - Contents – Index -

Multiple AccessHigh-Level ViewMultiple Access ProtocolsRandom Access ProtocolsSlotted ALOHACSMA/CD

ETHERNET – MA

Page 15: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

15EECS122 - Contents – Index -

High-Level ViewGoal: share a communication medium among multiple hosts connected to itProblem: arbitrate between connected hostsSolution goals:

High resource utilizationAvoid starvationSimplicity (non-decentralized algorithms)

ETHERNET – MA High Level

Page 16: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

16EECS122 - Contents – Index -

Medium Access ProtocolsChannel partitioning

Divide channel into smaller “pieces” (e.g., time slots, frequency)Allocate a piece to node for exclusive use

Random accessAllow collisions“recover” from collisions

“Taking-turns”Tightly coordinate shared access to avoid collisions

ETHERNET – MA Protocols

Page 17: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

17EECS122 - Contents – Index -

Random Access protocolsWhen node has packet to send

Transmit at full channel data rate R.No a priori coordination among nodes

Two or more transmitting nodes -> “collision”,Random access MAC protocol specifies:

How to detect collisionsHow to recover from collisions

Examples of random access MAC protocols:Slotted ALOHACSMA and CSMA/CD

ETHERNET – MA Random

Page 18: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

18EECS122 - Contents – Index -

Slotted Aloha

Time is divided into equal size slots (= packet transmission time)Node with new arriving pkt: transmit at beginning of next slot If collision: retransmit pkt in future slots with probability p, until successful.

Success (S), Collision (C), Empty (E) slots

ETHERNET – MA – S.Aloha

Page 19: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

19EECS122 - Contents – Index -

Slotted Aloha: EfficiencyWhat is the maximum fraction of successful transmissions? Suppose N stations have packets to send

Each transmits in slot with probability pProb. successful transmission S is (very approximated analysis!):

by a particular node: S = p (1-p)(N-1)

by any of N nodes

S = Prob (only one transmits)= N p (1-p)(N-1) ≈ 1/e = 0.37

ETHERNET – MA S.Aloha

Page 20: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

20EECS122 - Contents – Index -

CSMA: Carrier Sense Multiple Access

CS (Carrier Sense) means that each node can distinguish between an idle and a busy linkSender operations:

If channel sensed idle: transmit entire packetIf channel sensed busy, defer transmission

Persistent CSMA: retry immediately with probability p when channel becomes idleNon-persistent CSMA: retry after a random time interval

ETHERNET – MA – CSMA

Page 21: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

21EECS122 - Contents – Index -

CSMA: collisionsspatial layout of nodes along ethernet

Collisions can occur:propagation delay means two nodes may not hear each other’s transmission

Collision:entire packet transmission time wasted

Note:role of distance and propagation delay in determining collision prob.

ETHERNET – MA CSMA

Page 22: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

22EECS122 - Contents – Index -

CSMA/CD (collision detection)OverviewTimingEthernet

ETHERNET – MA – CSMA/CD

Page 23: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

23EECS122 - Contents – Index -

Overview

Collisions detected within short timeColliding transmissions aborted, reducing channel wastage Easy in wired LANs: measure signal strengths, compare transmitted, received signalsDifficult in wireless LANs

ETHERNET – MA – CSMA/CD - Overview

Page 24: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

24EECS122 - Contents – Index -

Timing

ETHERNET – MA – CSMA/CD - Timing

Page 25: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

25EECS122 - Contents – Index -

EthernetOverviewCollision DetectionMinimum Frame SizeMaximum Frame SizeOperationsEfficiencyAddressingFast EthernetGigabit Ethernet

ETHERNET – MA – CSMA/CD - Ethernet

Page 26: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

26EECS122 - Contents – Index -

Overview

Will discuss “classical” Ethernet primarilySingle segments up to 500m; with up to 4 repeaters gives 2500m max lengthBaseband signals broadcast, Manchester encoding, 32-bit CRC for error detectionMax 100 stations/segment, 1024 stations/Ethernet

ETHERNET – MA – CSMA/CD – Ethernet Overview

Page 27: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

27EECS122 - Contents – Index -

Collision Detection CD circuit operates by looking for voltage exceeding a transmitted voltageWant to ensure that a station does not complete transmission prior to 1st bit arriving at farthest-away stationTime to CD can thus take up to 2x{max prop. delay}

CD

A B

time

ETHERNET – MA – CSMA/CD – Ethernet CD

Page 28: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

28EECS122 - Contents – Index -

Minimum Frame Size

Speed of light is about 4µs/km in copperSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTTWith repeaters, etc. 802.3 requires 51usec, corresponding to 512 bit-timesThus, minimum frame size is 512 bits (64 bytes); also called slot time

ETHERNET – MA – CSMA/CD – Ethernet Minimum

Page 29: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

29EECS122 - Contents – Index -

Maximum Frame Size

1500 byte limitation on maximum frame transmission sizeWe will call this the MTUlimits maximum buffers at receiverallows for other stations to send

also requires 96 bit Inter-Packet-Gap (IPG)

ETHERNET – MA – CSMA/CD – Ethernet Maximum

Page 30: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

30EECS122 - Contents – Index -

Operations

When ready & line idle, await IPG (96 bit times) and send while listening (CD)If CD true, send max 48-bit jamming sequence and do exponential backoffJamming sequence used to inform all stations that a collision has occurred

ETHERNET – MA – CSMA/CD – Ethernet – Operations

Page 31: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

31EECS122 - Contents – Index -

Operations

For retransmission N (1<=N<=10)choose k at random on U(0..2^N-1)wait k * (51.2µsec) to retransmitsend on idle; repeat on another collisionfor (11<=N<=15), use U(0..1023)if N = 16, drop frame

Longer wait implies lower priority (strategy is not “fair”)

ETHERNET – MA – CSMA/CD – Ethernet – Operations

Page 32: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

32EECS122 - Contents – Index -

Operations: Capture Effect

Given two stations A & B, unfair strategy can cause A to continue to “win”Assume A & B always ready to send:

if busy, both wait, send and collidesuppose A wins, B backs offnext time, B’s chances of winning are halved

ETHERNET – MA – CSMA/CD – Ethernet Operations

Page 33: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

33EECS122 - Contents – Index -

Efficiency Typical Sequence of Events:

Average = 5TT = max.prop.time

between 2 nodesAverage = L/R secondsL = average packet length

StartTransmitting

Collision

Wait RandomTime

Efficiency = L/RL/R + 5T

= 1/(1 + 5a)

a = T/(L/R) = RT/L

Successful Transmission

ETHERNET – MA – CSMA/CD – Ethernet – Efficiency

Page 34: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

34EECS122 - Contents – Index -

Efficiency a impacts what happens during simultaneous transmission:

a small early collision detectionEfficient

a large late detectionInefficient

Example 1: 10Mbps, 1000m => T = (1km)(4µs/km) = 4µs; RT = 400 bits

L = 4000 bits, say5a = 2000/4000 = 0.5 => efficiency = 66%

Example 2: 1Gbps, 200m=> T = (0.2km)((4µs/km) = 0.8µs; RT = 800 bits

L = 4000 bits; 5a = 4000/4000 = 1 => efficiency = 50%

a = RT/Leff = 1/(1 + 5a)

ETHERNET – MA – CSMA/CD – Ethernet – Efficiency

Page 35: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

35EECS122 - Contents – Index -

Efficiency - AnalysisModel:

Slot = 2T

N stations compete by transmitting with probability p, independently

If success => transmit L bitsIf failure (idle or collision), try next slot

P(success) = P(exactly 1 out of N transmits) = Np(1 – p)N-1

Indeed: N possibilities of station that transmitsP(one given station transmits, others do not) = p(1 – p)N-1

ETHERNET – MA – CSMA/CD – Ethernet – Efficiency

Page 36: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

36EECS122 - Contents – Index -

Efficiency - AnalysisSlot = 2T

success

Average = A

P(success) = Np(1 – p)N-1

Assume backoff algorithm results in best p = 1/N=> P(success) ≈ 1/e = 0.36

Average time until success: A = 0.36x0 + 0.64x(2T + A)

=> A = 1.28T/0.36 = 3.5TIn practice, backoff not quite optimal => 5T

ETHERNET – MA – CSMA/CD – Ethernet Efficiency

Page 37: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

37EECS122 - Contents – Index -

Addressing

48 bit Ethernet/MAC/Hardware AddressesPrefix assigned per-vendor by IEEEUnique per-adapter, burned in ID PROMMulticast & Broadcast (all 1’s) addressesMany adapters support promiscuous mode

ETHERNET – MA – CSMA/CD – Ethernet – Addressing

Page 38: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

38EECS122 - Contents – Index -

Addressing - Multicast

Each vendor assignment supports 2^24 individual and group (multicast) addressesEach adapter supports multiple group “subscriptions”

usually implemented as hash tablethus, software may have to filter at higher layer

ETHERNET – MA – CSMA/CD – Ethernet Addressing

Page 39: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

39EECS122 - Contents – Index -

Fast Ethernet

“Fast Ethernet” (1995) adds:10x speed increase (100m max cable length retains min 64 byte frames)replace Manchester with 4B/5B (from FDDI)full-duplex operation using switchesspeed & duplex auto-negotiation

ETHERNET – MA – CSMA/CD – Ethernet Fast

Page 40: Lecture 22 Ethernet - University of California, Berkeleyrobotics.eecs.berkeley.edu/~wlr/12203/ethernet 1.pdfSo, max Ethernet signal prop time is about 10 µsec, or 20µsec RTT With

40EECS122 - Contents – Index -

Gigabit Ethernet IEEE 802.3{z,ab} 1000 Mb/s

“Gigabit Ethernet” (1998,9) adds:100x speed increasecarrier extension (invisible padding...)packet bursting

ETHERNET – MA – CSMA/CD – Ethernet GE