toulouse inp - enseeiht

82
Local area networks Katia Jaffr` es-Runser and Gentian Jakllari {kjr,jakllari}-at-n7.fr Toulouse INP - ENSEEIHT epartement Sciences du Num´ erique 1` ere ann` ee ENSEEIHT INP T O U L O U S E 1SN - Local area networks 1

Upload: others

Post on 20-Oct-2021

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Toulouse INP - ENSEEIHT

Local area networks

Katia Jaffres-Runser and Gentian Jakllari{kjr,jakllari}-at-n7.fr

Toulouse INP - ENSEEIHT

Departement Sciences du Numerique1ere annee

ENSEEIHTINPT O U L O U S E

1SN - Local area networks 1

Page 2: Toulouse INP - ENSEEIHT

Lecture 1: Introduction to local area networks

Central question for this class :

How to create a network for devices that arerelatively close to each other – a local network ?

1SN - Local area networks 2

Page 3: Toulouse INP - ENSEEIHT

Local area networks

NOT a dedicated wire per communicationIt doesn’t scale: for N devices, we need N(N − 1)/2 wires.

1

1source: https://cedarandthistle.files.wordpress.com/2013/09/messy_cables.jpg

1SN - Local area networks 3

Page 4: Toulouse INP - ENSEEIHT

Local area networks

Share the wire !All devices have to share the same wire.

I In this case, the communication is by nature ***in broadcast***mode

Each transmitted bit is received by all other nodes on the channel

1SN - Local area networks 4

Page 5: Toulouse INP - ENSEEIHT

Shared access networks

What happens if a device sends its message whenever needed?

Different situations may occur:

I No one else is transmitting data for the complete transmissionduration.→ The message is received properly by the destination ,.

I Another device transmits a message during the transmission→ The messages are superimposed (destructively) and can’t beunderstood:

there is a collision /!

1SN - Local area networks 5

Page 6: Toulouse INP - ENSEEIHT

Shared access networks

What happens if a device sends its message whenever needed?Different situations may occur:

I No one else is transmitting data for the complete transmissionduration.→ The message is received properly by the destination ,.

I Another device transmits a message during the transmission→ The messages are superimposed (destructively) and can’t beunderstood:

there is a collision /!

1SN - Local area networks 6

Page 7: Toulouse INP - ENSEEIHT

Shared access networks

What happens if a device sends its message whenever needed?Different situations may occur:

I No one else is transmitting data for the complete transmissionduration.→ The message is received properly by the destination ,.

I Another device transmits a message during the transmission→ The messages are superimposed (destructively) and can’t beunderstood:

there is a collision /!

1SN - Local area networks 7

Page 8: Toulouse INP - ENSEEIHT

Shared access networks

CollisionsHave of course to be mitigated. But how?

Using a Medium Access Control protocola.k.a. MAC protocol.These are rules enforced so as to:

I Avoid collisions or re-transmit data if a collision occurs,

I Offer each node a fair access to the channel.Each device on the network gets a fair share of channel bandwidthon average.

BandwidthThe amount of data that can be passed along a communication channelin a given period of time.

1SN - Local area networks 8

Page 9: Toulouse INP - ENSEEIHT

Shared access networks

CollisionsHave of course to be mitigated. But how?

Using a Medium Access Control protocola.k.a. MAC protocol.These are rules enforced so as to:

I Avoid collisions or re-transmit data if a collision occurs,

I Offer each node a fair access to the channel.Each device on the network gets a fair share of channel bandwidthon average.

BandwidthThe amount of data that can be passed along a communication channelin a given period of time.

1SN - Local area networks 9

Page 10: Toulouse INP - ENSEEIHT

Shared access networks

CollisionsHave of course to be mitigated. But how?

Using a Medium Access Control protocola.k.a. MAC protocol.These are rules enforced so as to:

I Avoid collisions or re-transmit data if a collision occurs,

I Offer each node a fair access to the channel.Each device on the network gets a fair share of channel bandwidthon average.

BandwidthThe amount of data that can be passed along a communication channelin a given period of time.

1SN - Local area networks 10

Page 11: Toulouse INP - ENSEEIHT

MAC protocol and channel access method

MAC protocolDecides when each device can transmit its messages on the sharedchannel (or who speaks next).There are numerous MAC protocols available:

I For wired networks:Ethernet, switched Ethernet, HDLC, Token Ring, Token Bus, CAN,AFDX, FDDI, etc...

I For wireless networks:WiFi, Bluetooth, ZigBee, WiMax, GSM, LTE, etc...

1SN - Local area networks 11

Page 12: Toulouse INP - ENSEEIHT

MAC protocol and channel access method

Channel access methodsMAC protocols follow different approaches for sharing the channel.Each type is called a channel access method.

1SN - Local area networks 12

Page 13: Toulouse INP - ENSEEIHT

Channel access methods

Random AccessI Stations contend with each other without any centralized

coordinationI Collisions are the norm

I A specific algorithm for resolving contention/reducing collisions oncethey happenI resolve collisions : detect a collision and do something to fix itI reduce collisions : reduce the odds for a collision to happen

1SN - Local area networks 13

Page 14: Toulouse INP - ENSEEIHT

Channel access methods

Deterministic AccessI There is no contention – stations agree in advance

I There are no collisions

I Different ways to agreeing, resulting in different MAC protocols :I Centralized : a unique entity decides on resource allocationI Distributed : nodes agree by exchanging messages

1SN - Local area networks 14

Page 15: Toulouse INP - ENSEEIHT

Channel access methods

Deterministic AccessI Different ways to executing the agreement

I Circuit-like: TDMA, FDMA, ...I Packet based: Polling, Token passing

I Remember from telephony:

Either we share time (TDMA), frequencies (FDMA), time-frequencyblocks (FTDMA), orthogonal codes (CDMA), or space (SDMA).

1SN - Local area networks 15

Page 16: Toulouse INP - ENSEEIHT

This course

This course introduces

*** the main channel access methods ***

and illustrates them with

*** state-of-the-art MAC protocols.***

1SN - Local area networks 16

Page 17: Toulouse INP - ENSEEIHT

Outline for the rest of this class

Lecture 1: Introduction to local area networks

Part 1: Random channel accessLecture 2: Random channel accessLecture 3: Ethernet and switched EthernetLecture 4: WiFi - Distributed Coordination Function (DCF)

Part 2: Deterministic channel accessLecture 5: WiFi (PCF)Lecture 6: Token Ring

1SN - Local area networks 17

Page 18: Toulouse INP - ENSEEIHT

Lecture 2: Random channel access.

ALOHACarrier Sense Multiple Access

1SN - Local area networks 18

Page 19: Toulouse INP - ENSEEIHT

ALOHA networks

ALOHA: The origin of random access2

I Developed in the late 60’s by Norman Abramson et al to allow the 7campuses of the Univ. of Hawai’i, located on 4 different islands, toshare computer resources on the main campus

I The first user terminals went into operation in June 1971I The communication protocol was implemented by a special-purpose

piece of equipment – the terminal control unit (TCU)I Compare it to a wifi card...

I A user terminal was attached to the TCU

2N. Abramson, ”The AlohaNet - surfing for wireless data [History of Communications],” in IEEE Communications Magazine, vol.

47, no. 12, pp. 21-25, Dec. 2009.

1SN - Local area networks 19

Page 20: Toulouse INP - ENSEEIHT

ALOHA networks

ALOHA networksI Key decision: Use the direct form of transmitting user information

in a single high-speed packet burst in a shared wireless channelI Driven by the need for a simple design; throughput computed several

weeks after the decisionI Cost of memory for a packet buffer of 88 bytes was about $300

I Channel access philosophy : let collisions happen, detect when theyoccur and then try again.I Any station can send data at any timeI If, while transmitting, any data is received concurrently, then there is

a collision – will need to try again.

How to try again ?Re-send data after a random duration called the Backoff period

I Avoids repeated collisions.

I The way this random choice is made influences the overallperformance.

1SN - Local area networks 20

Page 21: Toulouse INP - ENSEEIHT

ALOHA networks

ALOHA networksI Key decision: Use the direct form of transmitting user information

in a single high-speed packet burst in a shared wireless channelI Driven by the need for a simple design; throughput computed several

weeks after the decisionI Cost of memory for a packet buffer of 88 bytes was about $300

I Channel access philosophy : let collisions happen, detect when theyoccur and then try again.I Any station can send data at any timeI If, while transmitting, any data is received concurrently, then there is

a collision – will need to try again.

How to try again ?Re-send data after a random duration called the Backoff period

I Avoids repeated collisions.

I The way this random choice is made influences the overallperformance.

1SN - Local area networks 21

Page 22: Toulouse INP - ENSEEIHT

ALOHA networks

Vulnerability periodThe message transmitted at time t experiences a collision if any othermessage overlaps partially with its transmission.

Success

T

timet t+Tt−T

Vulnerability period 2T

Sender C

Sender B

Sender A

Fail

If all messages have equal length T , then the vulnerability period is ofsize 2T .

1SN - Local area networks 22

Page 23: Toulouse INP - ENSEEIHT

ALOHA networks

Throughput achieved by ALOHAIt can be derived as follow:

I Suppose that the number of transmission attempts per frameduration T follows a Poisson distribution of mean G .Thus the probability of having k attempts during T is: G ke−G

k!

I The probability of having no collision for the vulnerability period of2T is given by e−2G

I Thus, the throughput is the number G of attempts during T thatdon’t experience any collision :

D = G · e−2G

1SN - Local area networks 23

Page 24: Toulouse INP - ENSEEIHT

Throughput for ALOHA

Maximum throughout is obtained for a load G = 0.5, that isD = 0.5/e ' 0.184.I Very low! Only 18% of frames don’t collide at best.

1SN - Local area networks 24

Page 25: Toulouse INP - ENSEEIHT

Slotted ALOHA

Increase the efficiency of ALOHAIdea: reduce the vulnerability period duration by synchronizingtransmissions

Clock node

Success

Fail

Sender A

Sender C

Sender B

Slot

Vulnerability period T

I All nodes are synchronized on a given slot duration of size T

I A transmission can only start at slot begin.→ vulnerability period is reduced to T .

1SN - Local area networks 25

Page 26: Toulouse INP - ENSEEIHT

Slotted ALOHA

Efficiency of slotted ALOHAAs vulnerability period is reduced to T , the throughput increases to:

D = G · e−G

with e−G the odds of experiencing 0 attempts during T for load G .

The number of transmissions Eto get a message through increases exponentially with G :

E =k=∞∑k=1

kPk = eG

with Pk the probability to transmit a message after k attempts given byPk = e−G (1− e−G )k−1.

1SN - Local area networks 26

Page 27: Toulouse INP - ENSEEIHT

Slotted ALOHA vs pure ALOHA

Here, peak utilization is of 1/e, ' 36.8% if one attempt per slot is madein average.

1SN - Local area networks 27

Page 28: Toulouse INP - ENSEEIHT

Towards better random access

Become a bit more polite

I Listen before speaking,

I If someone speaks, defer transmission to a later date.

Carrier senseThe node has to sense the channel to detect an ongoing transmission.

May collisions still happen then ?

1SN - Local area networks 28

Page 29: Toulouse INP - ENSEEIHT

Towards better random access

Become a bit more polite

I Listen before speaking,

I If someone speaks, defer transmission to a later date.

Carrier senseThe node has to sense the channel to detect an ongoing transmission.

May collisions still happen then ?

1SN - Local area networks 29

Page 30: Toulouse INP - ENSEEIHT

Towards better random access

Become a bit more polite

I Listen before speaking,

I If someone speaks, defer transmission to a later date.

Carrier senseThe node has to sense the channel to detect an ongoing transmission.

May collisions still happen then ?

1SN - Local area networks 30

Page 31: Toulouse INP - ENSEEIHT

Carrier Sense Multiple Access

CSMAA.k.a. Carrier Sense Multiple Access is a family of protocols where anode wanting to transmit a message :

I Senses the channelI If the channel is busy, then she defers transmissionI If the channel is idle, then she transmits

Whenever a node starts transmitting, it sends the complete message.

1SN - Local area networks 31

Page 32: Toulouse INP - ENSEEIHT

Carrier Sense Multiple Access

Can collisions still happen?CSMA is very sensitive to propagation delay.

B

A

A Btp = 5ms

0

4 ms

Collision at time 5

Collision at time 9

During 5ms the channel is seen as free for other nodes.Node A can only see the collision after 2.tp (round-trip duration).

1SN - Local area networks 32

Page 33: Toulouse INP - ENSEEIHT

Carrier Sense Multiple Access

Vulnerability periodIn CSMA, the vulnerability period is the duration for the 1st bit to traveluntil the end of line and back, i.e.

T = 2tp

A detects collision

BA

BA

B

B at end of line

Message almost

But B starts − collision !

at B at time t_p

A starts

at time 0

at time tp

at time T=2tp

A

1SN - Local area networks 33

Page 34: Toulouse INP - ENSEEIHT

Carrier Sense Multiple Access

Several variants of CSMA exist:

I 1-persistent CSMA

I non-persistent CSMA

I p-persistent CSMA

I CSMA/CD (collision detection)

I CSMA/CA (collision avoidance)

I CSMA/CR (collision resolution)

1SN - Local area networks 34

Page 35: Toulouse INP - ENSEEIHT

1-persistent CSMA

Algorithm for a ready-to-transmit node

I Sense the channelI If the channel is busy, then wait for end of ongoing transmissionI If the channel is idle, then transmit immediately (with probability 1).

→ persistently listens while transmittingto detect idle state as soon as possible.

1SN - Local area networks 35

Page 36: Toulouse INP - ENSEEIHT

1-persistent CSMA

Issue with 1-persistent CSMA

B

A

A B

0

4 ms

tp = 0msC

C

wait for idle

wait for idleCollision :−(

Peak throughput is a bit better than for slotted ALOHA: ' 52.9%

1SN - Local area networks 36

Page 37: Toulouse INP - ENSEEIHT

Non-persistent CSMA

Algorithm for a ready-to-transmit nodeHere, the sender doesn’t actively listen to detect the end of an ongoingtransmission.

I Sense the channelI If the channel is busy, then wait a random time and sense channel

againI If the channel is idle, then transmit immediately

→ No persistent listening during transmission

1SN - Local area networks 37

Page 38: Toulouse INP - ENSEEIHT

Non-persistent CSMA

Example

B

A

A B

0

tp = 0msC

C

wait for 7ms

wait 3ms 7ms

5ms

3ms

Collisions are less likely to occur here, but time may be lost after the endof the ongoing transmission.Peak throughput is a much better: ' 81.5%.

1SN - Local area networks 38

Page 39: Toulouse INP - ENSEEIHT

p-persistent CSMA

Algorithm for a ready nodeA compromise between 1-persistent CSMA and non-persistent CSMA.Assume channels are slotted (but not globally synchronized).A slot is long enough to detect for sure a collision (i.e. of durationT = 2tp).

1. Sense the channelI If the channel is idle, then transmit with probability p

I If message not transmitted, then wait for one slot and go to step 1.

I If the channel is busy, then wait until channel becomes idle and go tostep 1.

1SN - Local area networks 39

Page 40: Toulouse INP - ENSEEIHT

p-persistent CSMA

Performance

I Collisions are reduced, the peak throughput increases:

For p = 0.1, S ' 79.1%For p = 0.03, S ' 82.7%

I But with lower p, the longer it takes to actually send a message.For given p, it takes

E [k] =∞∑k=1

kp(1− p)k = 1/p

slots to send a message if channel is constantly idle.

1SN - Local area networks 40

Page 41: Toulouse INP - ENSEEIHT

Non-persistent vs. persistent

Non-persistent

Yes

Sense channel

Busy?

Send message

No

Wait ...

p-persistent

No

Sense channel

Busy?

Send?

wait

1 slot

No

Yes

Send message with

probability p

Yes

1SN - Local area networks 41

Page 42: Toulouse INP - ENSEEIHT

Performance of CSMA

Superiority of p-persistent/non-persistent over 1-persistent in terms of S.

a = propagation delay / transmission delay.

1SN - Local area networks 42

Page 43: Toulouse INP - ENSEEIHT

Performance of CSMA3

But delay to transmit a message successfully increases exponentially withthroughput S for non-persistent and p-persistent schemes.

3L. Kleinrock and F. Tobagi, ”Packet Switching in Radio Channels: Part I - Carrier Sense Multiple-Access Modes and Their

Throughput-Delay Characteristics,” in IEEE Transactions on Communications, vol. 23, no. 12, pp. 1400-1416, December 1975.1SN - Local area networks 43

Page 44: Toulouse INP - ENSEEIHT

Advanced CSMA protocols

CSMA/CDA 1-persistent CSMA with an advanced collisions detection (CD)mechanism.

I 1-persistent CSMA: low peak throughput S but fast channel accessin average.

I Improve throughput with CD thanks toI Detection of collision at senderI Stop transmission if collision is detectedI Random back-off duration before new transmission attempt.

Will be detailed in Ethernet lecture.

1SN - Local area networks 44

Page 45: Toulouse INP - ENSEEIHT

Advanced CSMA protocols

CSMA/CAA p-persistent CSMA with an advanced collisions avoidance (CA)mechanism made for wireless systems.

I p-persistent CSMA: larger peak throughput S but slower channelaccess time in average.

I Reduce channel access time with CA operations:I Detection of collision at receiverI Acknowledgement message to notify senderI Random back-off duration before new transmission attempt, with

back-off freeze.

Will be detailed in WiFi lecture.

1SN - Local area networks 45

Page 46: Toulouse INP - ENSEEIHT

Advanced CSMA protocols

CSMA/CR for priority-based channel accessA CSMA where the contention resolution procedure elects the highestpriority message.

I Each message gets a unique identifier (ID) representative of itspriority. The lower the ID, the higher the priority.I If two messages of different IDs are sent concurrently, the one with

the lowest ID wins channel access.I The sender of the lower priority message defers transmission until

channel gets idle again.

Runs on any car you’re driving...

1SN - Local area networks 46

Page 47: Toulouse INP - ENSEEIHT

Advanced CSMA protocols

CSMA/CR for priority-based channel accessHow does it work ?

I All senders are synchronized at bit-level.

I A bit can either be recessive or dominant.Dominant bit wins over recessive bit.

I Logical values

I Recessive → bit value 1I Dominant → bit value 0

1SN - Local area networks 47

Page 48: Toulouse INP - ENSEEIHT

CSMA/CR

Bit-level contention resolutionFor each transmitted bit, sender checks whether it stayed unchanged.

4. Reception of same bit

E1

1. Emission of one bit

2. Propagation

3. Reflexion

If bit unchanged, then sender keeps sending, else it stops.

instead of bit 1

E1

E2

3. Reflexion

1

1. Emission of one recessive bit

2. E2 sends a dominant bit

4. E1 hears 0 0

0 3. Channel adds both signals 0 AND 1 = 0

E2 keeps sending and E1 stops.

1SN - Local area networks 48

Page 49: Toulouse INP - ENSEEIHT

CSMA/CR

Priority with contention resolutionEach node sends its ID (i.e. priority) in the header of the message, withbig-endian encoding (most significant bit first).

Frame ID 1 wins − continues its emission

tFrame ID 10

Frame ID 3

Frame ID 1[0 0 0 1]

[0 0 1 1]

[1 0 1 0]

1000

Stops − Lost contention

Stops − Lost contention

Highest priority message never waits. Others wait for higher prioritymessages to be transmitted first.Throughput is limited by the maximum length of the wire.

1SN - Local area networks 49

Page 50: Toulouse INP - ENSEEIHT

Lecture 3: Ethernet

Ethernet and Switched Ethernet

1SN - Local area networks 50

Page 51: Toulouse INP - ENSEEIHT

Ether4+net

History

I Developed by Bob Metcalfe and others at Xerox PARC in mid-1970s

4In the 19th century, luminiferous aether or ether, was the postulated medium forthe propagation of light

1SN - Local area networks 51

Page 52: Toulouse INP - ENSEEIHT

Ethernet

History

I Rooted in Aloha packet radio network

I Introduced in 1973, first products in 1980, became an IEEE standardin 1983

I Originally 2.94 Mbps, the latest reaches 100 Gbps

I Standardized, open to multiple vendors, became quickly fast andcheap

I CSMA/CD: Ethernet’s medium access control (MAC) policyI CS = Carrier Sensing

Send only if medium is idleI MA = Multiple AccessI CD = Collision Detection

Stop sending immediately if collision is detected

1SN - Local area networks 52

Page 53: Toulouse INP - ENSEEIHT

IEEE LAN Standards

I The goal of the standardization is to create vendor-neutral solutionsI In part in response to IBM’s dominance in the 70’s

I IEEE LAN standards define the MAC and physical layers

I IEEE 802.3 CSMA/CD - Ethernet standard, 10 Mbps (originally2Mbps)

I IEEE 802.3u standard for 100Mbps Ethernet

I IEEE 802.3z standard for 1Gbps Ethernet

1SN - Local area networks 53

Page 54: Toulouse INP - ENSEEIHT

Ethernet technologies

10Base2

I “10” means 10Mbps; “2” means under 200 meters (actually 185m)

I Thin coaxial cable in a bus topology

I Repeaters used to connect different segments

I Repeater repeats bits it hears on one interface to its other interfaceA physical layer device only!

1SN - Local area networks 54

Page 55: Toulouse INP - ENSEEIHT

Ethernet technologies

10BaseT / 100BaseT

I “10”for 10Mbps (“100” for 100Mbps); “T” for Twisted pair

I Hub(s) connected by twisted pair facilitate star topologyI Distance of any node to the hub must be < 100 metersI Hub repeats the bits it hears on one interface on all other interfaces

Physical layer device as well !

Backbone Hub

Hub

Hub

Hub

1SN - Local area networks 55

Page 56: Toulouse INP - ENSEEIHT

Ethernet

OverviewMost popular packet-switched LAN technology

I Maximum bus length : 2500 meters divided into 500 metersegments with 4 repeaters

I Bus and start topologies are possibleI Hosts attach to network via Ethernet transceiver or hub (or switch)

detects line state (idle/busy) and sends/receives signalsI Hubs are used to facilitate shared connections

I Network layer packets are transmitted over Ethernet afterencapsulation

I A broadcast protocol by natureI Any signal can be received by allI All hosts on Ethernet are competing for access to medium

Problem: Distributed algorithm that provides a fair access

1SN - Local area networks 56

Page 57: Toulouse INP - ENSEEIHT

Ethernet II / IEEE802.3 protocols

Frame formatThere are two MAC frame format versions: for Ethernet II (legacy DIXcommercial version) and for the IEEE802.3 standard.

DATA / LLC+DATAPreambleDest

Address

Src

Address

64 bits 48 bits 48bits 16 bits Up to 1500 bytes

CRC

32 bits

Type /

Length

I Preamble is a sequence of 7 bytes, each set to “10101010”Used to synchronize the receiver before actual data is sent anddelimit the start of a frame

I In Ethernet II: “Type” field is a demultiplexing key used to determinewhich higher layer protocol the frame should be delivered to.

I In the IEEE802.3 standard, this field holds the length of DATA inbytes. LLC header stores the equivalent of Type field then.

1SN - Local area networks 57

Page 58: Toulouse INP - ENSEEIHT

Addresses

I Globally unique, 48-bit unicast address assigned to each adapterExample: f8:1e:df:e4:9b:9bEach manufacturer gets their own address range

I Broadcast : all 1s

I Contrast with IP addresses ...

1SN - Local area networks 58

Page 59: Toulouse INP - ENSEEIHT

Medium Access Control (MAC) Protocol

CSMA/CD

I In ALOHA, decisions to transmit are made without paying attentionto what other nodes might be doing

I In CSMA/CD, the device listens to the line before (CSMA) andduring sending (CD)

I Perform 1-persistent CSMA:I If channel is idle, send message immediately.I If channel is busy, wait until idle and transmit packet after waiting a

short Inter-Frame space (IFS) of 9.6 µs.

I AND collision detection (CD) : while sending, detect collision.I If collision, stop sending and jam signal: → increases throughput

compared to 1-persistent CSMAI Try again later: Back-off mechanism

1SN - Local area networks 59

Page 60: Toulouse INP - ENSEEIHT

Medium Access Control (MAC) Protocol

CSMA/CD State Diagram

Yes

Carrier

Sense

Discard

Packet

Detect

Collision

Jam channel

b=Backoff()

wait(b)

attempts ++

No

Yes

attempts == 16

Packet?

SendIdle

attempts< 16

1SN - Local area networks 60

Page 61: Toulouse INP - ENSEEIHT

Medium Access Control (MAC) Protocol

Remember collisionsCollisions are caused when two stations transmit at the same time if:

I Both stations found line to be idle

I Both had been waiting for a busy line to become idle

How can we be sure that both stations will eventually know that therewas a collision?

1SN - Local area networks 61

Page 62: Toulouse INP - ENSEEIHT

Medium Access Control (MAC) Protocol

Vulnerability periodHow can station A know that a collision took place?

A detects collision

BA

BA

B

B at end of line

Message almost

But B starts − collision !

at B at time t_p

A starts

at time 0

at time tp

at time T=2tp

A

I A’s message collides with B’s message at time tpI B’s message reaches A at time 2tp.

1SN - Local area networks 62

Page 63: Toulouse INP - ENSEEIHT

Medium Access Control (MAC) Protocol

Ensure minimum message sizeSo, station A must still be transmitting (and thus listening) at time 2tpto detect a collision

I IEEE 802.3 specifies a max value of 2tp to be 51.2µs.I Relates to the maximum distance of 2500m between hostsI At 10Mbps it takes 0.1µs to transmit one bit, so 512 bits (64bytes)

take 51.2µs to sendI So Ethernet frames must be at least 64 bytes long

14 bytes of header, 46 bytes of data and 4 bytes of CRCI Padding is used if data less 46 bytes

I Send jamming signal after collision to insure all hosts see collisionI 48 bits signal

1SN - Local area networks 63

Page 64: Toulouse INP - ENSEEIHT

Truncated Exponential Backoff algorithm

Basic idea:

I If a collision is detected, each station waits until its slot of 51.2µs isfinished.

I Then it backs off for a random amount of time and tries again ifchannel is idle.

I Backoff Time = Random() x SlotTime (51.2µs)I First collision: choose Random() from {0,1}I Second collision: choose Random() from {0,1,2,3}I nth time: choose Random() from {0, . . . , 2n − 1}I Max value for Random()=1023 (i.e. n = 10) – Truncated !I Give up and drop packet after several tries (usually 16)

1SN - Local area networks 64

Page 65: Toulouse INP - ENSEEIHT

Ethernet MAC Protocol

MAC algorithm from the receiver side

I Sender handles all access control

I Receiver simply reads frames with acceptable address:I Address to hostI Broadcast addressI Address to multicast to which host belongs toI All frames if host is in promiscuous mode

1SN - Local area networks 65

Page 66: Toulouse INP - ENSEEIHT

Ethernet MAC Protocol

ExerciseTwo hosts A and B are connected to a 10Mbps Ethernet LAN.

I At t = 0, A sends a 520 byte frame.

I At t = 5× 10−6s, B sends a 64 byte frame.

The propagation delay from A to B is 9× 10−6s.

1. Show on a temporal diagram the time the collision is detected byeach host

2. Assume that the binary exponential backoff provides a backoff valueof ‘1’ to host A and a ‘0’ to host B.Give the sequence of frame exchanges on a temporal diagram.

1SN - Local area networks 66

Page 67: Toulouse INP - ENSEEIHT

Fast and Gigabit Ethernet

Fast Ethernet 100MbpsHas technology very similar to 10Mbps Ethernet

I Uses different PHY layer encoding

I Many NIC’s (Network Interface Controllers) are 10/100 capable

Gigabit Ethernet 1000Mbps

I Compatible with lower speeds

I Uses standard framing and CSMA/CD

I Distances are very limited

I Typically used for backbone and inter-router connectivity

1SN - Local area networks 67

Page 68: Toulouse INP - ENSEEIHT

Experiences with Ethernet

Ethernet works best under light loadsUtilization over 30 % is considered heavyNetwork capacity is wasted by collisions

I Most networks are limited to about 200 hostsSpecification allows for up to 1024

I Most networks are much shorters

I Transport layer flow control helps reduce load (number of back toback packets)

I Ethernet is fast, inexpensive and easy to administer

1SN - Local area networks 68

Page 69: Toulouse INP - ENSEEIHT

IEEE 802.3 MAC Parameters

1SN - Local area networks 69

Page 70: Toulouse INP - ENSEEIHT

Limitations of Ethernet

Ethernet Problems

I Pretty low peak utilization

I Peak throughput worst with:I More hosts

More collisions needed to identify single senderI Longer links

Collisions take longer to observe, more wasted bandwidthI Efficiency is improved by avoiding these conditions of course.

But we need larger networks, with more hosts ....

Legacy 802.3/Ethernet not used anymore !

1SN - Local area networks 70

Page 71: Toulouse INP - ENSEEIHT

LAN switching and bridges

Switched Ethernet

1SN - Local area networks 71

Page 72: Toulouse INP - ENSEEIHT

Interconnection devices

There are several types of devices to interconnect networks

Bridge / Switch

HubHub

X25 network

Router

Token Ring

Ethernet

IP

Gateway

1SN - Local area networks 72

Page 73: Toulouse INP - ENSEEIHT

Interconnection devices

Ethernet Hub

I Interconnects Ethernet segments

I PHY layer interconnection device:just copies the bits received on the output port

I Collisions are propagated - just extends the broadcast domain

Bridge / LAN switch

I Interconnects two or more LANs together

I DLC layer interconnection device:Interconnects identical or dissimilar networks

I Switch is often used in the context of Ethernet interconnection.

1SN - Local area networks 73

Page 74: Toulouse INP - ENSEEIHT

Interconnection devices

Routers

I NETwork layer interconnection device:Typically interconnects IP networks

I Decides on routes for packets by implementing the IP routingprotocol

Gateway

I A more generic term for routers

I NETwork layer device as well

I Often designates devices that interconnect different layer 3 protocols

1SN - Local area networks 74

Page 75: Toulouse INP - ENSEEIHT

Switched Ethernet

Legacy Ethernet suffers from low peak utilization because it has tohandle collisions on the shared medium

To improve Ethernet efficiency, current LANs use a ’Switched Ethernet’technology (legacy Ethernet is rarely used nowadays)

I It replaces the shared medium with a dedicated segment for eachstationi.e. 1 segment per station

I Segments connect to a switch, which connects many of thesesegments in a star topology

I Each segment is full duplex

No collisions anymore on a segment !→ up to 100% utilization per segment

1SN - Local area networks 75

Page 76: Toulouse INP - ENSEEIHT

Switched Ethernet

Architecture example

Z

Switch

Switch

Switch

Switch

Backbone

E

A X

1SN - Local area networks 76

Page 77: Toulouse INP - ENSEEIHT

Switched Ethernet

Ethernet switch

I Looks similar to a hub but no shared medium

I Processes and sends data in a more sophisticated way than a hub

I The switch reads the destination address of the packet and sendsthe packet only to the port the destination is reachable at(NO broadcast as for a hub)

I Thus, for each output port, there is a buffer that stores packetswaiting for service.

Switches can support today hundreds of dedicated segments

Very scalable !

1SN - Local area networks 77

Page 78: Toulouse INP - ENSEEIHT

Switched Ethernet

Ethernet switchEach port is isolated and builds its own collision domain

B

CSMA/CD

CSMA/CD

CSMA/CD

CSMA/CD

Full duplex Full duplex

Full duplex Full duplex

CSMA/CD

CSMA/CD

CSMA/CD

CSMA/CD

Full duplex Full duplex

C

D

C

D

C

D

Full duplex Full duplex

C

D

HUB

Hig

hspeed B

ackbo

ne

SWITCH

Input buffers Output buffers

AA AA

B BB

1SN - Local area networks 78

Page 79: Toulouse INP - ENSEEIHT

Switched Ethernet

Ethernet switchOverall design goal: Complete Transparency

“Plug and play”

Should be self-configuring, without hardware or software changesShould not impact operation of existing LANs

Main parts for understanding bridges:

1. Forwarding of Frames

2. Learning of Addresses

1SN - Local area networks 79

Page 80: Toulouse INP - ENSEEIHT

Switched Ethernet

(1) Forwarding of framesA switch relies on a MAC forwarding table (or switching table)

I It stores entries of the form:

{ MAC address - output port - age}

MAC address: host name or group addressport: outgoing port number of bridgeage: age timing of entry (in seconds)

I As a packet comes in the switch, it reads the destination addressand looks in the table for its output port.

I If no entry exists in the table?I It floods the packet on all output ports (except its incoming port).

1SN - Local area networks 80

Page 81: Toulouse INP - ENSEEIHT

Switched Ethernet

(2) Learning of MAC addressesForwarding tables are set automatically with a simple heuristic:

I The source field of frames that arrive on a port tells which hosts arereachable from this port

I Learning algorithmI For each frame received, the source stores the source field in the

forwarding database together with the port where the frame wasreceived

I All entries are deleted after some time (default is ∼15s)

1SN - Local area networks 81

Page 82: Toulouse INP - ENSEEIHT

1SN - Local area networks 82