Com NW005
Com NW005
Our goals:
❒ understand principles behind data link layer
services:
❍ error detection, correction
❍ sharing a broadcast channel: multiple access
❍ link layer addressing
❍ reliable data transfer, flow control: done!
❒ instantiation and implementation of various link
layer technologies
Link Layer: Introduction “link”
Some terminology:
❒ hosts and routers are nodes
(bridges and switches too)
❒ communication channels that
connect adjacent nodes along
communication path are links
❍ wired links
❍ wireless links
❍ LANs
❒ 2-PDU is a frame,
encapsulates datagram
5a-3
Link Layer Services (more)
❒ Flow Control:
❍ pacing between adjacent sending and receiving nodes
❒ Error Detection:
❍ errors caused by signal attenuation, noise.
❍ receiver detects presence of errors:
• signals sender for retransmission or drops frame
❒ Error Correction:
❍ receiver identifies and corrects bit error(s) without
resorting to retransmission
❒ Half-duplex and full-duplex
❍ with half duplex, nodes at both ends of link can transmit,
but not at same time
5a-4
Adaptors Communicating
datagram
link layer protocol rcving
sending node
node
frame frame
adapter adapter
0 0
Checksumming: Cyclic Redundancy Check
❒ view data bits, D, as a binary number
❒ choose r+1 bit pattern (generator), G
❒ goal: choose r CRC bits, R, such that
❍ <D,R> exactly divisible by G (modulo 2)
❍ receiver knows G, divides <D,R> by G. If non-zero
remainder: error detected!
❍ can detect all burst errors less than r+1 bits
❒ widely used in practice (ATM, HDLC)
Multiple Access Links and Protocols
Two types of “links”:
❒ point-to-point
❍ PPP for dial-up access
❍ point-to-point link between Ethernet switch and host
❒ broadcast (shared wire or medium)
❍ traditional Ethernet
❍ upstream HFC
❍ 802.11 wireless LAN
Multiple Access protocols
❒ single shared broadcast channel
❒ two or more simultaneous transmissions by nodes:
interference
❍ only one node can send successfully at a 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!
❒ what to look for in multiple access protocols:
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps
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
MAC Protocols: a 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”
❍ tightly coordinate shared access to avoid
collisions
Channel Partitioning MAC protocols: TDMA
Pros Cons
❒ single active node can ❒ collisions, wasting slots
continuously transmit ❒ idle slots
at full rate of ❒ nodes may be able to
channel
detect collision in less
❒ highly decentralized: than time to transmit
only slots in nodes packet
need to be in sync
❒ simple 5a-27
Slotted Aloha efficiency
Efficiency is the long-run ❒ For max efficiency
fraction of successful slots with N nodes, find p*
when there’s many nodes, each that maximizes
with many frames to send Np(1-p)N-1
❒ For many nodes, take
❒ Suppose N nodes with limit of Np*(1-p*)N-1
many frames to send, as N goes to
each transmits in infinity, gives 1/e
slot with probability = .37
p At best: channel
❒ prob that 1st node has used for useful
success in a slot transmissions 37%
= p(1-p)N-1 of time!
❒ prob that any node has
a success = Np(1-p)N-1
CSMA (Carrier Sense Multiple Access)
datagram
frame
ARP: Address Resolution Protocol
R
B
❒ Two ARP tables in router R, one for each
IP network (LAN)
❒ A creates datagram with source A, destination B
❒ A uses ARP to get R’s MAC address for 111.111.111.110
❒ A creates link-layer frame with R's MAC address as dest,
frame contains A-to-B IP datagram
❒ A’s data link layer sends frame
❒ R’s data link layer receives frame
❒ R removes IP datagram from Ethernet frame, sees its
destined to B
❒ R uses ARP to get B’s physical layer address
❒ R creates frame containing A-to-B IP datagram sends
to B
R
B
Metcalfe’s Ethernet
sketch
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet
frame
Preamble:
❒ 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011
❒ used to synchronize receiver, sender clock
rates
Ethernet Frame Structure
(more)
❒ Addresses: 6 bytes
❍ if adapter receives frame with matching destination
address, or with broadcast address (eg ARP packet), it
passes data in frame to net-layer protocol
❍ otherwise, adapter discards frame
❒ Type: indicates the higher layer protocol, mostly
IP but others may be supported such as Novell
IPX and AppleTalk)
❒ CRC: checked at receiver, if error is detected, the
frame is simply dropped
Unreliable, connectionless service
❒ Connectionless: No handshaking between sending
and receiving adapter.
❒ Unreliable: receiving adapter doesn’t send acks or
nacks to sending adapter
❍ stream of datagrams passed to network layer can have
gaps
❍ gaps will be filled if app is using TCP
❍ otherwise, app will see the gaps
Ethernet uses CSMA/CD
❒ No slots ❒ Before attempting a
❒ adapter doesn’t transmit retransmission,
if it senses that some adapter waits a
other adapter is random time, that is,
transmitting, that is, random access
carrier sense
❒ transmitting adapter
aborts when it senses
that another adapter is
transmitting, that is,
collision detection
Ethernet CSMA/CD algorithm
1. Adaptor gets datagram 4. If adapter detects
from and creates frame another transmission while
2. If adapter senses channel transmitting, aborts
idle, it starts to transmit and sends jam signal
frame. If it senses 5. After aborting, adapter
channel busy, waits until enters exponential
channel idle and then backoff: after the mth
transmits collision, adapter chooses
3. If adapter transmits a K at random from
entire frame without {0,1,2,…,2m-1}. Adapter
detecting another waits K*512 bit times and
transmission, the adapter returns to Step 2
is done with frame !
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all Exponential Backoff:
other transmitters are ❒ Goal: adapt retransmission
aware of collision; 48 bits; attempts to estimated
Bit time: .1 microsec for 10 current load
Mbps Ethernet ; ❍ heavy load: random wait
for K=1023, wait time is will be longer
about 50 msec ❒ first collision: choose K
from {0,1}; delay is K x 512
bit transmission times
❒ after second collision:
See/interact with Java choose K from {0,1,2,3}…
applet on AWL Web site: ❒ after ten collisions, choose
highly recommended !
K from {0,1,2,3,4,…,1023}
CSMA/CD efficiency
❒ Tprop = max prop between 2 nodes in LAN
❒ ttrans = time to transmit max-size frame
1
efficiency
1 5t prop / t trans
❒ Efficiency goes to 1 as tprop goes to 0
❒ Goes to 1 as ttrans goes to infinity
❒ Much better than ALOHA, but still decentralized,
simple, and cheap
Ethernet Technologies: 10Base2
❒ 10: 10Mbps; 2: under 200 meters max cable
length
❒ thin coaxial cable in a bus topology
nodes
hub
❒ Hubs are essentially physical-layer repeaters:
❍ bits coming in one link go out all other links
❍ no frame buffering
❍ no CSMA/CD at hub: adapters detect
collisions
❍ provides net management functionality
Manchester encoding
Recommended !
Bridges Spanning Tree
❒ for increased reliability, desirable to have
redundant, alternative paths from source to dest
❒ with multiple paths, cycles result - bridges may
multiply and forward frame forever
❒ solution: organize bridges in a spanning tree by
disabling subset of interfaces
Disabled
Some bridge features
❒ Isolates collision domains resulting in higher total
max throughput
❒ limitless number of nodes and geographical
coverage
❒ Can connect different Ethernet types
❒ Transparent (“plug-and-play”): no configuration
necessary
Bridges vs. Routers
❒ both store-and-forward devices
❍ routers: network layer devices (examine network layer
headers)
❍ bridges are link layer devices
❒ routers maintain routing tables, implement routing
algorithms
❒ bridges maintain bridge tables, implement filtering,
learning and spanning tree algorithms
Routers vs. Bridges
Bridges + and -
+ Bridge operation is simpler requiring less packet
processing
+ Bridge tables are self learning
- All traffic confined to spanning tree, even when
alternative bandwidth is available
- Bridges do not offer protection from broadcast
storms
Routers vs. Bridges
Routers + and -
+ arbitrary topologies can be supported, cycling is
limited by TTL counters (and good routing protocols)
+ provide protection against broadcast storms
- require IP address configuration (not plug and play)
- require higher packet processing
Shared
Summary comparison
optimal no no yes no
routing
cut yes no no yes
through
IEEE 802.11 Wireless LAN
❒ 802.11b ❒ 802.11a
❍ 2.4-5 GHz unlicensed ❍ 5-6 GHz range
radio spectrum ❍ up to 54 Mbps
❍ up to 11 Mbps ❒ 802.11g
❍ direct sequence spread ❍ 2.4-5 GHz range
spectrum (DSSS) in
physical layer
❍ up to 54 Mbps
• all hosts use same ❒ All use CSMA/CA for
chipping code multiple access
❍ widely deployed, using ❒ All have base-station
base stations and ad-hoc network
versions
Ad Hoc Network approach
❒ No AP (i.e., base station)
❒ wireless hosts communicate with each other
❍ to get packet from wireless host A to B may
need to route through wireless hosts X,Y,Z
❒ Applications:
❍ “laptop” meeting in conference room, car
❍ interconnection of “personal” devices
❍ battlefield
❒ IETF MANET
(Mobile Ad hoc Networks)
working group
IEEE 802.11: multiple access
❒ Collision if 2 or more nodes transmit at same time
❒ CSMA makes sense:
❍ get all the bandwidth if you’re the only one transmitting
❍ shouldn’t cause a collision if you sense another transmission
❒ Collision detection doesn’t work: hidden terminal
problem
IEEE 802.11 MAC Protocol: CSMA/CA
802.11 CSMA: sender
- if sense channel idle for
DISF sec.
then transmit entire frame
(no collision detection)
-if sense channel busy
then binary backoff
802.11 CSMA receiver
- if received OK
return ACK after
SIFS
(ACK is needed due to
hidden terminal problem)
Collision avoidance mechanisms
❒ Problem:
❍ two nodes, hidden from each other, transmit complete
frames to base station
❍ wasted bandwidth for long duration !
❒ Solution:
❍ small reservation packets
❍ nodes track reservation interval with
internal “network allocation vector” (NAV)
A word about Bluetooth
❒ Low-power, small radius, ❒ Interference from
wireless networking wireless LANs, digital
technology cordless phones,
❍ 10-100 meters microwave ovens:
❒ omnidirectional ❍ frequency hopping
helps
❍ not line-of-
sight infrared ❒ MAC protocol
❒ Interconnects supports:
gadgets ❍ error correction
❒ 2.4-2.5 GHz unlicensed
❍ ARQ