1 CSCD 330 Network Programming Spring 2014 Lecture 17 Link Layer Hardware and Protocols Reading:...
-
Upload
ethan-hunter -
Category
Documents
-
view
214 -
download
0
Transcript of 1 CSCD 330 Network Programming Spring 2014 Lecture 17 Link Layer Hardware and Protocols Reading:...
1
CSCD 330Network ProgrammingSpring 2014
Lecture 17Link Layer
Hardware and Protocols
Reading: Chapter 5 in text
Some slides provided courtesy of J.F Kurose and K.W. Ross, All Rights Reserved, copyright 1996-2007
Who is this?
Robert (Bob) Metcalf – Inventor of Ethernet
Bob Metcalfe Helped build early Internet while still an
undergraduateInvented Ethernet—while at Xerox Palo Alto
Research CenterFounded 3Com Corp.Served as publisher at IDG's Infoworld
Publishing Co.Wrote three booksSince January 2001 has been a venture capitalist
with Polaris Ventures
Nice article on him … if you want to read ithttp://electronicdesign.com/Articles/Index.cfm?
AD=1&ArticleID=2855
2
3
Introduction to Link LayerSo far,
Application Layer - applications interface to people
Messages get delivered Transport Layer – application to application
Segments get delivered Network Layer – destination to destination
Datagrams get delivered Link Layer – node to node delivery
Frames are delivered
Link Layer Overview
• Main question at this layer• How do I deliver packets or frames
between two nodes in the network?
• Historical reasons look at other link layer schemes• But, Ethernet is currently dominant
technology 802.11 Wireless another protocol Covered in a different chapter, in a different course and at a future time in a galaxy far away ... 4
5
Link Layer
• 5.1 Introduction and services
• 5.1a NIC Cards• 5.2 Error detection and
correction • 5.3Multiple access
protocols• 5.4 Link-layer
Addressing• 5.5 Ethernet
6
Link Layer - IntroductionLink Layer Terms• Both Hosts and routers• Called nodes
• Communication channels connect adjacent nodes along communication path, links• Wired links• Wireless links
• Layer-2 packet is a frame encapsulates datagramData-link layer responsible for
transferring a frame from one node to adjacent node over a link
Link Layer Services
• The services offered by Link Layer are ....• Framing• Link Access• Reliable Delivery• Flow Control• Error Detection and Correction• Half dupleax and full duplex
7
8
Link Layer Services
• Framing• Encapsulate datagram into frame, add
header, trailer• MAC (Media Access Control) addresses used
in frame headers to identify source, destination• Example: 00:13:02:BA:43:56
• Reliable Delivery Between Adjacent Nodes• Wireless links: higher error rates,• Does more for reliability than wired• Does compute errors
• Wired relies on upper layers to handle it• Channel Access• Share channel if shared medium• Point to point if not shared
9
Reliable DeliveryQuestion on ReliabilitySo, why would you need both link-level and transport layer reliability?• Because dealing with reliability at two levels!• Transport layer reliability • For end-to-end delivery between two processes
• Link layer reliability • For delivery between two nodes connected by a single link
10
Link Layer Services Continued• 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
Link Layer Implementation• Where is the link layer
implemented?• Hardware or software?• Separate card or on chip?
• Mostly Implemented• Hardware• Network Interface Card (NIC)
11
Link Layer Implementation
• Alternative to actual NIC card ...• Built in to the motherboard
13
Where is the link layer implemented?• In each host• Link layer implemented
in “Network adaptor”
Network Interface Card (NIC)• Ethernet card, PCMCI
card, 802.11 card• Implements link and
physical layers
• Attaches to host’s system buses
• Combination of hardware, software, firmware
controller
physical
transmission
cpu memory
host bus (e.g., PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
14
Network Interface Cards (NIC) Basics
• A Network Interface Card (NIC) • Establishes link between computer and
network, and manages link
• A NIC performs two crucial tasks:1. Establishes and manages computer’s
network connection2. Encodes and translates digital data into
signals for outgoing messages, and Translates signals into digital computer
data for incoming messages
15
Parallel vs. Serial Transmission
• NICs also manage transformation of network data’s form• Computer bus has series of parallel data lines
(Parallel transmission)• Signals traversing network media consist of a
linear sequence of bits of data (serial transmission)
• NIC takes outgoing transmission in parallel form and recasts them into their serial equivalents For incoming messages, process reverses• Converting between serial and parallel
transmission , NIC has memory, to hold data temporarily
16
Parallel vs. Serial Transmission
• Bus width - number of parallel lines in a computer bus• Industry Standard Architecture (ISA) bus – 16-bit
obsolete• Peripheral Component Interconnect (PCI) bus –
32-bit, 64-bit , faster
Bus width
17
Network Interface Card
• Heart of card is a special purpose processor chip• Does framing, link access, flow control and
error detection• Encryption too, for wireless• Examples• Intel 8254x controller implements
Ethernet,• Atheros AR5006 controller handles 802.11
protocol• Trend ... Integrate adapters into
motherboard, not separate cards anymore• Particularly true for laptops and phones
devices
18
Link Layer
• 5.1 Introduction and services
• 5.2 Error detection and correction - Later
• 5.3Multiple access protocols
• 5.4 Link-layer Addressing
• 5.5 Ethernet
Error Detection and CorrectionCauses of Transmission Errors• Signal noise, attenuation or distortion• Both on wired and wireless mediums• See next slide ...
Definitions
• What is Signal Attenuation?• Loss of signal strength measured in decibels (dB)
dec•i•bel - Defined a unit used to express differences in power, in
acoustics or electronics: equal to ten times the common logarithm of the ratio of two signals.
• Occurs for several reasons• Range - both wireless and wired transmissions
gradually dissipate in strength over longer distance• Interference - on wireless networks, radio
interference or physical obstructions like walls dampen communication signals
• Wire size - on wired networks, thinner wires suffer from higher (more) attenuation than thicker wires
Errors at Link Layer
Two Ideas for Errors at Link Layer
Error detection
– Parity checks, cyclic redundancy codes, checksum
Error correction
– Send redundant information with frame
– When receiving frame incorrectly, receiver makes “educated guess” about the original frame
Error Detection
• Error Detection• Lets … Receiver• Determine whether received message has
been corrupted• Checksum simplest method• Checksum, function of message, gets
appended to message• Receiver uses same function to
calculate checksum of received message and compare it with appended checksum
DataLink Layer 23
Example of ChecksumInternet Checksum Goal: Detect “errors” (e.g., flipped bits) in
transmitted packet (note: used at transport layer only)
Sender: Treat segment contents as sequence of 16-bit
integers Checksum: Addition (1’s complement sum) of
segment contentsOnly done on IP packet header
Receiver: Compute checksum of received segment Check if computed checksum equals checksum
field value: NO - error detected YES - no error detected
24
Error Detection
• Parity Checking – Even Parity • If you get odd number of bits including parity bit– > A bit changed in transmission• Single parity bit is an error
detecting code,• Not an error correcting code • No way to determine which bit is corrupted
• Two-dimensional parity checks parity of both column and row, pinpoints error and allows for correction
25
Parity Checking Simplest TechniqueSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
Simple detection
For Even Parity
Number of 1’s in data + parity bit must be an Even number
Can locate and correct errors
1
9 1’s Add a 1
26
Parity Checking
• Comment • Is a limit to parity schemes• A parity bit only guaranteed to detect
an odd number of bit errors One, three, five, and so forth • If even number of bits (two, four, six
and so on) are flipped, the parity bit appears to be correct, even though the data is corrupt• This is for even parity• Odd parity will have the reverse problem
27
Checksumming Cyclic Redundancy Check (CRC)• Want algorithm detects some number of
changed bits• Ideally ... implemented in hardware• CRC Scheme• CRC algorithms treat message as an
enormous binary number,• Divide it by another fixed binary
number,• Make remainder from this division the
checksum• Widely used in practice (Ethernet, 802.11
WiFi, ATM)• It has better powers of detection than bit
parity or checksums … uses entire number, handle more bit errors – nice example belowhttp://www.repairfaq.org/filipg/LINK/F_crc_v3.html
28
Link Layer
• 5.1 Introduction and services
• 5.2 Error detection and correction
• 5.3 Multiple access protocols
• 5.4 Link-layer Addressing
• 5.5 Ethernet
29
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)• Old-fashioned Ethernet• 802.11 wireless LAN• Satellite
shared wire (e.g., cabled non-switch Ethernet)
shared RF (e.g., 802.11 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air, acoustical)
Communication Between Nodes
• Point to Point Links• These are dedicated channels between a
node and switch or modem• No need to share the link
• Broadcast Links• Multiple sending and receiving nodes all
connected to single broadcast channel• Central problem at link layer• How to “share” the link between nodes• Must coordinate access between
competing nodes• Known as Multiple Access Problem
Multiple Access Problem
• Question is• How do you fairly share the medium at the
Link level?• Everyone is connected to same network• All want to send their data all the time.• How do we fairly share the medium?
32
Multiple Access Protocols• Idea is .... can send and receive in both
directions single shared broadcast channel • Two or more simultaneous transmissions by
nodes means interference • Collision if node receives two or more
signals at the same time … gibberish, must retransmit, BAD!
Multiple Access Protocol• Distributed algorithm, 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
33
Ideal Multiple Access Protocol
Rules - Broadcast Channel, Rate = R bps1. When one node wants to transmit, can send
at full rate R2. When M nodes want to transmit, each can
send at average rate R/M ... Fair3. Fully decentralized• No special node to coordinate
transmissions• No synchronization of clocks, slots
4. Simple
In a perfect world ...
Examine Following Strategies
• Look at each of the strategies and see how close each meets the IDEAL Multiple Access Channel properties ...
35
Multiple Access Protocols: A TaxonomyThree broad classes1.Channel Partitioning• Divide channel into smaller pieces• Time slots, frequency, code division
• Allocate piece to node for exclusive use
2. Random Access• Channel not divided, allow collisions• Recover from collisions
3. Taking turns• Nodes take turns, but nodes with more to send can take longer turns
Channel Partitioning
37
Channel Partitioning Protocols: TDMATDMA: Time Division Multiple Access • Access to channel in "rounds" • Each station gets fixed length slot
Length = packet transit time, in each round• Whats the problem?• Unused slots wasted• Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle 1 3 4 1 3 4
6-slotframe
38
TDMA: Time Division Multiple Access
• Analogy• Take turns talking• Fix each person a time slot• All get a turn even when they have
nothing to say
• Our class – 5 slot limit
Marty, Laura Kevin Calvin Chris
Talks Silent Talks Silent Talks
Wasted two slots where others could have had useful things to say …
39
Channel Partitioning Protocols: FDMA
FDMA: frequency division multiple access
• Channel spectrum divided into frequency bands
• Each station assigned fixed frequency band
• Whats the problem? Some frequency bands are idle, limited
to your band• Example: 6-station LAN, 1,3,4 have pkt,
frequency bands 2,5,6 idle fre
qu
en
cy
ban
ds
time
FDM cable
Random Access Protocols
41
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 Medium Access Control protocol specifies• Key Problems• How to detect collisions• How to recover from collisions
• Examples• Slotted ALOHA• ALOHA• CSMA, CSMA/CD, CSMA/CA
Aloha Protocol
• Simple protocol developed by Norman Abramson and colleagues at University of Hawaii, in 1968• Used low-cost amateur radio-like systems to
create a computer network linking distributed campuses of the University
• Protocol allows every system to send a frame if its ready to send
• Based on a shared medium network• This was basis for Ethernet !!!!
Pure ALOHA
In pure ALOHA, frames are transmitted at completely arbitrary times.
44
Slotted ALOHAImprovement on Aloha
Assumptions• All frames same size• Time divided into equal size slots• Time to transmit 1 frame
• Nodes transmit only at slot beginning • Nodes are now synchronized• If 2 or more nodes transmit in slot, all
nodes detect collision
Slotted ALOHA
Operation• When node obtains fresh frame,
transmits in next slot• If no collision, node can send new
frame in next slot• If collision, node retransmits frame in
each subsequent slot with probability p until success• Probability is key and is between 0 and
1
46
Slotted ALOHA
• Probability is key • Probability p means each node
independently tosses a coin, heads or tails• P – says how likely it is node gets a head• Node transmits under this event
• (1-p) – is the probability of getting tail on a coin• Means node skips a slot and tosses again in next slot
Slotted Aloha C – collisionE – emptyS - Success
48
Slotted ALOHA
Pros• Single active node
can continuously transmit at full rate of channel
• Highly decentralized: Slots in nodes need to be in sync
• Simple
Cons• Collisions, wasting
slots• Idle slots• Nodes may be able
to detect collision in less than time to transmit packet
• Clock synchronization
C – collisionE – emptyS - Success
Takes 9 slots
49
Slotted Aloha efficiency
• Suppose: N nodes with many frames to send, each transmits in slot with probability p
• Probability that given node has success in a slot =
p(1-p)N-1
• Prob that any node has a success = Np(1-p)N-1
• Max efficiency: find p* that maximizes, successful nodesNp(1-p)N-1
• For many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity, gives:
Max efficiency = 1/e = .37
Whats the Efficiency of Aloha?Efficiency : long-run fraction of successful slots (many nodes, all with many frames to send)
At best: channelused for useful transmissions 37%of time!
!
Slotted ALOHA
Throughput versus offered traffic for ALOHA systems.
51
CSMA (Carrier Sense Multiple Access)
• Max throughput achievable by slotted ALOHA is 0.368.
• CSMA improved throughput compared to Aloha protocols.
• Big Improvement ....
• Listen before you speak!• Listens to the channel before
transmitting a packet (avoid avoidable collisions)
52
Assumptions with CSMA Networks
1. Constant length packets2. No errors, except those caused by collisions3. Each host can sense the transmissions of all
other hosts4. The propagation delay is small compared to
the transmission time
53
CSMA (Carrier Sense Multiple Access)
CSMA: Listen before transmit:
If channel sensed idle• Transmit entire frameIf channel sensed busy• Defer transmission • Human analogy: Don’t interrupt
others!
54
CSMA collisions
Collisions can still occur:propagation delay means two nodes may not heareach other’s transmission
Collision:entire packet transmission time wasted
spatial layout of nodes
55
CSMA/CD (Collision Detection)CSMA/CD: Carrier sensing, deferral as
in CSMA• Collisions detected within short time• Colliding transmissions aborted, reduces
channel wastage • Collision Detection• Easy in wired LANs• Measure signal strengths, compare
transmitted and received signals• Difficult in wireless LANs: received signal
strength overwhelmed by local transmission strength
56
CSMA/CD collision detection
57
CSMA/CD
• Sense the channel• If idle, transmit immediately• If busy, wait until the channel becomes idle
• Collision detection• Abort a transmission immediately if a collision
is detected• Try again later after waiting a random amount
of time
• Will revisit this later when we describe Ethernet ...
58
Taking Turns
59
“Taking Turns” MAC protocols
Polling: • Master node
“invites” slave nodes to transmit in turn
• Typically used with “dumb” slave devices
• Bluetooth uses polling
• Concerns:• Polling overhead • Latency• Single point of
failure (master)
master
slaves
poll
data
data
Token Passing Protocols
• Token Ring protocol was developed by IBM mid-1980s
• Access method involves token-passing• In Token Ring, computers are connected so that
signal travels around the network from one computer to another in a logical ring
• A single electronic token moves around ring from one computer to the next
• If computer does not have information to transmit, it simply passes the token on to the next workstation
• If computer wishes to transmit and receives an empty token, it attaches data to the token
Token Passing Protocols
• Token Ring protocol requires a star-wired ring using twisted pair or fiber optic cable
• It operates, transmission speeds of 4 Mbps or 16 Mbps
• Due to the increasing popularity of Ethernet,• Use of Token Ring in decreased dramatically
http://en.wikipedia.org/wiki/IBM_token_ring
62
“Taking Turns” MAC protocols
Token passing:• Control token
passed from one node to next sequentially.
• Token message• Concerns:• Token
overhead • Latency• Single point of
failure (token)
T
data
(nothingto send)
T
63
Summary of 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, IBM Token Ring
64
End