Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja....

95
Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja

Transcript of Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja....

Page 1: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Medium Access Control Protocols

Ch. 6Leon-Garcia & Widjaja

Page 2: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Multiple Access Communications

● Shared Multiple Access Medium– Air for wi-fi

– Ether for ethernet

● Separate channels (channelization)– Collision free

– Static sharing

● Dynamic sharing (MAC)– Collisions possible

– Flexible sharing

Page 3: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Channelization Schemes

● Good for steady streams of data● The channels could be based on frequency or

scheduling● Old style radio and TV had channels● Satellites have channels● Most cell-phone protocols involve

channelization

Page 4: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

MAC Schemes● Various techniques to avoid or handle

collisions● Multidrop lines

– Old style terminals connected to a mainframe computer

– Sensor networks on robotics/automotive/automation networks

– Use polling

● Ring networks– Ring adapters connected with point-2-point lines

– Each adapter monitors traffic.

Page 5: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

MAC Schemes

● Shared buses (ethernet)● Frames are injected into the bus● Collisions can happen● Need methods to detect and handle collisions● These range from “do nothing” to exact

scheduling

Page 6: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

MAC Schemes

● Wi-Fi● Shared wireless medium● Great variety of services● Need to optimize the use of the resource● Satisfy very different needs (QoS)

Page 7: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

● Two stations sharing a medium● Each station monitors the medium● If all is quiet and needs to send it, sends● If not quiet, waits● If while transmitting it detects a collision it

aborts and retries● Needs a “backoff” algorithm

Page 8: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

BA

BA

BA

t = 2 t pro

t = 0

Page 9: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

● If B starts transmission between time -t_prop and t_prop, there will be a collision

● Station A will detect this sometime between time 0 and 2*t_prop

● They should decide who goes first– If we know t_prop, the one that started first

● The winning station should stay quiet for 2*t_prop after sending its message

Page 10: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

LX = L/RL /R + 2 t pro

2 t pro Time to coordinate access

Number of bits in a frame

Time to transmit L bits

Total time to get L bits across(first bit leaves sender to last bitArrive at receiver)

Page 11: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

a=t proR

L=t prottra

=1

1+2 t pro R

L

=1

1+2a

ρmax =

LR

LR

+2 t pro

=L

(LR

+2 t pro )R

Page 12: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

A Simple Protocol

● Parameter “a” is the normalized “delay-bandwidth” product

● When “a” is very small efficiency is high● Parameter “a” is small for small distances and

low transmission rates– Efficient for small area fast networks (LAN)

– Large slow networks

● CSMA-CD (Carrier Sensing Multiple Access – Collision Detection) has similar efficiency (but 6.44 instead of 2)

Page 13: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Selecting a Protocol

● Efficiency● Frame Transfer Delay

– Time between first bit getting to the source until last bit arrives at destination

● Fairness (compliance to priorities policy)● QoS (streaming vs. bursty traffic)● Scalability● Cost

Page 14: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Transfer Delay

● Every MAC protocol has a maximum efficiency● As the load (normalized throughput)

approaches the max efficiency the delay increases (due to waiting, collisions and retransmissions)

● At max. utilization delay goes to infinity● If “a” is small max efficiency is close to 1

Page 15: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Transfer Delaya<a '

a '

ρ ' max

a

ρmax

Page 16: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Random Access

● Two main classes of MAC protocols– Random

– Scheduling

● Random is not as bad an idea as it sounds– Simple

– No (or few) scheduling decisions to take

– We can proceed without wasting time for collision detection

Page 17: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

● Obviously from Hawaii● Frames were transmitted by radio● Sometimes frames collide● These will be detected as errors and ARQ will

take care of them● Under light traffic retransmissions and delay

will be low

Page 18: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

● Analysis is a bit different as transmission errors affect one communication pair while collisions affect two

● Backoff algorithm for ALOHA is simple: random wait for retransmission

● If no ACK received, we backoff and re-transmit

Page 19: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

● ALOHA has two modes● Low traffic

– Collisions are few and have little effect

● High traffic– Most traffic is retransmissions due to collisions

– Every frame is attempted several times before it succeeds

Page 20: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

SGX = L/Rt 0−X… t0+X

L Bits per frame

Frames transmitted per X seconds

Frames transmitted incl.Retransmissions per X sec

Time to transmit a frame

Vulnerable period

Page 21: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

S =G P0

G = S (1+P≥1+P≥12

+...)

G = S1P0

G = S +S P≥1+S P≥12 + ...

G = S1

1−P≥1

Page 22: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

ALOHA

Pk =( 2G )k

k !e−2G

S =G P0

S=G(2G )0

0!e−2G

=Ge−2G

Page 23: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Maximum Throughput

e−2G= 2Ge−2G

⇒G =12

S =G e−2G

∂ S∂G

= e−2G−2Ge−2G

= 0

Page 24: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency

● The throughput is maximal when the number of packages (including retransmissions) is 50% of the capacity

● This means that just 18.4% of the channel capacity is useful traffic

● And this is independent of delay-bandwidth product!

Page 25: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Slotted ALOHA

● Can we do better?● If we require packets to start transmission at

the beginning of pre-arranged time slots the vulnerability interval is halved

● We get a step closer to TDMA

Page 26: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency of Slotted ALOHA

∂ S∂G

= e−G−G e−G = 0

G=1

S =G e−G

Page 27: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

The Verdict

● ALOHA is not that bad● Low efficiency is sometimes compensated by

simplicity:– No need to know any system parameter

– Very simple to implement

– Does not depend on the normalized bandwidth-delay product: it is good for small packages

Page 28: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Carrier Sense Multiple Access

● What did a CSMA tomato say to an ALOHA tomato that crossed the road?

● Moral of the story: look before you cross● Sense the carrier and if it is quiet transmit● Within t_pro everybody knows that we are

transmitting● Collisions are still possible

Page 29: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

1-Persistent CSMA

● If channel quiet transmit● If busy wait until quiet● Problem?● While transmitting, packets will queue up● At the end of the transmission all of them will

attempt

Page 30: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Non-Persistent CSMA

● If busy use the backoff algorithm to determine when to sense again

● Fewer collisions than 1-Persistent● Has slightly longer delays than 1-Persistent in

low traffic

Page 31: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

P-Persistent CSMA

● Sense the channel. If busy keep sensing● When/if idle use a random number generator

to decide what to do● With probability p transmit● With probability 1-p wait t_pro time and select

a random number again

Page 32: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CSMA-CD

● Like the previous CSMA-CD we can find within 2*t_pro if we have a collision

● If a collision is detected we send a jamming signal to notify all that there was a collision

● Use a backoff algorithm to decide when to try again

Page 33: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CSMA-CD

p

P suc= n p(1− p)n−1

n

P suc⩽ n1n (1−

1n )

n−1

= (1−1n )

n−1

→1e

p=1n

2 t pro Contention interval

Probability to transmit

Number of contenders

Value that maximizesProbability of success

Page 34: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency of CSMA-CD

a =t proX

Where:

Silence after transmission

ρmax =X

X +t pro+2e t pro=

11+(2e+1)a

Duration of contention interval

Page 35: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

The Verdict

● For low traffic or low “a”, efficiency is high● When “a” approaches 1 performance is worse

than ALOHA● Sayonara!● Seems we can use some collision detection!

Page 36: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Scheduling Approaches

● If efficiency is low we need to consider scheduling

● Between random and TDMA there are several intermediate approaches

● Reservation systems● Polling● Token rings

Page 37: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Reservation Systems

● Stations take turns transmitting at full rate● Each station gets a reserved slot if it needs to

transmit● Every cycle starts with a reservation interval● Simplest reservation interval has M 1-bit slots

– If a station wants to transmit it broadcasts “1” in its bit, o/w “0”

● Could also handle frame lengths with more reservation bits

Page 38: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency of Reservation Systems

u=tmsX

ρmax =X

X +M tms=

11+M u

X Time we transmit information

Efficiency if one station transmit

Fraction of the minislot time

ρmax =X

X +tms=

11+u

Efficiency if all stations transmit

Page 39: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Multi-slot Reservations

● A station might reserve more than one slot– A form of variable size slots

ρmax =1

1+u/ k

Avg number of slots

Page 40: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Many Stations Little Traffic

● Most of the transmission would be reservation traffic

● Use a random access technique for the reservation slot (ALOHA or slotted ALOHA)

● ALOHA has rather low efficiency– That's OK, it is just reservation info

– Allows us to have arbitrary/dynamic number of stations

Page 41: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Minislot Reservation with ALOHA

● Slotted ALOHA has low efficiency● We need to allocate time for more minislots● If we have allocated the right number of

minislots

ρmax =1

1+2.72uρALOHA=

12.72

Page 42: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Polling

● Another way to have orderly access to medium

● At every one instant one station only has the right to transmit

● Three main ways to manage the right to transmit

Page 43: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Right to Transmit

● Polling by a central controller over lines– One out-, one in-bound

– Polling in RR fashion

– HDLC was initially developed for this

● Over radio– Frequency division duplex

– Time division duplex

Page 44: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Masterless Polling

● Can be done without central controller● We have to establish a way to determine

polling order● All transmissions must be accessible by all● Token rings are of this nature

Page 45: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Polling Protocol

● Controller polls every station in turn● Stations may respond with a frame of “nothing to

declare” (or timeout)● Or if a station has something to transmit, transmits

it, o/w next station is polled● The time consumed in polling of a station is called

walk time● Total walk time is the sum of the walk times of all

stations in one cycle

Page 46: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Walk Time

● The components of the walk time are:– Propagation time

– Processing time

– Time to transmit the polling message

Page 47: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Avg Cycle Time

N̄ c

N̄ c X + tw

T̄ c = M ( N̄ c X +tw)= M ( λMT̄ c X + tw)

λ

ρ=λ X

M

: total arrival rateλM

: number of stations

T̄ c

N̄ c =λMT̄ c : avg number of messages in one cycle

: avg cycle time

T̄ c =M tw

1−λ X=M

tw1−ρ

: load (always less than one)ρ

: time spent at each station

Page 48: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency

ηT̄ c = M

tw1−ρ

η =T̄ c−M twT̄ c

=

Mtw

1−ρ−M tw

Mtw

1−ρ

= 1−M twM tw1−ρ

= ρ

: efficiency

Page 49: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Token Rings

● Successful distributed polling system● Every node has an interface connected with

two point-to-point lines to other interfaces in a ring

● Every interface listens, forwards, consumes, modifies, or copies incoming frames

● One of the frames is “the token”. Can be free or busy. Can be more than one

Page 50: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Token Rings

● When a free token arrives to an interface– If the node wants to transmit converts it to busy

token and transmits

● There are three ways to re-inject the free token in the ring– Immediately after the end of the transmission

(multitoken)

– Immediately after the busy token returns and the last bit of the frame transmitted (single token)

– Immediately after the last bit of the transmitted frame returns and is checked for errors (single frame)

Page 51: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency

ρmax=MX

M max (X , t ' )+t '=

1

max(1 , t ' / X )+t 'MX

ρmax=MX

M (X +t ')+ t '=

1

1+a ' (1+1M

)

Multitoken

Single token

ρmax=MX

MX + t '=

1

1+t 'MX

t ' = t+M bR

a '=t 'X

Single frame

Ring latency

Page 52: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Efficiency

ρmax =1

max(1 , t ' /X )+t 'MX

=1

max (1 , a ')+a 'M

ρmax =1

1+a ' (1+1M

)

Multitoken

Single token

ρmax=1

1+t 'MX

=1

1+a 'M

t ' = t+M bR

a '=t 'X

Single frame

Ring latency

Page 53: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Comparison (poll vs reserve)

● Token passing rings are extension of polling– Similar to TDMA, but dynamic

– Need to recover from errors

● Reservation systems are the most direct– But have to maintain gaps between transmissions

– Have to have a central node

● Polling systems are the most basic– Their overhead is the walk times

Page 54: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Comparison (random vs scheduled)

● Random methods are simple and efficient with light loads

● Random access make inefficient use of bandwidth at high loads

● The overhead of random methods is the cost of resolving conflicts (retransmissions)

● A key parameter is the normalized delay-bandwidth product (except ALOHA)

Page 55: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

FDMA

● Each channel is on different frequency band● In real life we need guard bands

– For first approximation neglect guard bands

● Each station uses the band all the time– Good for connection oriented systems

● If traffic is bursty could give a band to more than one stations and let them share it with a dynamic scheme– The cost is collisions

Page 56: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

FDMA

● Good for steady stream, connection oriented traffic– E.g. cellular telephony

● Cost of guard bands– We cannot split the bandwidth very thinly

Page 57: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

TDMA

● Stations take turns making use of the full bandwidth

● Different stations have different propagation delays

● Need guard times to account for this● We also need preamples (e.g. to sync clocks

before transmission)● Also bad for bursty traffic

Page 58: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CDMA

● Code Division Multiple Access– Not separated in time (TDMA)

– Not separated in frequency (FDMA)

● CDMA uses the whole band all the time● The secret is in the code

Page 59: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CDMA● Zeros are represented by -1, ones by 1● Sender and receiver share a “code”

– The code is a pseudo random sequence of -1s and 1s

● Sender multiplies every bit of his signal by G bits from the code

● The transmitted signal is G times longer● G is the spreading factor● CDMA is a spread spectrum method

Page 60: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CDMA

c2 = 1,1,−1,1

w1 = 1,−1,1,−1, −1,1,−1,1, −1,1,−1,1, 1,−1,1,−1

s1 = 1,−1,−1,1

w1∗c2 = −2,2, 2,−2

c1 = 1,−1,1,−1

w1∗c1 = 4,−4,−4, 4

w1∗c1 = 1+1+1+1,−1−1−1−1,−1−1−1−1, 1+1+1+1

w1∗c2 = 1−1−1−1,−1+1+1+1,−1+1+1+1,1−1−1−1

Page 61: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

CDMA

● Near-far problem● Power control mechanisms● Long synchronized pseudo-random

sequences

Page 62: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

LAN Protocols

● LANs are– High speed

– Low cost

– Reliable

– Small area

● Need different approach than wide area networks

Page 63: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

LAN Protocols

● Developed by the IEEE 802● Examples include

– Ethernet (100BaseT4, 100BaseTX, 100BaseFX, 1000BaseT, etc). AKA IEEE 802.3

– WiFi IEEE 802.11

– FDDI IEEE 802.5

● Has evolved considerably since it was invented

Page 64: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

LAN Structure

● Bus, ring, star● Twisted pair, coaxial, fiber, airwaves● 6 byte globally unique MAC address for every

NIC– 3 bytes vendor OUI

– 3 bytes device

Page 65: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Layers of a LAN

Network Layer

802.2 Logical Link Control

802.3 802.5 Whatever

802.11

Various Physical Layers

Networklayer

Data LinkLayer

PhysicalLayer

IEEE 802 OSI

Page 66: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Ethernet

● First developed by Robert Metcalfe in the 70's● DIX in the 80's● 100BaseT 1995● 1000Base in 1998● 10G in 2002

Page 67: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

The Protocol

● Started as broadcast over a shared medium● CSMA-CD was the heart of the system● Uses 1-persistent mode● In two t_prop time it knows that it owns the

channel● With 10Mbps and 2500m distance, with 4

repeaters– t_prop = 2500/c+t_repeat = 51.2usec

– 64 bytes is the minimum frame size

Page 68: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Backoff Algorithm

● If there is a collision the backoff algorithm is activated– Truncated Binary Exponential Backoff

● For the kth attempt backoff delay is a random number between 0 … 2k

● After the 10th attempt exponent stays at 10● Tries 16 times before quitting● Takes about a second to fail

Page 69: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Physical Layers

● Thick, thin coaxial● UTP● CAT-3, CAT-5, CAT-5e, CAT-6● With switch to twisted pair we moved to star

topology● Initially hubs (single collision domain)● Switches: collision free (almost)● Full duplex: collision free

Page 70: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Delay on Ethernet

● On a shared ethernet we have– Idle times

– Transmission

– Collisions

● When load goes up– Efficiency goes up (up to a point)

– Collisions go up

– Delays go up (and up)

Page 71: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Fast Ethernet

● AKA 100BaseT● Framing, size and procedures unchanged● Hub is minimum (no bus)● 100BaseTX uses 2 pairs (one each direction)● Two modes:

– Single collision domain

– Buffered and switched (no CSMA-CD)

Page 72: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Gigabit Ethernet

● Severely limited CSMA-CD● Minimum frame 512 bytes● Mainly switched● Frame bursting● Needs at least cat-5e or cat-6● Most routers/bridges support it

Page 73: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Frame Structure

PreambleDestaddr

Sourceaddr

LengthOr

type

ORG=000

pad FCSSD

7x(0xAA)

Start Delim 0xAB

br-gl-46bit MAC

00-46bit MAC

0-0x05FF:length0x0600-0xFFFF: type

VLAN (opt)

LLC PDU

Padding for min-64

Frame Check Seq

Info

TypeXX InfoAA-AA-03

SNAP (subnet Access Proto)

-03: Type 1 LLCAA:DSAP-SSAP(dest. SAP, src SAP)

00:unicast-local

Page 74: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

LAN Bridges

● Repeater: interconnection at the physical layer● Bridge: interconnection at the MAC or data link

layer● Router: interconnection at the network or IP

layer● Gateway: (broad term) protocol conversion

(e.g. NAT)

Page 75: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Repeaters

● Rectify, amplify signals● Subject to max. distance limits● Mainly for range extension and increased

connectivity– Cannot reduce traffic

– Cannot provide security

Page 76: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Bridges

● Connect two segments● May inspect and modify the MAC and LLC

headers● Can limit traffic (by restricting traffic local to a

segment within the segment)● May provide low level security● Can forward (or block) {broad|multi}casting● Mostly copy and forward

Page 77: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Bridges

● There are two types: transparent and source routing

● Transparent:– Source unaware of the existence of the bridge

● Source routing:– The source has to specify the sequence of bridges

– The source has to explore the network and find the best routes

Page 78: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Bridge Learning

● Bridge has to discover who is connected to which network

● Without this information it has to broadcast everything– It is little more than a repeater

● Can learn without sending or receiving extra messages

Page 79: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Bridge Learning

M5

M4

M7

M8

M6

M2

M3

M1

12M711M1

7M713M19M7

1M1

2

1

3

9

4 5

11

12 13

6

7

8

M1->M7

Forwarding table

Page 80: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Spanning Tree

M5

M4

M7

M8

M6

M2

M3

RP:root port

2

1 3

100BaseT

10BaseT

1GBaseT

X RP

RP

M1

RB:root bridge

Page 81: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Source Routing Bridges

● Mainly for token rings● Source station determines optimal route● Uses routing table● If the table has an entry for the destination

uses it● If not, it initiates a route discovery procedure● Bridges just follow the instructions

Page 82: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Source Routing Bridges

● Route Discovery has two phases– Single-route broadcast by source

● Source station b/casts a route-less frame to destination● At every bridge in the spanning tree the two ports and

bridge id are added and frame is forwarded

– All-routes broadcast by destination● Destination b/casts a route-less frame to source● At every bridge the two ports and bridge id are added

and frame is forwarded, if this was the first time through

Page 83: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Mixed-Media Bridges● Bridges connecting two different LANs

– Ethernet and token-ring

● Bit string in MAC addresses are opposite

– Token rings: MSb first

– Ethernet: LSb first

● Frame size different

– Token rings: no limit

– Ethernet: 1500 bytes

● No copied bit in Ethernet

● Different transmission rates

Page 84: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Virtual LANs

● We may have one LAN but want to partition it virtually into two or more LANs

– To be served by distinct DHCPs, printers, wake-on-lan etc

● Can be done based on port

– No need for VLAN aware bridges

– Cannot put two stations from different VLAN on one port

● Can be done with VLAN tags

– VLAN tag is an optional field between source MAC and type/length

– Broadcasts to the wrong VLAN are ignored or blocked

Page 85: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

TCP/IP

● Overview of TCP/IP● IP packet structure

– NOTE● IP: packets● Ethernet: frames

Page 86: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

TCP/IP

ApplicationApplication

UDPTCP

IP ARP RARPICMP

Network Interface

Page 87: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

TCP/IP

HTTP request

HTTP request

HTTP request

HTTP request

TCPheader

TCPheader

TCPheader

IPheader

IPheader

FCSMAC

header

Page 88: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

TCP/IP

Internet

Networkinterface

Application

Transport

Internet

Networkinterface

Application

Transport

Internet

Networkinterface

Network-2Network-1

Page 89: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Packet Structure

Version IHL Type of Service Total Length

Identification Flags Fragment offset

Time to live Protocol Header checksum

Source address

Destination Addres

Options Padding

Page 90: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Packet Structure

● Version: IPv4, IPv6, etc● IHL: Internet Header Length (5 if no options)● Type of service: three bits for priority level,

four for requirement.● Total length: in bytes. Usually limited by the

length of the ethernet frame (1500)● Identification, flags, fragment offset: for

fragmentation and reassembly.

Page 91: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Packet Structure

● Time to Live: usually number of hops remaining. Decremented after each hop. If zero, discarded and error sent back.

● Protocol: next protocol up. TCP: 6, UDP: 17, ICMP: 1

● Header Checksum: verifies the header. The load is not verified. Recomputed after each TTL decrement.

Page 92: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Packet Structure

● Source and destination: the 32 bit IP address● Options: can be a multiple of 32 bits. Routing

information, reservation of resources, etc● Padding: to make options a multiple of 32 bits

Page 93: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Addressing

● Every node needs unique (or almost unique) IP address

● Two components– Network ID (globally assigned, 1-4 MSB bits is

class (0, 10, 110, 1110, 1111)

– Host ID (locally assigned, 8(C), 16(B), 24(A) bits)

● Normally written as four bytes (dotted notation)

Page 94: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

Subnetting

● Class specifies the network structure.● Too restrictive: class B: 65k hosts, class C:

256 hosts● Subnet masks allow arbitrary subnetting

– Make IP assignment easier

– Allow simple and easy local routing

● Sometimes specified with the slash notation (192.168.1.0/24)

Page 95: Medium Access Control Protocols · Medium Access Control Protocols Ch. 6 Leon-Garcia & Widjaja. Multiple Access Communications

IP Routing

● On a simple network it is easy:– If within the same network put it on the LAN and

ethernet will deliver it

– If it goes outside, send it to the gateway

● In general it is more complex● IP tables are used to route a packet