Medium Access Control (Mac) Layer: Computer Networks

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 102

COMPUTER NETWORKS

MEDIUM ACCESS CONTROL (MAC)


LAYER
Chapter 4: outline
4.1 Allocation problem for a broadcast channel
- Multiple access problem
4.2. Control access protocols
– ALOHA
– Slotted ALOHA
– CSMA (CA/CD)
– Collision-free
4.3. LAN technologies
– LAN MAC Address &ARP
– Ethernet
– Wi-Fi 802.11
– WiMax 802.16
– Bluetooth
– 4G LTE
– RFID
4.4. Data link layer switching
Multiple access links, protocols
two types of “links”:
• point-to-point (discussed in Chapter 2&3)
– PPP for dial-up access
– point-to-point link between Ethernet switch, host
• broadcast (shared wire or medium)
– old-fashioned Ethernet
– upstream HFC
– 802.11 wireless LAN

shared wire (e.g., shared RF shared RF humans at a


cabled Ethernet) (e.g., 802.11 WiFi) (satellite) cocktail party
(shared air, acoustical)

Link Layer and LANs 6-3


Multiple access protocols
• single shared broadcast channel
• two or more simultaneous transmissions by nodes: interference
– collision if node receives two or more signals at the same time

multiple access protocol


• distributed algorithm that determines how nodes share channel,
i.e., determine when node can transmit
• communication about channel sharing must use channel itself!
– no out-of-band channel for coordination

Link Layer and LANs 6-4


An ideal multiple access protocol
given: broadcast channel of rate R bps
desiderata:
1. when one node wants to transmit, it can send at rate R.
2. when M nodes want to transmit, each can send at average rate R/M
3. fully decentralized:
• no special node to coordinate transmissions
• no synchronization of clocks, slots
4. simple

Link Layer and LANs 6-5


MAC protocols: taxonomy
three broad classes:
• channel partitioning
– divide channel into smaller “pieces” (time slots, frequency, code)
– allocate piece to node for exclusive use
• random access
– channel not divided, allow collisions
– “recover” from collisions
• “taking turns”
– nodes take turns, but nodes with more to send can take longer
turns

Link Layer and LANs 6-6


Channel partitioning MAC protocols: TDMA
TDMA: time division multiple access
• access to channel in "rounds"
• each station gets fixed length slot (length = packet
transmission time) in each round
• unused slots go idle
• example: 6-station LAN, 1,3,4 have packets to send, slots
2,5,6 idle

6-slot 6-slot
frame frame
1 3 4 1 3 4

Link Layer and LANs 6-7


Channel partitioning MAC protocols: FDMA
FDMA: frequency division multiple access
• channel spectrum divided into frequency bands
• each station assigned fixed frequency band
• unused transmission time in frequency bands go idle
• example: 6-station LAN, 1,3,4 have packet to send, frequency
bands 2,5,6 idle
time
frequency bands

FDM cable

Link Layer and LANs 6-8


Chapter 4: outline
4.1 Allocation problem for a broadcast channel
- Multiple access problem
4.2. Control access protocols
– ALOHA
– Slotted ALOHA
– CSMA (CD/CA)
– Collision-free
4.3. LAN technologies
– LAN MAC Address & ARP
– Ethernet
– Wi-Fi 802.11
– WiMax 802.16
– Bluetooth
– 4G
– IoT
– RFID
Random access protocols
• when 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 collisions
– how to recover from collisions (e.g., via delayed retransmissions)
• examples of random access MAC protocols:
– ALOHA
– slotted ALOHA
– CSMA, CSMA/CD, CSMA/CA

Link Layer and LANs 6-10


Pure (unslotted) ALOHA
• unslotted Aloha: simpler, no synchronization
• when frame first arrives
– transmit immediately
• collision probability increases:
– frame sent at t0 collides with other frames sent in [t0-1,t0+1]

Link Layer and LANs 6-11


Pure ALOHA efficiency
P(success by given node) = P(node transmits) .
P(no other node transmits in [t0-1,t0] .
P(no other node transmits in [t0-1,t0]

= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)

… choosing optimum p and then letting n

= 1/(2e) = .18

even worse than slotted Aloha!

Link Layer and LANs 6-12


Slotted ALOHA

assumptions: operation:
• all frames same size • when node obtains fresh
frame, transmits in next slot
• time divided into equal size – if no collision: node can send
slots (time to transmit 1 new frame in next slot
frame) – if collision: node retransmits
frame in each subsequent slot
• nodes start to transmit only with prob. p until success
slot beginning
• nodes are synchronized
• if 2 or more nodes transmit
in slot, all nodes detect
collision

Link Layer and LANs 6-13


Slotted ALOHA
node 1 1 1 1 1

node 2 2 2 2

node 3 3 3 3

C E C S E C E S S

Pros: Cons:
• single active node can • collisions, wasting slots
continuously transmit at • idle slots
full rate of channel • nodes may be able to
• highly decentralized: only detect collision in less
than time to transmit
slots in nodes need to be packet
in sync
• clock synchronization
• simple
Link Layer and LANs 6-14
Slotted ALOHA: efficiency

efficiency: long-run • max efficiency: find p*


fraction of successful slots that maximizes
(many nodes, all with Np(1-p)N-1
many frames to send)
• for many nodes, take limit
• suppose: N nodes with of Np*(1-p*)N-1 as N goes
many frames to send, each to infinity, gives:
transmits in slot with max efficiency = 1/e = .37
probability p

!
at best: channel
• prob that given node has used for useful
success in a slot = p(1-p)N-1 transmissions 37%
• prob that any node has a of time!
success = Np(1-p)N-1
Link Layer and LANs 6-15
CSMA (carrier sense multiple access)

CSMA: listen before transmit:


if channel sensed idle: transmit entire frame
• if channel sensed busy, defer transmission

• human analogy: don’t interrupt others!

Link Layer and LANs 6-16


CSMA collisions
spatial layout of nodes

• collisions can still occur:


propagation delay means
two nodes may not hear
each other’s
transmission
• collision: entire packet
transmission time
wasted
– distance & propagation
delay play role in in
determining collision
probability

Link Layer and LANs 6-17


CSMA/CD (collision detection)

CSMA/CD: carrier sensing, deferral as in CSMA


– collisions detected within short time
– colliding transmissions aborted, reducing channel wastage
• collision detection:
– easy in wired LANs: measure signal strengths, compare transmitted,
received signals
– difficult in wireless LANs: received signal strength overwhelmed by
local transmission strength
• human analogy: the polite conversationalist

Link Layer and LANs 6-18


CSMA/CD (collision detection)
spatial layout of nodes

Link Layer and LANs 6-19


Ethernet CSMA/CD algorithm

1. NIC receives datagram from 4. If NIC detects another


network layer, creates frame transmission while
2. If NIC senses channel idle, transmitting, aborts and
starts frame transmission. If sends jam signal
NIC senses channel busy, 5. After aborting, NIC enters
waits until channel idle, binary (exponential) backoff:
– after mth collision, NIC chooses K
then transmits. at random from {0,1,2, …, 2m-1}.
3. If NIC transmits entire NIC waits K·512 bit times, returns
to Step 2
frame without detecting
– longer backoff interval with more
another transmission, NIC is collisions
done with frame !

Link Layer and LANs 6-20


CSMA/CD efficiency

• Tprop = max prop delay between 2 nodes in LAN


• ttrans = time to transmit max-size frame

1
efficiency 
1  5t prop /ttrans
• efficiency goes to 1
– as tprop goes to 0
– as ttrans goes to infinity
• better performance than ALOHA: and simple, cheap,
decentralized!

Link Layer and LANs 6-21


CSMA/CA
(CSMA with Collision Avoidance)
 A basic collision avoidance (CA) scheme
 CSMA/CA rule: Backoff before collision (to avoid collisions)

MS A’s frame MS B’s frame Time


Backoff -
delay for B Backoff -
delay for C
MSs B & C sense
the medium
MS B resenses the
medium and transmits its
frame
MS C resenses the medium
but defers to MS B

(Modified by LTL)
CSMA/CA
(CSMA with Collision Avoidance)

• When medium idle for a period ≥ DIFS => can xmit immediately
– DIFS = Distributed InterFrame Space
• In 802.11b networks, DIFS = 50 μs

->

DIFS

© 2006, Michael Hall, Helsinki Univ. of Technology (Modified by LTL)


“Taking turns” MAC protocols
channel partitioning MAC protocols:
 share channel efficiently and fairly at high load
 inefficient at low load: delay in channel access, 1/N bandwidth
allocated even if only 1 active node!
random access MAC protocols
 efficient at low load: single node can fully utilize channel
 high load: collision overhead
“taking turns” protocols
look for best of both worlds!

Link Layer and LANs 6-24


“Taking turns” MAC protocols

polling:
• master node “invites”
slave nodes to transmit data
poll
in turn
• typically used with master
data
“dumb” slave devices
• concerns:
– polling overhead
– latency slaves
– single point of failure
(master)

Link Layer and LANs 6-25


“Taking turns” MAC protocols
token passing:
T
 control token passed from
one node to next
sequentially.
 token message
(nothing
 concerns: to send)
 token overhead T
 latency
 single point of failure
(token)

data
Link Layer and LANs 6-26
Cable access network
Internet frames, TV channels, control transmitted
downstream at different frequencies

cable headend

CMTS

splitter cable
cable modem … modem
termination system

ISP upstream Internet frames, TV control, transmitted


upstream at different frequencies in time slots

 multiple 40Mbps downstream (broadcast) channels


 single CMTS transmits into channels
 multiple 30 Mbps upstream channels
 multiple access: all users contend for certain upstream
channel time slots (others assigned)
Link Layer and LANs 6-27
Cable access network
cable headend MAP frame for
Interval [t1, t2]

Downstream channel i
CMTS
Upstream channel j

t1 t2 Residences with cable modems

Minislots containing Assigned minislots containing cable modem


minislots request frames upstream data frames

DOCSIS: data over cable service interface spec


 FDM over upstream, downstream frequency channels
 TDM upstream: some slots assigned, some have contention
• downstream MAP frame: assigns upstream slots
• request for upstream slots (and data) transmitted random
access (binary backoff) in selected slots
Link Layer and LANs 6-28
Summary of MAC protocols
• channel partitioning, by time, frequency or code
– Time Division, Frequency Division
• random access (dynamic),
– ALOHA, S-ALOHA, CSMA, CSMA/CD
– carrier sensing: easy in some technologies (wire), hard in others
(wireless)
– CSMA/CD used in Ethernet
– CSMA/CA used in 802.11
• taking turns
– polling from central site, token passing
– Bluetooth, FDDI, token ring

Link Layer and LANs 6-29


Exercise
• Compare CSMA/CD vs CSMA/CA ?
Chapter 4: outline
4.1 Allocation problem for a broadcast channel
- Multiple access problem
4.2. Control access protocols
– ALOHA
– Slotted ALOHA
– CSMA (CD/CA)
– Collision-free
4.3. LAN technologies
– LAN MAC Address & ARP
– Ethernet
– Wi-Fi 802.11
– WiMax 802.16
– Bluetooth
– 4G
– IoT
– RFID
MAC addresses and ARP
• 32-bit IP address:
– network-layer address for interface
– used for layer 3 (network layer) forwarding
• MAC (or LAN or physical or Ethernet) address:
– function: used ‘locally” to get frame from one interface to another
physically-connected interface (same network, in IP-addressing sense)
– 48 bit MAC address (for most LANs) burned in NIC ROM, also
sometimes software settable
– e.g.: 1A-2F-BB-76-09-AD

hexadecimal (base 16) notation


(each “numeral” represents 4 bits)

Link Layer and LANs 6-32


LAN addresses and ARP
each adapter on LAN has unique LAN address

1A-2F-BB-76-09-AD

LAN
(wired or adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

Link Layer and LANs 6-33


LAN addresses (more)
• MAC address allocation administered by IEEE
• manufacturer buys portion of MAC address space (to assure
uniqueness)
• analogy:
– MAC address: like Social Security Number
– IP address: like postal address
• MAC flat address ➜ portability
– can move LAN card from one LAN to another
• IP hierarchical address not portable
– address depends on IP subnet to which node is attached

Link Layer and LANs 6-34


ARP: address resolution protocol
Question: how to determine
interface’s MAC address,
knowing its IP address? ARP table: each IP node (host,
router) on LAN has table
137.196.7.78 – IP/MAC address mappings
1A-2F-BB-76-09-AD
for some LAN nodes:
137.196.7.23 < IP address; MAC address; TTL>
137.196.7.14 – TTL (Time To Live): time
after which address mapping
LAN will be forgotten (typically 20
71-65-F7-2B-08-53
58-23-D7-FA-20-B0 min)

0C-C4-11-6F-E3-98
137.196.7.88

Link Layer and LANs 6-35


ARP protocol: same LAN
• A wants to send datagram to B
– B’s MAC address not in A’s ARP
table. • A caches (saves) IP-to-
• A broadcasts ARP query packet, MAC address pair in its
containing B's IP address ARP table until
– destination MAC address = FF-
FF-FF-FF-FF-FF information becomes old
– all nodes on LAN receive ARP (times out)
query – soft state: information that
• B receives ARP packet, replies times out (goes away)
to A with its (B's) MAC address unless refreshed
– frame sent to A’s MAC address • ARP is “plug-and-play”:
(unicast)
– nodes create their ARP
tables without intervention
from net administrator

Link Layer and LANs 6-36


Addressing: routing to another LAN
walkthrough: send datagram from A to B via R
 focus on addressing – at IP (datagram) and MAC layer (frame)
 assume A knows B’s IP address
 assume A knows IP address of first hop router, R (how?)
 assume A knows R’s MAC address (how?)

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer and LANs 6-37


Addressing: routing to another LAN
 A creates IP datagram with IP source A, destination B
 A creates link-layer frame with R's MAC address as destination
address, frame contains A-to-B IP datagram
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer and LANs 6-38


Addressing: routing to another LAN
 frame sent from A to R
 frame received at R, datagram removed, passed up to IP

MAC src: 74-29-9C-E8-FF-55


MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP IP
Eth Eth
Phy Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer and LANs 6-39


Addressing: routing to another LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as destination
address, frame contains A-to-B IP datagram

MAC src: 1A-23-F9-CD-06-9B


MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer and LANs 6-40


Addressing: routing to another LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as destination
address, frame contains A-to-B IP datagram

MAC src: 1A-23-F9-CD-06-9B


MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer and LANs 6-41


Addressing: routing to another LAN
 R forwards datagram with IP source A, destination B
 R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Link Layer and LANs 6-42
Chapter 4: outline
4.1 Allocation problem for a broadcast channel
- Multiple access problem
4.2. Control access protocols
– ALOHA
– Slotted ALOHA
– CSMA (CD/CA)
– Collision-free
4.3. LAN technologies
– LAN MAC Address & ARP
– Ethernet 802.3
– Wi-Fi 802.11
– WiMax 802.16
– Bluetooth
– 4G
– IoT
– RFID
Ethernet
“dominant” wired LAN technology:
• single chip, multiple speeds (e.g., Broadcom BCM5761)
• first widely used LAN technology
• simpler, cheap
• kept up with speed race: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet sketch


Link Layer and LANs 6-44
Ethernet: physical topology
• bus: popular through mid 90s
– all nodes in same collision domain (can collide with each other)
• star: prevails today
– active switch in center
– each “spoke” runs a (separate) Ethernet protocol (nodes do not collide
with each other)

switch
star
bus: coaxial cable
Link Layer and LANs 6-45
Ethernet frame structure

sending adapter encapsulates IP datagram (or other network


layer protocol packet) in Ethernet frame
type
dest. source
preamble address address data CRC
(payload)

preamble:
• 7 bytes with pattern 10101010 followed by one byte with
pattern 10101011
• used to synchronize receiver, sender clock rates

Link Layer and LANs 6-46


Ethernet frame structure (more)
• addresses: 6 byte source, destination MAC addresses
– if adapter receives frame with matching destination address, or with
broadcast address (e.g. ARP packet), it passes data in frame to network
layer protocol
– otherwise, adapter discards frame
• type: indicates higher layer protocol (mostly IP but others
possible, e.g., Novell IPX, AppleTalk)
• CRC: cyclic redundancy check at receiver
– error detected: frame is dropped

type
dest. source
preamble address address data CRC
(payload)

Link Layer and LANs 6-47


Ethernet: unreliable, connectionless
• connectionless: no handshaking between sending and
receiving NICs
• unreliable: receiving NIC doesn't send acks or nacks to
sending NIC
– data in dropped frames recovered only if initial
sender uses higher layer rdt (e.g., TCP), otherwise
dropped data lost
• Ethernet’s MAC protocol: unslotted CSMA/CD with binary
backoff

Link Layer and LANs 6-48


802.3 Ethernet standards: link & physical layers
• many different Ethernet standards
– common MAC protocol and frame format
– different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10 Gbps,
40 Gbps
– different physical layer media: fiber, cable

MAC protocol
application and frame format
transport
network 100BASE-TX 100BASE-T2 100BASE-FX
link 100BASE-T4 100BASE-SX 100BASE-BX
physical

copper (twister fiber physical layer


pair) physical layer
Link Layer and LANs 6-49
Ethernet (IEEE 802.3)
• Classic Ethernet
Thick Ethernet : 500 m, 100 users
– Shared medium
Thin Ethernet: 185 m, 30 users

– 2.5 km max + 4 repeaters


• switched Ethernet
– Fast Ethernet : 100 Mbps
– Gigabit Ethernet
– 10 Gigabit Ethernet
Ethernet: CSMA/CD with
Binary Exponential Backoff
• After i’th consecutive collision, the sender nodes wait a random number of
time slots between 0 and 2^i − 1.

• Each Time slot = 51.2 μsec = 512 bit times

• after 10 collisions, the interval is frozen at maximum 1023 slots.

• After 16 collisions, the controller reports failure back


Ethernet Performance
probability A that some station acquires the channel:
maximized when p = 1/k, with A → 1/e as k →∞
The probability that the contention interval has exactly j slots:

mean number of slots per contention:

slot duration = 2τ, the mean contention interval, w = 2τ/A.


w is at most 2τe ∼∼ 5.4τ.

mean frame takes P sec 

The longer the cable, the longer the contention interval


Efficiency of Ethernet at 10 Mbps with 512-bit slot
times
Switched Ethernet (1)

(a) Hub. (b) Switch.


Switched Ethernet (2)

Switch

Hub

Switch ports
Twisted pair

An Ethernet switch.
Fast Ethernet

 100B-T4: uses 4 twisted pairs with 25 MHz BW. 1 to the


switch, 1 from the switch and other 2 are interchangeable.
Using 3 voltage levels for symbols. Manchester encoding.

 100B-TX: 4B/5B encoding. 125 MHz BW results 100 Mbps. 2


pairs of cable required.

 100B-FX: only works with switches because the maximum


cable length should be less than 250 m for CD to work.
Gigabit Ethernet
• Two ways to enhance cable length to 200 m when using hubs:
– Hardware carrier extension to 512 bytes.
– frame bursting
• 8B/10B encoding is used to maintain synchronization.
• In UTP cables all 4 pairs are used in simultaneous full-duplex mode!
With 5 voltage levels
• Pause frames are defined to cease the communication speed.
10 Gigabit Ethernet
 Fiber cables use 64B/66B coding is used.
 CX cables use 8B/10B coding and 3.125 Gsymbol/sec on
each pair.
 T cabling requires 16 voltage levels. LDPC (Low Density
Parity Check) is used.
 40Gbps and 100Gbps Ethernet standards are in the way.
Ethernet benefits
• Reliable: by introducing switches
• Cheap: twisted pairs and NICs
• Easy to maintain: no software requirement. Easy configuration.
• Well integration with IP: both are connection less.
• Flexible: evolve by time in speed requirements with minimum
reconfiguration and changes.
Wireless LAN 802.11

• 802.11 architecture and protocol stack


• 802.11 physical layer
• 802.11 MAC sublayer protocol
• 802.11 frame structure
• Services
802.11 Architecture and Protocol Stack
(1)
To Network
Access
Point

Client

802.11 architecture – infrastructure mode


802.11 Architecture and Protocol Stack
(2)

802.11 architecture – ad-hoc mode-


802.11 Protocol Stack

1-2 Mbps 11 Mbps 54 Mbps 600 Mbps


802.11b PHY Layer
• 1 Mbps : 11 chip barker code to spread the signal with BPSK to
send 1 bit per 11 chip. The chip rate is 11 Mchips/sec.

• 2 Mbps : QPSK to send 2 bits per 11 chip.

• 5.5 Mbps: CCK (Complementary Code Keying) with 4 bits per 8


chips.

• 11 Mbps: CCK with 8 bits per 8 chips.


802.11a, g, n PHY Layer
• Works in 5GHz band.
• Uses OFDM with 52 subcarriers 48 for data and 4 for sync.
• Each symbol lasts 4μs and sends 1, 2, 4, or 6 bits.
• Supports 8 data rates from 6 up to 54Mbps.
• Communication range is 1/7 802.11b because of freq. band.

• 802.11 g uses OFDM in 2.4GHz band.


• Supports same rates of 802.11a with same range of 802.11b

• 802.11n doubles the channel width from 20 to 40MHz.


• Uses multiple antennas and MIMO techniques to increase BW.
The 802.11 MAC Sublayer Protocol

Sending a frame with CSMA/CA.

The initial back off gets exponentially bigger if no ack is received.


Collision Avoidance mechanism

The use of virtual channel sensing using CSMA/CA.


NAV (Network Allocation Vector)
CSMA/CA
• RTS/CTS mechanism is seldom used, because it slows down
the communication.

• The random back-off mechanism as well as virtual carrier


sensing (by overhearing the NAV field) are the main
mechanisms to avoid collision.

• Fragmentation is also used to keep the frame error rates small.

• Fragments are sent in bursts when channel is acquired and


each fragment should be acknowledged before the next one is
sent.
Power management
• Nodes go to sleep mode and inform AP of it.

• AP buffers traffic for sleeping nodes.

• AP sends periodic beacons to announce which node has a


buffered frame.

• Nodes should wake up at beacon intervals (typically 100msec)


to see if they have frames.

• If so they tell the AP to send them the frames.


Interframe timing for QoS purposes

• SIFS (Short InterFrame Spacing)


• DIFS (Distributed Coordination Function InterFrame Spacing)
• AIFS (Arbitration InterFrame Space)
• EIFS (Extended InterFrame Spacing)
802.11 Frame Structure

Format of the 802.11 data frame


Chapter 4: outline
4.1 Allocation problem for a broadcast channel
- Multiple access problem
4.2. Control access protocols
– ALOHA
– Slotted ALOHA
– CSMA (CA/CD)
– Collision-free
4.3. LAN technologies
– LAN MAC Address &ARP
– Ethernet
– Wi-Fi 802.11
– WiMax 802.16
– Bluetooth Presentation
– Mobile (Cellular)
– RFID
– VLAN
4.4. Data link layer switching
Data Link Layer Switching

• Uses of bridges
• Learning bridges
• Spanning tree bridges
• Repeaters, hubs, bridges, switches,
routers, and gateways
• Virtual LANs
Using bridges to connect LANs
backward learning
• hash tables are initially empty.
• Bridges use a flooding algorithm.
• Gradually By looking at the source addresses, they can tell which machines
are accessible on which ports.
• it makes an entry in its hash table for each station.
• the arrival time of the last frame is noted in the entry.
• It purges all entries more than a few minutes old.

Forwarding Rules
1. If the port for the destination address is the same as the source port, discard
the frame.
2. If the port for the destination address and the source port are different,
forward the frame on to the destination port.
3. If the destination port is unknown, use flooding and send the frame on all
ports except the source port.
Protocol processing at a bridge
Loop creation in case of using redundant
links between bridges
Spanning Tree Bridging
• B1 is elected to be the root because of its lowest ID.
Repeaters, Hubs, Bridges, Switches,
Routers, and Gateways

(a) Which device is in which layer.


(b) Frames, packets, and headers.
Virtual LANs (1)

A building with centralized wiring using hubs and a switch.


Virtual LANs (2)

Two VLANs, gray and white, on a bridged LAN.


Frames from gray LAN nodes are only forwarded to gray LAN ports.
The IEEE 802.1Q Standard (1)

The standard adds VLAN field in the MAC header.


Bridged LAN that is only partly VLAN-aware. The shaded
frames are originally VLAN aware. The empty ones are not.
The IEEE 802.1Q Standard (2)

The 802.3 (legacy) and 802.1Q Ethernet frame formats.


Hub
Hub is the repeating device of the physical layer:
Bits coming from one link will come out any other links with the
same speed
No buffer frame
No CSMA/CD at hub:
Provides network administration function

twisted pair

hub

1-84
Connecting to hub
Backbone hub connects LAN segments
Extend maximum distance among nodes
But the segment's collision areas become larger
Unable to connect 10BaseT and 100BaseT

hub

hub
hub hub

1-85
Switch
• The switch is the repeating device of the datalink layer
– Store and forward Ethernet frames
– Check the frame header and select frame for forwarding based on
the MAC target address
– When the frame is forwarded on the segment, it uses CSMA/CD to
access the segment
– Transparent: Hosts don’t know the existence of the switch
– plug-and-play: Switch does not require pre-configuration

1-86
Forwarding
1
switch
2 3

hub
hub hub

How to determine which frame to be forwarded to


LAN segment? Similar to the routing problem...

1-87
Ethernet switch
• link-layer device: takes an active role
– store, forward Ethernet frames
– examine incoming frame’s MAC address,
selectively forward frame to one-or-more
outgoing links when frame is to be forwarded on
segment, uses CSMA/CD to access segment
• transparent
– hosts are unaware of presence of switches
• plug-and-play, self-learning
– switches do not need to be configured

Link Layer 5-88


Switch: multiple simultaneous transmissions
• hosts have dedicated, direct A
connection to switch
• switches buffer packets C’ B

• Ethernet protocol used on each 1 2


6
incoming link, but no collisions;
full duplex 5 4 3
– each link is its own collision
domain B’ C
• switching: A-to-A’ and B-to-B’
can transmit simultaneously, A’
without collisions
switch with six interfaces
(1,2,3,4,5,6)

Link Layer 5-89


Switch forwarding table

Q: how does switch know A’ A


reachable via interface 4, B’ reachable
C’ B
via interface 5?
 A: each switch has a switch 6 1 2
table, each entry:
5 4 3
 (MAC address of host, interface
to reach host, time stamp) B’ C
 looks like a routing table!
A’
Q: how are entries created, switch with six interfaces
maintained in switch table? (1,2,3,4,5,6)
 something like a routing
protocol?
Link Layer 5-90
Switch: self-learning Source: A
Dest: A’

A A A’
• switch learns which hosts
can be reached through C’ B
which interfaces
– when frame received, switch 6 1 2
“learns” location of sender:
incoming LAN segment 5 4 3
– records sender/location pair B’ C
in switch table

A’

MAC addr interface TTL


A 1 60 Switch table
(initially empty)

Link Layer 5-91


Switch: frame filtering/forwarding
when frame received at switch:

1. record incoming link, MAC address of sending host


2. index switch table using MAC destination address
3. if entry found for destination
then {
if destination on segment from which frame arrived
then drop frame
else forward frame on interface indicated by entry
}
else flood /* forward on all interfaces except arriving
interface */

Link Layer 5-92


Self-learning, forwarding: example Source: A
Dest: A’

A A A’
• frame destination, A’,
locaton unknown: flood C’ B

1
 destination A location 6 2

known:selectively send A A’
5 4 3
on just one link B’ C
A’ A

A’

MAC addr interface TTL


A 1 60 switch table
A’ 4 60 (initially empty)

Link Layer 5-93


Interconnecting switches
 switches can be connected together
S4

S1
S3
A S2
F
D I
B C
G H
E

Q: sending from A to G - how does S1 know to


forward frame destined to F via S4 and S3?
 A: self learning! (works exactly the same as in
single-switch case!)
Link Layer 5-94
Self-learning multi-switch example
Suppose C sends frame to I, I responds to C

S4

S1
S3
A S2
F
D I
B C
G H
E

 Q: show switch tables and packet forwarding in S1, S2, S3,


S4

Link Layer 5-95


Institutional network

mail server
to external
network
router web server

IP subnet

Link Layer 5-96


Switches vs. routers
application
transport
both are store-and-forward:
datagram network
 routers: network-layer frame link
devices (examine network- physical link frame
layer headers) physical
 switches: link-layer devices switch
(examine link-layer headers)
network datagram
both have forwarding tables: link frame
 routers: compute tables physical
using routing algorithms, IP
addresses application
 switches: learn forwarding transport
network
table using flooding,
learning, MAC addresses link
physical
Link Layer 5-97
VLANs: motivation
consider:
 CS user moves office to EE,
but wants connect to CS
switch?
 single broadcast domain:
 all layer-2 broadcast traffic
(ARP, DHCP, unknown location
of destination MAC address)
Computer
Science
Computer must cross entire LAN
Electrical Engineering
Engineering  security/privacy, efficiency
issues

Link Layer 5-98


port-based VLAN: switch ports
VLANs
grouped (by switch management
software) so that single physical
Virtual Local switch ……
1 7 9 15
Area Network 2 8 10 16

switch(es) supporting
VLAN capabilities can … …
be configured to Electrical Engineering Computer Science
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)

LANS over single … operates as multiple virtual switches


physical LAN
infrastructure. 1 7 9 15
2 8 10 16

… …

Electrical Engineering Computer Science


(VLAN ports 1-8) (VLAN ports 9-16)

Link Layer 5-99


Port-based VLAN
router
 traffic isolation: frames to/from
ports 1-8 can only reach ports 1-8
 can also define VLAN based on MAC
addresses of endpoints, rather than
switch port
1 7 9 15

2 8 10 16

 dynamic membership: ports


can be dynamically assigned … …
among VLANs Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-15)

 forwarding between VLANS: done


via routing (just as with separate
switches)
 in practice vendors sell combined
switches plus routers

Link Layer 5-100


VLANS spanning multiple switches
1 7 9 15 1 3 5 7

2 8 10 16 2 4 6 8

… …

Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN


(VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN

• trunk port: carries frames between VLANS defined over


multiple physical switches
– frames forwarded within VLAN between switches can’t be vanilla
802.1 frames (must carry VLAN ID info)
– 802.1q protocol adds/removed additional header fields for frames
forwarded between trunk ports

Link Layer 5-101


802.1Q VLAN frame format
type

preamble dest. source data (payload) CRC


address address 802.1 frame

type
dest. source
preamble
address address
data (payload) CRC 802.1Q frame

2-byte Tag Protocol Identifier Recomputed


(value: 81-00) CRC

Tag Control Information (12 bit VLAN ID field,


3 bit priority field like IP TOS)

Link Layer 5-102

You might also like