0% found this document useful (0 votes)
59 views46 pages

Data Link 1

The document provides an overview of the Data Link Layer, focusing on its services such as error detection, correction, and multiple access protocols. It discusses various link layer technologies, including Ethernet, PPP, and wireless LANs, as well as concepts like framing, flow control, and link layer addressing. Additionally, it covers multiple access protocols, including channel partitioning and random access methods, highlighting their advantages and disadvantages.

Uploaded by

Marwan Fouad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views46 pages

Data Link 1

The document provides an overview of the Data Link Layer, focusing on its services such as error detection, correction, and multiple access protocols. It discusses various link layer technologies, including Ethernet, PPP, and wireless LANs, as well as concepts like framing, flow control, and link layer addressing. Additionally, it covers multiple access protocols, including channel partitioning and random access methods, highlighting their advantages and disadvantages.

Uploaded by

Marwan Fouad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Data Link Layer I

Chapter : The Data Link Layer


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:
❒ instantiation and implementation of various link
layer technologies
Chapter: outline
❒ Introduction and ❒ Hubs, bridges, and
services switches
❒ Error detection and ❒ Wireless links and
correction LANs
❒ Multiple access ❒ PPP
protocols ❒ ATM
❒ LAN addresses and ❒ Frame Relay
ARP
❒ Ethernet
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

data-link layer has responsibility of


transferring datagram from one node
to adjacent node over a link
Link layer: context
❒ Datagram transferred by
transportation analogy
❒ trip from Princeton to
different link protocols
Lausanne
over different links:
❍ limo: Princeton to JFK
❍ e.g., Ethernet on first link,
❍ plane: JFK to Geneva
frame relay on
intermediate links, 802.11 ❍ train: Geneva to Lausanne
on last link ❒ tourist = datagram
❒ Each link protocol ❒ transport segment =
provides different communication link
services ❒ transportation mode =
❍ e.g., may or may not link layer protocol
provide rdt over link
❒ travel agent = routing
algorithm
reliable data transfer:
it is protocol to ensure delivery of all packets.
Link Layer Services
❒ Framing, link access:
❍ encapsulate datagram into frame, adding header, trailer
❍ channel access if shared medium
❍ ‘physical addresses’ used in frame headers to identify
source, dest
• different from IP address!
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
Adaptors Communicating
datagram
link layer protocol receiving
sending node
node
frame frame
adapter adapter

❒ link layer implemented in ❒ receiving side


“adaptor” (aka NIC) ❍ looks for errors, rdt, flow
❍ Ethernet card, PCMCI control, etc
card, 802.11 card ❍ extracts datagram, passes
to receiving node
❒ sending side:
❍ encapsulates datagram in ❒ adapter is semi-autonomous
a frame
❍ adds error checking bits, ❒ link & physical layers
rdt, flow control, etc.
Chapter: outline
❒ Introduction and ❒ Hubs, bridges, and
services switches
❒ Error detection and ❒ Wireless links and
correction LANs
❒ Multiple access ❒ PPP
protocols ❒ ATM
❒ LAN addresses and ❒ Frame Relay
ARP
❒ Ethernet
Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields

• Error detection not 100% reliable!


• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction
Parity Checking
Single Bit Parity: Two Dimensional Bit Parity:
Detect single bit errors Detect and correct single bit errors

0 0
Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)

Sender: Receiver:
❒ compute checksum of received
❒ treat segment contents
segment
as sequence of 16-bit
❒ check if computed checksum
integers equals checksum field value:
❒ checksum: addition (1’s ❍ NO - error detected
complement sum) of ❍ YES - no error detected. But
segment contents maybe errors nonetheless?
❒ sender puts checksum More later ….
value into UDP checksum
field
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)
CRC Example
Want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by
G, want remainder R

D.2r
R = remainder[ ]
G
Chapter: outline
❒ Introduction and ❒ Hubs, bridges, and
services switches
❒ Error detection and ❒ Wireless links and
correction LANs
❒ Multiple access ❒ PPP
protocols ❒ ATM
❒ LAN addresses and ❒ Frame Relay
ARP
❒ Ethernet
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

TDMA: time division multiple access


❒ access to channel in "rounds"
❒ each station gets fixed length slot (length = pkt
trans time) in each round
❒ unused slots go idle
❒ example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle
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 pkt, frequency
bands 2,5,6 idle
time
frequency bands
Channel Partitioning (CDMA)
CDMA (Code Division Multiple Access)
❒ unique “code” assigned to each user; i.e., code set partitioning
❒ used mostly in wireless broadcast channels (cellular, satellite,
etc)
❒ all users share same frequency, but each user has own
“chipping” sequence (i.e., code) to encode data
❒ encoded signal = (original data) X (chipping sequence)
❒ decoding: inner-product of encoded signal and chipping
sequence
❒ allows multiple users to “coexist” and transmit simultaneously
with minimal interference (if codes are “orthogonal”)
CDMA Encode/Decode
CDMA: two-sender interference
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:
❍ slotted ALOHA
❍ ALOHA
❍ CSMA, CSMA/CD, CSMA/CA
Slotted ALOHA
Assumptions Operation
❒ all frames same size ❒ when node obtains fresh
❒ time is divided into frame, it transmits in next
equal size slots, time to slot
transmit 1 frame ❒ no collision, node can send
❒ nodes start to transmit new frame in next slot
frames only at ❒ if collision, node
beginning of slots retransmits frame in each
❒ nodes are synchronized subsequent slot with prob.
❒ if 2 or more nodes
p until success
transmit in slot, all
nodes detect collision
Slotted ALOHA

Pros Cons
❒ single active node can ❒ collisions, wasting slots
continuously transmit ❒ idle slots
at full rate of channel ❒ nodes may be able to
❒ highly decentralized: detect collision in less
only slots in nodes than time to transmit
need to be in sync packet
❒ simple
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 infinity,
each transmits in slot gives 1/e = .37
with probability p
❒ prob that 1st node has At best: channel
success in a slot used for useful
= p(1-p)N-1 transmissions 37%
❒ prob that any node has of time!
a success = Np(1-p)N-1
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]
Pure Aloha efficiency
P(success by given node) = P(node transmits) .

P(no other node transmits in [p0-1,p0] .


P(no other node transmits in [p0-1,p0]
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)

… choosing optimum p and then letting n -> infty ...

= 1/(2e) = .18
Even worse !
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!


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
note:
role of distance & propagation
delay in determining collision
probability
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: receiver shut off while
transmitting
❒ human analogy: the polite conversationalist
CSMA/CD collision detection
“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!
“Taking Turns” MAC protocols
Polling: Token passing:
❒ master node ❒ control token passed from
“invites” slave nodes one node to next
to transmit in turn sequentially.
❒ concerns: ❒ token message
❍ polling overhead ❒ concerns:
❍ latency ❍ token overhead
❍ single point of ❍ latency
failure (master) ❍ single point of failure (token)
Summary of MAC protocols
❒ What do you do with a shared media?
❍ Channel Partitioning, by time, frequency or code
• Time Division,Code Division, Frequency Division
❍ Random partitioning (dynamic),
• ALOHA, S-ALOHA, CSMA, CSMA/CD
• carrier sensing: easy in some technologies (wire), hard
in others (wireless)
• CSMA/CD used in Ethernet
❍ Taking Turns
• polling from a central site, token passing
LAN technologies
Data link layer so far:
❍ services, error detection/correction, multiple
access
Next: LAN technologies
❍ addressing
❍ Ethernet
❍ hubs, bridges, switches
❍ 802.11
❍ PPP
❍ ATM
LAN Addresses and ARP
32-bit IP address:
❒ network-layer address
❒ used to get datagram to destination IP network
(recall IP network definition)
LAN (or MAC or physical or Ethernet) address:
❒ used to get datagram from one interface to another
physically-connected interface (same network)
❒ 48 bit MAC address (for most LANs)
burned in the adapter ROM
LAN Addresses and ARP
Each adapter on LAN has unique LAN address
LAN Address (more)
❒ MAC address allocation administered by IEEE
❒ manufacturer buys portion of MAC address space
(to assure uniqueness)
❒ Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
❒ MAC flat address => portability
❍ can move LAN card from one LAN to another
❒ IP hierarchical address NOT portable
❍ depends on IP network to which node is attached
Recall earlier routing discussion
Starting at A, given IP A 223.1.1.1
datagram addressed to B:
223.1.2.1
❒ look up net. address of B, find B 223.1.1.2
on same net. as A 223.1.1.4 223.1.2.9
B
❒ link layer send datagram to B 223.1.2.2
E
inside link-layer frame 223.1.1.3 223.1.3.27

223.1.3.1 223.1.3.2
frame source, datagram source,
dest address dest address

B’s MAC A’s MAC A’s IP B’s IP


IP payload
addr addr addr addr

datagram
frame
ARP: Address Resolution Protocol

Question: how to determine ❒ Each IP node (Host,


MAC address of B Router) on LAN has
knowing B’s IP address? ARP table
❒ ARP Table: IP/MAC
address mappings for
some LAN nodes
< IP address; MAC address; TTL>
❍ TTL (Time To Live): time
after which address
mapping will be forgotten
(typically 20 min)
ARP protocol
❒ A wants to send datagram ❒ A caches (saves) IP-to-
to B, and A knows B’s IP MAC address pair in its
address. ARP table until information
❒ Suppose B’s MAC address becomes old (times out)
is not in A’s ARP table. ❍ soft state: information
❒ A broadcasts ARP query that times out (goes
packet, containing B's IP away) unless refreshed
address ❒ ARP is “plug-and-play”:
❍ all machines on LAN ❍ nodes create their ARP
receive ARP query tables without
❒ B receives ARP packet, intervention from net
replies to A with its (B's) administrator
MAC address
❍ frame sent to A’s MAC
address (unicast)
Routing to another LAN
walkthrough: send datagram from A to B via R
assume A knows B IP address

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

You might also like