3rd Edition, Chapter 5

Download Report

Transcript 3rd Edition, Chapter 5

Chapter 5
Link Layer and LANs
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a lot of work on our part. In return for use, we only ask the
following:
 If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!)
 If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material.
Computer Networking:
A Top Down Approach
Featuring the Internet,
3rd edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2004.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2005
J.F Kurose and K.W. Ross, All Rights Reserved
5: DataLink Layer
5-1
Chapter 5: 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: done!
 instantiation and implementation of various link
layer technologies
5: DataLink Layer
5-2
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM and MPLS
5: DataLink Layer
5-3
Link Layer: Introduction
Some terminology:
“link”
 hosts and routers are nodes
 communication channels that
connect adjacent nodes along
communication path are links


wired links
wireless links
 layer-2 packet is a frame,
encapsulates datagram
data-link layer has responsibility of
transferring datagram from one node
to adjacent node over a link
5: DataLink Layer
5-4
Adaptors Communicating
datagram
sending
node
frame
frame
adapter
 link layer implemented in
“adaptor” (aka NIC)


RAM, DSP chips, host bus
interface, and link interface
Ethernet card, PCMCIA
card, 802.11 card
 sending side:


rcving
node
link layer protocol
encapsulates datagram in a
frame
adds error checking bits,
rdt, flow control, etc.
adapter
 receiving side


looks for errors, rdt, flow
control, etc
extracts datagram, passes to
rcving node
 adapter is semi-autonomous
 link & physical layers
5: DataLink Layer
5-5
Link layer
 Protocol stack picture
M
Ht M
Hn Ht M
Hl Hn Ht M
application
transport
network
link
physical
data link
protocol
phys. link
network
link
physical
Hl Hn Ht M
frame
adapter card
5: DataLink Layer
5-6
Link layer: context
 Datagram transferred by
different link protocols
over different links:

e.g., Ethernet on first link,
frame relay on
intermediate links, 802.11
on last link
 Each link protocol
provides different
services

e.g., may or may not
provide rdt over link
transportation analogy
 trip from Princeton to
Lausanne
 limo: Princeton to JFK
 plane: JFK to Geneva
 train: Geneva to Lausanne
 tourist = datagram
 transport segment =
communication link
 transportation mode =
link layer protocol
 travel agent = routing
algorithm
5: DataLink Layer
5-7
Link Layer Functions
 Framing
 encapsulate datagram into frame, adding header, trailer
 Medium access and quality of service
 channel access if shared medium
 Addressing
 “MAC” addresses used in frame headers to identify
source, dest
• different from IP address!
 Reliable delivery between adjacent nodes
 we learned how to do this already (chapter 3)!
 seldom used on low bit error link (i.e. fiber, some twisted
pair)
 wireless links: high error rates
• Q: why both link-level and end-end reliability?
5: DataLink Layer
5-8
Link Layer Functions (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
 Security
 Demux to upper protocol
5: DataLink Layer
5-9
Framing
 Data encapsulation for transmission over
physical link
 Data embedded within a link-layer frame
before transmission
 Data-link header and/or trailer added
 Physical addresses used in frame headers
to identify source and destination (not IP)
5: DataLink Layer
5-10
Fixed length framing
 Length delimited
 Beginning of frame has length
 Single corrupt length can cause problems
• Must have start of frame character to resynchronize
• Resynchronization can fail if start of frame character
is inside packets as well
5: DataLink Layer
5-11
Variable length framing
 Byte stuffing
 Special start of frame byte (e.g. 0xFF)
 Special escape byte value (e.g. 0xFE)
 Values actually in text are replaced (e.g. 0xFF
by 0xFEFF and 0xFE by 0xFEFE)
 Worst case – can double the size of frame
 Bit stuffing
 Special bit sequence (0x01111110)
 0 bit stuffed after any 11111 sequence
5: DataLink Layer
5-12
Clock-Based Framing
 Used by SONET
 Fixed size frames (810 bytes)
 Look for start of frame marker that
appears every 810 bytes
 Will eventually sync up
5: DataLink Layer
5-13
Demux to upper protocol
 Protocol type specification interfaces to
network layer
 Data-link layer can support any number of
network layers
 Type
field in data-link header specifies network
layer of packet
 Each data-link layer defines its own protocol
type numbering for network layer
 IP is one of many network layers
5: DataLink Layer
5-14
Demux to upper protocol
 http://www.cavebear.com/CaveBear/Ethernet/type.html
 Some Ethernet protocol types
–
–
–
–
–
0800 DOD Internet Protocol (IP)
0806 Address Resolution Protocol (ARP)
8037 IPX (Novell Netware)
80D5 IBM SNA Services
809B EtherTalk (AppleTalk over Ethernet)
5: DataLink Layer
5-15
Security
 Mainly for broadcast data-link layers
 Encrypt payload of higher layers
 Hide IP source/destination from eavesdroppers
 Important for wireless LANs especially
• Parking lot attacks
• 802.11b and WEP
 If time permits, security will be covered at
the end of the course….
5: DataLink Layer
5-16
Flow control
 Pacing between sender and receiver
 Sender prevented from overrunning
receiver
 Ready-To-Send, Clear-To-Send
5: DataLink Layer
5-17
Reliable delivery
 Reliability at the link layer
 Handled in a similar manner to transport
protocols

ARQ, Stop-and-wait, Go-back-N, Selective
Repeat
 When and why should this be used?
●
●
Rarely done over twisted-pair or fiber optic
links
Usually done over lossy links for performance
improvement (versus correctness)
5: DataLink Layer
5-18
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer
5-19
Error detection/correction
 Errors caused by signal attenuation, noise.
 Receiver detects presence of errors
 Possible actions
 Signal sender for retransmission
 Drops frame
 Correct bit errors if possible and continue
5: DataLink Layer
5-20
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
5: DataLink Layer
5-21
Parity Checking
Single Bit Parity:
Detect single bit errors
Two Dimensional Bit Parity:
Detect and correct single bit errors
0
0
5: DataLink Layer
5-22
Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)
Sender:
 treat segment contents
as sequence of 16-bit
integers
 checksum: addition (1’s
complement sum) of
segment contents
 sender puts checksum
value into UDP checksum
field
Receiver:
 compute checksum of received
segment
 check if computed checksum
equals checksum field value:
 NO - error detected
 YES - no error detected. But
maybe errors nonetheless?
More later ….
5: DataLink Layer
5-23
Cyclic Redundancy Check (CRC)
 Polynomial code
 Treat packet bits a coefficients of n-bit polynomial
 Choose r+1 bit generator polynomial G
• G well known – chosen in advance

Add r bits to packet so that message is divisible by G
• At receiver, divide payload by generator polynomial
• If result not zero, error detected
 Better loss detection properties than checksums
 All single bit errors, all double bit errors, all oddnumbered errors, burst errors less than r
 widely used in practice (ATM, HDCL, now in SCTP)
5: DataLink Layer
5-24
Cyclic Redundancy Check (CRC)
 Calculate code using modulo 2 division of
data by generator polynomial
Subtraction equivalent to XOR
 Weak definition of magnitude

• X >= Y iff position of highest 1 bit of X is the same or
greater than the highest 1 bit of Y
 Record remainder after division and send
after data
 Result divisible by generator polynomial
5: DataLink Layer
5-25
Cyclic Redundancy Check (CRC)
5: DataLink Layer
5-26
CRC example
Data:
101110
Generator
Polynomial:
x3 + 1 (1001)
Send:
101110011
5: DataLink Layer
5-27
CRC example
Data:
10000
Generator
Polynomial:
x2 + 1 (101)
Send:
1000001
G
101
101 1000000
101
010
000
100
101
010
000
100
101
01
D
R
5: DataLink Layer
5-28
Cyclic Redundancy Check (CRC)
 CRC-16 implementation
 Shift register and XOR gates
5: DataLink Layer
5-29
CRC polynomials
 CRC-16 = x16 + x15 + x2+ 1 (used in HDLC)
 CRC-CCITT = x16 + x12 + x5 + 1
 CRC-32 = x32 + x26 + x23 + x22 + x16 + x12 +
x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 (used
in Ethernet)
5: DataLink Layer
5-30
Forward error correction
 FEC
 Use error correcting codes to repair losses
 Add redundant information which allows
receiver to correct bit errors
 Suggest looking at information and coding
theory work.
5: DataLink Layer
5-31
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer
5-32
Multiple Access Protocols and QoS
 How and when can a node transmit?
 Directly controls per-hop quality-of-service
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
 802.11 wireless LAN
5: DataLink Layer
5-33
Media access problem
 Point-to-point link and switched media no problem
 Broadcast links?
 Network arbitration
 Give everyone a fixed time/freq slot?
• Ok for fixed bandwidth (e.g., voice)
• What if traffic is bursty?

Centralized arbiter
• Ex: cell phone base station
• Single point of failure

Distributed arbitration
• Aloha/Ethernet

Humans use multiple access protocols all the time
5: DataLink Layer
5-34
Multiple access protocols
 single shared communication 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 stations share
channel, i.e., determine when station can transmit
 communication about channel sharing uses channel itself!
 what to look for in multiple access protocols:
• synchronous or asynchronous
• information needed about other stations
• robustness (e.g., to channel errors)
• performance
5: DataLink Layer
5-35
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
5: DataLink Layer
5-36
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
 Nodes take turns, but nodes with more to send can take
longer turns
Goal: efficient, fair, simple, decentralized
5: DataLink Layer
5-37
Channel Partitioning MAC protocols: TDMA
TDMA: time division multiple access
 channel divided into N time slots, one per user


access to channel in "rounds"
inefficient with low duty cycle users and at light load
 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
5: DataLink Layer
5-38
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
frequency bands
bands 2,5,6 idle
5: DataLink Layer
5-39
Channel Partitioning MAC protocols
CDMA (Code Division Multiple Access)
 unique “code” assigned to each user; ie, code set partitioning
 used mostly in wireless broadcast channels (cellular,




satellite,etc)
each user has own “chipping” sequence (ie, 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”)
5: DataLink Layer
5-40
Channel Partitioning MAC protocols
 CDMA Encode/Decode
5: DataLink Layer
5-41
Channel Partitioning MAC protocols
 CDMA: two
sender
interference
5: DataLink Layer
5-42
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”,
 To avoid deterministic collisions: randomize
 random access MAC protocol specifies:
• how to detect collisions
• how to recover from collisions (e.g., via delayed
retransmissions)
• “Asynchronous” TDMA
 Examples of random access MAC protocols:
 slotted ALOHA
 ALOHA
 CSMA, CSMA/CD, CSMA/CA
5: DataLink Layer
5-43
Slotted ALOHA
Assumptions
 all frames same size
 time is divided into
equal size slots, time to
transmit 1 frame
 nodes start to transmit
frames only at
beginning of slots
 nodes are synchronized
 if 2 or more nodes
transmit in slot, all
nodes detect collision
Operation
 when node obtains fresh
frame, it transmits in next
slot
 no collision, node can send
new frame in next slot
 if collision, node
retransmits frame in each
subsequent slot with prob.
p until success
5: DataLink Layer
5-44
Slotted ALOHA
Pros
 single active node can
continuously transmit
at full rate of channel
 highly decentralized:
only 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
5: DataLink Layer
5-45
Slotted Aloha efficiency
Efficiency is the long-run
fraction of successful slots
when there are many nodes,
each with many frames to send
 Suppose N nodes with
many frames to send,
each transmits in slot
with probability p
 prob that node 1 has
success in a slot
= p(1-p)N-1
 prob that any node has
a success = Np(1-p)N-1
 For max efficiency
with N nodes, find p*
that maximizes
Np(1-p)N-1
 For many nodes, take
limit of Np*(1-p*)N-1
as N goes to infinity,
gives 1/e = .37
At best: channel
used for useful
transmissions 37%
of time!
5: DataLink Layer
5-46
Pure (unslotted) ALOHA
 unslotted Aloha: simpler, no synchronization
 when frame arrives
 Send without awaiting for beginning of slot
 collision probability increases:
 frame sent at t0 collides with other frames sent in [t0-1,t0+1]
5: DataLink Layer
5-47
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,p0+1]
= p . (1-p)(N-1) . (1-p) (N-1)
P(success by any of N nodes) = N p . (1-p) (N-1). (1-p) (N-1)
S = throughput = “goodput”
(success rate)
… choosing optimum p as n -> infty ... = 1/(2e) = .18
0.4
0.3
Slotted Aloha
0.2
0.1
Pure Aloha
0.5
1.0
1.5
2.0
G = offered load = Np
protocol constrains
effective channel
throughput!
5: DataLink Layer
5-48
CSMA (Carrier Sense Multiple Access)
CSMA: listen before transmit:
If channel sensed idle: transmit entire frame
 If channel sensed busy, defer transmission
 Persistent CSMA: retry immediately with
probability p when channel becomes idle
 Non-persistent CSMA: retry after random interval
 Human analogy: don’t interrupt others!
5: DataLink Layer
5-49
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
5: DataLink Layer
5-50
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
• Collisions detected within short time
• Abort transmission as soon as collision detected to reduce
channel waste
 human analogy: the polite conversationalist
5: DataLink Layer
5-51
CSMA/CD collision detection
5: DataLink Layer
5-52
CSMA/CD problems
 Can CSMA/CD work over wireless LANs
Collision detection difficult in wireless LANs:
receiver shut off while transmitting
 Hidden terminal problem

5: DataLink Layer
5-53
Hidden Terminal effect
 A, C cannot hear each other
obstacles, signal attenuation
 Neither A or C can tell if they collide at B

5: DataLink Layer
5-54
CSMA/CA
 Use base CSMA
 Add acknowledgements
 Receiver acknowledges receipt of data
 Avoids hidden terminal problem
 Avoid collisions explicitly via channel reservation
 Sender sends “request-to-send” (RTS) messages
• Transmitted without reservation using CSMA with ACKs

Receiver sends “clear-to-send” (CTS) messages
• Transmitted without reservation using CSMA with ACKs

Sender sends data packet using reservation
• Explicitly indicates length of so others know how long to back off
 Used in 802.11 wireless LAN networks
5: DataLink Layer
5-55
“Taking Turns” MAC protocols
Recall, 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!
5: DataLink Layer
5-56
“Taking Turns” MAC protocols
Token passing:
Polling:
 control token passed from
 master node
one node to next
“invites” slave nodes
sequentially.
to transmit in turn
 token message
 RTS, CTS messages
 concerns:
 concerns:



polling overhead
latency
single point of
failure (master)



token overhead
latency
single point of failure (token)
5: DataLink Layer
5-57
Taking-turns protocols
Distributed Polling:
 time divided into slots
 begins with N short reservation slots
reservation slot time equal to channel end-end
propagation delay
 station with message to send posts reservation
 reservation seen by all stations
 after reservation slots, message transmissions ordered
by known priority

5: DataLink Layer
5-58
Summary of MAC protocols
 What do you do with a shared media?

Channel Partitioning, by time, frequency or code
• Time 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
• CSMA/CA used in 802.11

Taking Turns
• polling from a central site, token passing
5: DataLink Layer
5-59
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer
5-60
MAC Addresses
 32-bit IP address:
 network-layer address
 used to route between networks to get datagram to
destination IP subnet
 MAC (or LAN or physical or Ethernet) address:
 used to get frame from one interface to another
physically-connected interface (same network)
 48 bit MAC address (for most LANs)
burned in the adapter ROM
• ifconfig –a
• arp -a
5: DataLink Layer
5-61
Physical addressing
 Why have separate IP and hardware
addresses?

Assign adapters an IP address
• Hardware only works for IP (no IPX, DECNET)
• Must be reconfigured when moved

Use hardware address as network address
• Need standardized fixed length hardware address
• No route aggregation
5: DataLink Layer
5-62
LAN Addresses and ARP
Each adapter on LAN has unique LAN address
1A-2F-BB-76-09-AD
71-65-F7-2B-08-53
LAN
(wired or
wireless)
Broadcast address =
FF-FF-FF-FF-FF-FF
= adapter
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
5: DataLink Layer
5-63
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 subnet to which node is attached
5: DataLink Layer
5-64
ARP: Address Resolution Protocol
Question: how to determine
MAC address of B
knowing B’s IP address?
237.196.7.78
1A-2F-BB-76-09-AD
237.196.7.23
 Each IP node (Host,
Router) on LAN has
ARP table
 ARP Table: IP/MAC
address mappings for
some LAN nodes
237.196.7.14

LAN
71-65-F7-2B-08-53
237.196.7.88
< IP address; MAC address; TTL>
58-23-D7-FA-20-B0
TTL (Time To Live): time
after which address
mapping will be forgotten
(typically 20 min)
0C-C4-11-6F-E3-98
5: DataLink Layer
5-65
ARP protocol: Same LAN (network)
 A knows B’s IP address and
wants to send datagram to
B, and B’s MAC address not
in A’s ARP table.
 A broadcasts ARP query
packet, containing B's IP
address
 Dest MAC address =
FF-FF-FF-FF-FF-FF
 all machines on LAN
receive ARP query
 B receives ARP packet,
replies to A with its (B's)
MAC address

frame sent to A’s MAC
address (unicast)
 A caches (saves) IP-to-
MAC address pair in its
ARP table until information
becomes old (times out)
 soft state: information
that times out (goes
away) unless refreshed
 ARP is “plug-and-play”:
 nodes create their ARP
tables without
intervention from net
administrator
5: DataLink Layer
5-66
Routing to another LAN
walkthrough: send datagram from A to B via R
assume A know’s B IP address
A
R
B
 Two ARP tables in router R, one for each IP
network (LAN)
5: DataLink Layer
5-67
 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 adapter sends frame
R’s adapter receives frame
R removes IP datagram from Ethernet frame, sees its
destined to B
R uses ARP to get B’s MAC address
R creates frame containing A-to-B IP datagram sends to B
A
R
B
5: DataLink Layer
5-68
RARP, BOOTP, DHCP
ARP: Given an IP address, return a hardware address
RARP: Given a hardware address, give me the IP
address
DHCP, BOOTP: Similar to RARP
Hosts (host portion):
 hard-coded by system admin in a file
 DHCP: Dynamic Host Configuration Protocol:
dynamically get address: “plug-and-play”
 host broadcasts “DHCP discover” msg
 DHCP server responds with “DHCP offer” msg
 host requests IP address: “DHCP request” msg
 DHCP server sends address: “DHCP ack” msg
5: DataLink Layer
5-69
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer
5-70
Specific data-link layers
 Specific data-link layers
 Ethernet (802.3)
 Token Ring (802.5)
 WiFi (802.11)
 X.25
 Frame relay
 Special link layers covered later (PPP, ATM)
5: DataLink Layer
5-71
Ethernet's implementation of
data-link layer
 Framing (special pre-amble within frame)
 Physical addressing (6 byte hardware addresses)
 Demux to upper protocol (type field in header)
 Flow control (none)
 Error detection and correction (CRC-32)
 Reliable delivery (none)
 Security (none)
 Media access and quality of service (CSMA/CD
with adaptive, randomized wait)
 Digital to analog conversion (Manchester encoding)
5: DataLink Layer
5-72
Ethernet
“dominant” wired LAN technology:





First practical local area network, built at Xerox PARC
in 70’s
cheap: $3 for 100Mbs NIC
first widely used LAN technology
Simpler, cheaper than token LANs and ATM
Kept up with speed race: 10 Mbps – 10 Gbps
Metcalfe’s Ethernet
sketch
5: DataLink Layer
5-73
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 II frame standard, some others….
 Original circa 1970 Xerox PARC
 IEEE 802.3 LLC frame
 IEEE 802.3 SNAP frame
 Novell Proprietary
 Not all compatible with each other
5: DataLink Layer
5-74
Ethernet Frame Structure (more)
 Addresses: 6 bytes



Globally unique, allocated to manufacturers
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 include Novell IPX and AppleTalk
 Data – 46 to 1500 bytes
 CRC: 4 bytes


checked at receiver, if error is detected, frame is dropped
CRC-32
• (x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1)
5: DataLink Layer
5-75
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
5: DataLink Layer
5-76
Ethernet uses CSMA/CD
 No slots
 adapter doesn’t transmit
if it senses that some
other adapter is
transmitting, that is,
carrier sense
 transmitting adapter
aborts when it senses
that another adapter is
transmitting, that is,
collision detection
 Before attempting a
retransmission,
adapter waits a
random time, that is,
random access
5: DataLink Layer
5-77
General Ethernet CSMA/CD
Packet?
No
Sense
Carrier
Send
Detect
Collision
Yes
Discard
Packet
attempts < 16
b=CalcBackoff();
wait(b);
attempts++;
attempts == 16
5: DataLink Layer
5-78
Ethernet CSMA/CD algorithm
1. Adaptor receives
4. If adapter detects
datagram from net layer &
another transmission while
creates frame
transmitting, aborts and
sends jam signal
2. If adapter senses channel
idle, it starts to transmit 5. After aborting, adapter
frame. If it senses
enters exponential
channel busy, waits until
backoff before returning
channel idle and then
to Step 2
transmits
3. If adapter transmits
entire frame without
detecting another
transmission, the adapter
is done with frame !
5: DataLink Layer 5-79
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all other transmitters are aware of
collision; 48 bits (more later)
Bit time: .1 microsec for 10 Mbps Ethernet ;
for K=1023, wait time is about 50 msec
Exponential backoff calculation: If deterministic delay after
collision, collision will occur again in lockstep

If random delay with fixed mean
• Few senders  needless waiting
• Too many senders  too many collisions

Exponentially increasing random delay
• Infer senders from # of collisions
• More senders  increase wait time
5: DataLink Layer
5-80
Ethernet’s CSMA/CD (more)
Exponential backoff calculation:
 Goal: adapt retransmission attempts to estimated current load

heavy load: random wait will be longer
 after the mth collision, adapter chooses a K at random from
{0,1,2,…,2m-1}. Adapter waits K·512 bit times



first collision: choose K from {0,1}; delay is K· 512 bit
transmission times
after second collision: choose K from {0,1,2,3}…
after ten collisions, choose K from {0,1,2,3,4,…,1023}
See/interact with Java
applet on AWL Web site:
highly recommended !
5: DataLink Layer
5-81
Ethernet: uses CSMA/CD
if packet
then {
A: sense channel
if idle
then {
transmit and monitor the channel;
}
}
if detect another transmission
then {
abort and send jam signal;
update # collisions;
delay as required by exponential backoff algorithm;
goto A
}
else {done with the frame; set collisions to zero}
else {wait until ongoing transmission is over and goto A}
5: DataLink Layer
5-82
Ethernet CSMA/CD and Packet Size
 What if two
people sent really
small packets
 How
do you find
collision?
 Must have a
minimum packet
size
5: DataLink Layer
5-83
Ethernet Collision Detect &
Packet Size
 Min packet length > 2x max prop delay
 If A, B are at opposite sides of link, and B
starts one link prop delay after A
 Jam signal
 Jam network for after collision, then stop
sending
 Ensures that everyone notices collision
5: DataLink Layer
5-84
Propagation delay & packet size
 Propagation delay determines min. packet
size to prevent undetected collisions
 Modern 10Mb Ethernet
 Minimum
packet size calculation
• 500m maximum segment length
• Can add repeaters up to a maximum 5 segments
(2500m)
• c in cable = 60% * c in vacuum = 1.8 x 10^8 m/s
• ~ 12.5us one-way delay
• Add repeater and tranceiver delay
• To be safe IEEE specifies a 512 “bit-time” slot for
Ethernet = 51.2us
• 512 bits = 64 bytes (data payload = 46 bytes)
5: DataLink Layer
5-85
Minimum packet size
 What about scaling? 100Mbit, 1Gbit...
 Make network smaller?
 Solution for 100BaseT
 Make min pkt size larger?
 512bits @ 1Gbps = 512ns
 512ns * 1.8 * 10^8 = 92meters
 Gigabit ethernet uses collision extension for
small pkts
5: DataLink Layer
5-86
10BaseT and 100BaseT
 10/100 Mbps rate; latter called “fast ethernet”
 T stands for Twisted Pair
 Nodes connect to a hub: “star topology”; 100 m
max distance between nodes and hub

Bus topology popular through mid 90s (10Base2, co-ax)
 Half-duplex
 Nodes at both ends of link can not transmit at same time
twisted pair
hub
5: DataLink Layer
5-87
10Base2 Ethernet
 Sifting through the jargon (10Base2)
 10:
10Mbps; 2: under 200 meters max cable
length
 thin coaxial cable in a bus topology
 repeaters used to connect up to multiple segments
 repeater repeats bits it hears on one interface to
DataLink Layer
its other interfaces: physical layer device5:only!
5-88
Gbit Ethernet
 uses standard Ethernet frame format
 allows for point-to-point links and shared
broadcast channels
 in shared mode, CSMA/CD is used; short distances
between nodes required for efficiency
 Full-Duplex at 1 Gbps for point-to-point links

Nodes can transmit and receive at 1Gbps simultaneously
 10 Gbps now !
5: DataLink Layer
5-89
Ethernet Problems
 Ethernet unstable at high loads
 Peak utilization = 1/e = 37%
 Peak throughput worse with
 More hosts – more collisions needed to identify
single sender
 Smaller packet sizes – more frequent
arbitration
 Longer links – collisions take longer to observe,
more wasted bandwidth
5: DataLink Layer
5-90
Token Rings
 Packets broadcast around ring
 Token “right to send” rotates around ring
 Fair, real-time bandwidth allocation
• Every host holds token for limited time
• Higher latency when only one sender
 Higher
bandwidth
• Point to point links electrically simpler than bus
5: DataLink Layer
5-91
Token Passing: IEEE802.5 standard
 4 Mbps
 max token holding time: 10 ms (limits frame
length)
• SD, ED mark start, end of packet
• AC: access control byte:
●
●
●
token bit: value 0 means token can be seized, value 1 means data
follows FC
priority bits: priority of packet
reservation bits: station can write these bits to prevent stations with
lower priority packet from seizing token after token becomes free
5: DataLink Layer
5-92
Why Did Ethernet Win?
 Better failure modes
 Token rings – network unusable
 Ethernet – node detached
 Good performance in common case
 Volume  lower cost  higher volume ….
 Adaptable
 To higher bandwidths (vs. FDDI)
 To switching (vs. ATM)
 Completely distributed, easy to
maintain/administer
 Easy incremental deployment
 Cheap cabling, etc
5: DataLink Layer
5-93
IEEE 802.11 Wireless LAN
 Wireless LANs: untethered (often mobile)
networking
 IEEE 802.11 standard:
 Defines
specific implementations of data-link
functions
 Framing, error detection, MAC, etc.
 Unlicensed frequency spectrum: 900Mhz, 2.4Ghz
• Organized into cells called
Basic Service Sets
●
●
●
Wireless hosts
Access Point (base station)
Combined to form distribution
system
5: DataLink Layer
5-94
Ad Hoc Networks
 Ad hoc network: IEEE 802.11 stations can
dynamically form network without AP
 Applications:
 “laptop” meeting in conference room, car
 interconnection of “personal” devices
 battlefield
 IETF MANET
(Mobile Ad hoc Networks)
working group
5: DataLink Layer
5-95
IEEE 802.11 MAC
 Allows for several modes
 CSMA
(with explicit ACK to indicate collision)
 CSMA/CA: reservations
 Polling from AP
5: DataLink Layer
5-96
IEEE 802.11 MAC Protocol: CSMA
802.11 CSMA sender
- if sense channel idle for DIFS sec.
then transmit entire frame (no collision
detection)
-if sense channel busy
then backoff (random, exponential)
802.11 CSMA receiver
if received OK
return ACK after SIFS
802.11 CSMA others
 NAV: Network Allocation Vector
 802.11 frame has transmission time
field
 others (hearing data) defer access for
NAV time units
SIFS and DIFS
 Used to separate and prioritize frames
 SIFS < DIFS allows acks to grab
channel with higher priority
5: DataLink Layer
5-97
IEEE 802.11 MAC Protocol
CSMA/CA
 Same as previous mode but with explicit channel reservation

Send short reservation messages via CSMA to reserve channel
• Sender RTS (request to send), Receiver CTS (clear to send)
• CTS notifies all hidden stations of sender's reservation
• Short messages so that collision less likely and of short duration

Send data unobstructed on reserved channel
• End result similar to CSMA/CD
5: DataLink Layer
5-98
X.25 and Frame Relay
Like ATM:
 wide area network technologies
 virtual circuit oriented
 origins in telephony world
 Not really a link layer but....
Viewed as link layers by IP protocol
 Used mostly to carry IP datagrams between IP
routers
 Going the way of the dinosaurs....

5: DataLink Layer
5-99
X.25
 X.25 builds VC between source and destination for each
user connection
 Per-hop control along path
 error control (with retransmissions) on each hop using
LAP-B
• variant of the HDLC protocol
• developed when bit error rates over long-haul copper
links were orders of magnitude higher
 per-hop flow control using credits
• congestion arising at intermediate node propagates
to previous node on path
• back to source via back pressure
5: DataLink Layer 5-100
IP versus X.25
 X.25: reliable in-sequence end-end delivery
from end-to-end
“intelligence in the network”
 built for dumb terminals accessing mainframes

 IP: unreliable, out-of-sequence end-end
delivery

“intelligence in the endpoints”
 2000
 gigabit routers: limited processing possible
 CPU capacity at end-hosts
 IP wins
5: DataLink Layer 5-101
Frame Relay
 Designed in late ‘80s, widely deployed in the ‘90s
 Second-generation X.25
 Frame relay service:
 no error control
 no flow control
 End-to-end congestion control
 Some QoS mechanisms
5: DataLink Layer 5-102
Frame Relay (more)
 Designed to interconnect corporate customer
LANs
typically permanent VC’s: “pipe” carrying
aggregate traffic between two routers
 switched VC’s: as in ATM

 corporate customer leases FR service from
public Frame Relay network (eg, Sprint, ATT)
5: DataLink Layer 5-103
Frame Relay (more)
flags
address
data
CRC
flags
 Flag bits, 01111110, delimit frame
 address:
10 bit VC ID field
 3 congestion control bits

• FECN: forward explicit congestion notification
(frame experienced congestion on path)
• BECN: congestion on reverse path
• DE: discard eligibility

Precursor to IP DiffServ and ECN
5: DataLink Layer 5-104
Frame Relay -VC Rate Control
 Committed Information Rate (CIR)



defined, “guaranteed” for each VC
negotiated at VC set up time
customer pays based on CIR
 DE bit: Discard Eligibility bit





Edge FR switch measures traffic rate for each VC; marks DE
bit
DE = 0: high priority, rate compliant frame; deliver at “all
costs”
DE = 1: low priority, eligible for discard when congestion
Precursor to IP DiffServ
Can be used to support higher layer QoS mechanisms
5: DataLink Layer 5-105
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Interconnections:
Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer 5-106
Link-layer devices
Q: Why not just one big LAN?
 Limited amount of supportable traffic: on
single LAN, all stations must share
bandwidth
 limited length: 802.3 specifies maximum
cable length
 large “collision domain” (can collide with
many stations)
 limited number of stations: 802.5 have
token passing delays at each station
5: DataLink Layer 5-107
Hubs
Hubs are essentially physical-layer, multi-port repeaters:
 bits coming from one link go out all other links
 at the same rate
 no frame buffering
 no CSMA/CD at hub: adapters detect collisions
 provides net management functionality
twisted pair
hub
5: DataLink Layer 5-108
Hubs (more)
 Hubs do not isolate collision domains: node
may collide with any node residing at any
segment in LAN
 Hub Advantages:
 simple,
inexpensive device
 extends maximum distance between node pairs
 Multi-tier provides graceful degradation:
portions of the LAN continue to operate if one
hub malfunctions
5: DataLink Layer 5-109
Interconnecting with hubs
 Backbone hub interconnects LAN segments
 Extends max distance between nodes
 But individual segment collision domains become one
large collision domain


single collision domain results in no increase in max throughput
multi-tier throughput same as single segment throughput
 Can’t interconnect 10BaseT & 100BaseT
hub
hub
hub
hub
5: DataLink Layer
5-110
Switches
 Link Layer device
 Stores and forwards Ethernet frames
 Examines frame header and selectively forwards frame
based on destination MAC address
 Two-port switch known as a “bridge”
 Switches known as “multi-port” bridges
 A switch isolates collision domains since it buffers
frames
 When frame is to be forwarded on segment,
bridge uses CSMA/CD to access segment and
transmit


Transparent to hosts
Plug-and-play, self-learning (do not need to be
configured)
5: DataLink Layer
5-111
Switches (more)
 Switch advantages:
 Isolates collision domains resulting in higher
total max throughput, and does not limit the
number of nodes nor geographical coverage


Can connect different type Ethernet since it is
a store and forward device
Transparent: no need for any change to hosts
LAN adapters
5: DataLink Layer
5-112
Switch operation
switch
1
2
hub
3
hub
hub
 How do determine onto which LAN segment
to forward frame?

Looks like a routing problem...
5: DataLink Layer
5-113
Self learning
 Approach
 Monitor traffic to build a cache of which nodes are
downstream of which ports
 Selectively forward frames based on cache entries
 Flood network for frames with unknown (MAC)
destinations
 Algorithm
 Each switch has a switch table
 entry in switch table:
• (MAC Address, Interface, Time Stamp)
• stale entries in table dropped (TTL can be 60 min)

switch learns which hosts can be reached through which
interfaces
• when frame received, switch “learns” location of sender:
incoming LAN segment
5: DataLink Layer
• records sender/location pair in switch table
5-114
Filtering/Forwarding
When switch receives a frame:
index switch table using MAC dest address
if entry found for destination
then{
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood
forward on all but the interface
on which the frame arrived
5: DataLink Layer
5-115
Switch example
Suppose C sends frame to D
1
B
C
A
B
E
G
3
2
hub
hub
hub
A
address interface
switch
1
1
2
3
I
D
E
F
G
H
 Switch receives frame from from C
 notes in bridge table that C is on interface 1
 because D is not in table, switch forwards frame into
interfaces 2 and 3
 frame received by D
5: DataLink Layer
5-116
Switch example
Suppose D replies back with frame to C.
address interface
switch
B
C
hub
hub
hub
A
I
D
E
F
G
A
B
E
G
C
1
1
2
3
1
H
 Switch receives frame from from D
 notes in bridge table that D is on interface 2
 because C is in table, switch forwards frame only to
interface 1
 frame received by C
5: DataLink Layer
5-117
Switch: traffic isolation
 switch installation breaks subnet into LAN
segments
 switch filters packets:
 same-LAN-segment frames not usually
forwarded onto other LAN segments
 segments become separate collision domains
switch
collision
domain
hub
collision domain
hub
collision domain
hub
5: DataLink Layer
5-118
Switches: dedicated access
 Switch with many interfaces
A
 Hosts have direct connection to
switch
 No collisions; full duplex
 Much greater aggregate
bandwidth

Data backplane of switches
typically large to support
simultaneous transfers amongst
ports
Switching: A-to-A’ and B-to-B’
simultaneously, no collisions
C’
B
switch
C
B’
A’
5: DataLink Layer
5-119
Switches and Spanning Trees
 for increased reliability, desirable to have
redundant, alternate paths from source to
destination
 with multiple simultaneous paths, cycles result bridges may multiply and forward frame forever
 solution: organize switches in a spanning tree by
disabling subset of interfaces
Disabled
switch
switch
5: DataLink Layer 5-120
Switches vs. Routers
 both store-and-forward devices
 routers: network layer devices (examine network layer
headers)
 switches/bridges are link Layer devices
 routers maintain routing tables, implement routing
algorithms
 swtiches maintain filtering tables, implement
filtering, learning and spanning tree algorithms
 why can't the Internet be one great big switch?
5: DataLink Layer 5-121
Routers vs. Switches
Switches + and + Switch operation is simpler requiring less processing
bandwidth
- Topologies are restricted with switches: a spanning tree must
be built to avoid cycles
- Switches do not offer protection from broadcast storms
(endless broadcasting by a host will be forwarded by a
switch)
5: DataLink Layer 5-122
Routers vs. Switches
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 processing bandwidth
 switches do well in small (few hundred hosts) while
routers used in large networks (thousands of hosts)
5: DataLink Layer 5-123
Summary comparison
hubs
routers
switches
traffic
isolation
no
yes
yes
plug & play
yes
no
yes
optimal
routing
cut
through
no
yes
no
yes
no
yes
5: DataLink Layer 5-124
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM
5: DataLink Layer 5-125
Point to Point Data Link Control
 Point-to-point links


One sender, one receiver, one link
Easier than shared broadcast links
• No media access control
• No need for explicit MAC addressing (ie ARP)
 Goal of Point-to-Point protocols

Layer generic “higher-level” data-link layer functions on top of
a variety of point-to-point links
• Dial-up phone line, DSL, ISDN etc.
• Each different link does its own digital-analog conversion (ie
provides bits)
• Implement pseudo-link layer on top that implements common
functions
– Framing, Demux to upper layer, etc.
 Examples


PPP (point-to-point protocol)
HDLC: High level data link control (Data link used to be
considered “high layer” in protocol stack!)
5: DataLink Layer 5-126
PPP Design Requirements [RFC 1557]
 packet framing: encapsulation of network-layer





datagram in data link frame
 carry network layer data of any network layer
protocol (not just IP) at same time
demultiplex upwards
bit transparency: must carry any bit pattern in the
data field
error detection (no correction)
connection liveness: detect, signal link failure to
network layer
network layer address negotiation: endpoint can
learn/configure each other’s network address
5: DataLink Layer 5-127
PPP non-requirements
 no error correction/recovery
 no flow control
 out of order delivery OK
 no need to support multipoint links (e.g., polling)
Error recovery, flow control, data re-ordering
all relegated to higher layers!
5: DataLink Layer 5-128
PPP Data Frame
 Flag: delimiter (framing)
 Address: does nothing (only one option)
 Control: does nothing; in the future possible
multiple control fields
 Protocol: upper layer protocol to which frame
delivered (eg, PPP-LCP, IP, IPCP, etc)
5: DataLink Layer 5-129
PPP Data Frame
 info: upper layer data being carried
 check: cyclic redundancy check for error
detection
5: DataLink Layer 5-130
Byte Stuffing
 “data transparency” requirement: data field must
be allowed to include flag pattern <01111110>
 Q: is received <01111110> data or flag?
 Sender: adds (“stuffs”) extra < 01111101> byte
before each < 01111110> data byte
 Receiver:
 two 01111101 byte followed by 01111110 byte:
discard first byte, continue data reception
 single 01111110: flag byte
5: DataLink Layer 5-131
Byte Stuffing
flag byte
pattern
in data
to send
flag byte pattern plus
stuffed byte in
transmitted data
5: DataLink Layer 5-132
PPP Data Control Protocol
Before exchanging networklayer data, data link peers
must
 configure PPP link (max.
frame length,
authentication)
 learn/configure network
layer information
 for IP: carry IP Control
Protocol (IPCP) msgs
(protocol field: 8021) to
configure/learn IP
address
5: DataLink Layer 5-133
Link Layer
 5.1 Introduction and




services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet and
other data link layers
 5.6 Hubs and switches
 5.7 PPP
 5.8 Link Virtualization:
ATM and MPLS
5: DataLink Layer 5-134
Virtualization of networks
Virtualization of resources: a powerful abstraction in
systems engineering:
 computing examples: virtual memory, virtual
devices
 Virtual machines: e.g., java
 IBM VM os from 1960’s/70’s
 layering of abstractions: don’t sweat the details of
the lower layer, only deal with lower layers
abstractly
5: DataLink Layer 5-135
The Internet: virtualizing networks
1974: multiple unconnected
nets
 ARPAnet
 data-over-cable
networks
 packet satellite network (Aloha)
 packet radio network
ARPAnet
"A Protocol for Packet Network Intercommunication",
V. Cerf, R. Kahn, IEEE Transactions on Communications,
May, 1974, pp. 637-648.
… differing in:
 addressing
conventions
 packet formats
 error recovery
 routing
satellite net
5: DataLink Layer 5-136
The Internet: virtualizing networks
Internetwork layer (IP):
 addressing: internetwork
appears as a single, uniform
entity, despite underlying local
network heterogeneity
 network of networks
Gateway:
 “embed internetwork packets in
local packet format or extract
them”
 route (at internetwork level) to
next gateway
gateway
ARPAnet
satellite net
5: DataLink Layer 5-137
Cerf & Kahn’s Internetwork Architecture
What is virtualized?
 two layers of addressing: internetwork and local
network
 new layer (IP) makes everything homogeneous at
internetwork layer
 underlying local network technology
 cable
 satellite
 56K telephone modem
 today: ATM, MPLS
… “invisible” at internetwork layer. Looks like a link
layer technology to IP!
5: DataLink Layer 5-138
Virtual links and tunneling
 Many options of encapsulating or tunneling
packets through a “virtual link” (VPN)

Generic Routing Encapsulation (GRE)
• PPTP (Point-to-point Tunneling Protocol)
• L2F (Layer 2 Forwarding)
• L2TP (Layer 2 Tunneling Protocol)

Example
• Encrypt data at a layer below network layer
• IPsec only works for IP packets
• Allows encryption at data-link layer
 Can also be done at network layer via IPsec
5: DataLink Layer 5-139
ATM and MPLS
 ATM, MPLS separate networks in their own
right

different service models, addressing, routing
from Internet
 viewed by Internet as logical link connecting
IP routers

just like dialup link is really part of separate
network (telephone network)
5: DataLink Layer 5-140
Multiprotocol label switching (MPLS)
 initial goal: speed up IP forwarding by using fixed
length label (instead of IP address) to do
forwarding


borrowing ideas from Virtual Circuit (VC) approach
but IP datagram still keeps IP address!
PPP or Ethernet
header
MPLS header
label
20
IP header
remainder of link-layer frame
Exp S TTL
3
1
5
5: DataLink Layer 5-141
MPLS capable routers
 a.k.a. label-switched router
 forwards packets to outgoing interface based
only on label value (don’t inspect IP address)

MPLS forwarding table distinct from IP forwarding
tables
 signaling protocol needed to set up forwarding
 RSVP-TE
 forwarding possible along paths that IP alone would
not allow (e.g., source-specific routing) !!
 use MPLS for traffic engineering
 must co-exist with IP-only routers
5: DataLink Layer 5-142
MPLS forwarding tables
in
label
out
label dest
10
12
8
out
interface
A
D
A
0
0
1
in
label
out
label dest
out
interface
10
6
A
1
12
9
D
0
R6
0
0
D
1
1
R3
R4
R5
0
0
R2
in
label
8
out
label dest
6
A
out
interface
in
label
6
outR1
label dest
-
A
A
out
interface
0
0
5: DataLink Layer 5-143
Chapter 5: Summary
 principles behind data link layer services:
 error detection, correction
 sharing a broadcast channel: multiple access
 link layer addressing
 instantiation and implementation of various link
layer technologies
 Ethernet
 switched LANS
 PPP
 virtualized networks as a link layer: ATM, MPLS
5: DataLink Layer 5-144
Physical Layer
 Plethora of physical media
 Fiber, copper, air
 Specifies the characteristics of transmission
media
 Too many to cover in detail, not the focus of the
course
 Many data-link layer protocols (i.e. Ethernet,
Token-Ring, FDDI. ATM run across multiple
physical layers)
 Physical characteristics dictate suitability of
data-link layer protocol and bandwidth limits
5: DataLink Layer 5-145
Digital to analog conversion
 Bits sent as analog signals
 Photonic pulses of a given wavelength over
optical fiber
 Electronic signals of a given voltage
5: DataLink Layer 5-146
Digital to analog conversion
 Will cover electronic transmission (optical
transmission left for you to research)
 Biggest issue
 When
to sample voltage?
 Detecting sequences involves clocking with the
same clock
• How to synchronize sender and receiver clocks?
 Need
easily detectible event at both ends
• Signal transitions help resync sender and receiver
• Need frequent transitions to prevent clock skew
 http://www.mouse.demon.nl/ckp/telco/encode.h
tm
5: DataLink Layer 5-147
RZ
 Return to Zero (RZ)
 1=pulse to high, dropping back to low
 0=no transition
5: DataLink Layer 5-148
NRZ-L
 Non-Return to Zero Level (NRZ-L)
 1=high signal, 0=lower signal
 Long sequence of same bit causes difficulty
• DC bias hard to detect – low and high detected by
difference from average voltage
• Clock recovery difficult
 Used
by Synchronous Optical Network
(SONET)
• SONET XOR’s bit sequence to ensure frequent
transitions
 Used
in early magnetic tape storage
5: DataLink Layer 5-149
NRZ-L
5: DataLink Layer 5-150
NRZ-M
 Non-Return to Zero Mark
 Less power to transmit versus NRZ
 1=signal transition at start of bit, 0=no change
 No problem with string of 1’s
 NRZ-like problem with string of 0’s
 Used in SDLC (Synchronous Data Link Control)
 Used in modern magnetic tape storage
5: DataLink Layer 5-151
NRZ-S
 Non-Return to Zero Space
 1=no change, 0=signal transition at start of bit
 No problem with string of 0’s
 NRZ-like problem with string of 1’s
5: DataLink Layer 5-152
Manchester (Bi-Phase-Level)
coding
 Used by Ethernet
 0=low to high transition, 1=high to low
transition
 Transition for every bit simplifies clock
recovery
 Not very efficient
 Doubles
the number of transitions
 Circuitry must run twice as fast
5: DataLink Layer 5-153
Manchester coding
 Encoding for 110100
Bit stream
1
1
0
1
0
0
Manchester encoding
5: DataLink Layer 5-154
Other coding schemes
 Bi-Phase-Mark, Bi-Phase-Space
 Level change at every bit period boundary
 Mid-period transition determines bit
• Bi-Phase-M: 0=no change, 1=signal transition
• Bi-Phase-S: 0=signal transition, 1=no change
5: DataLink Layer 5-155
Other coding schemes
 Differential Bi-Phase-Space, Differential
Bi-Phase-Mark
 Level
change at every mid-bit period boundary
 Bit period boundary transition determines bit
• Diff-Bi-Phase-M: 0=signal transition, 1=no change
• Diff-Bi-Phase-S: 0=no change, 1=signal transition
5: DataLink Layer 5-156
Common Cabling
 Copper

Twisted Pair
• Unshielded (UTP)
– CAT-1, CAT-2, CAT-3, CAT-4, CAT-5, CAT-5e
• Shielded (STP)

Coaxial Cable
 Fiber
 Single-mode
 Multi-mode
5: DataLink Layer 5-157
Twisted Pair
 Most common LAN interconnection
 Multiple pairs of twisted wires
 Twisting to eliminate interference
 More twisting = Higher data rates, higher cost
 Standards specify twisting, resistance, and
maximum cable length for use with
particular data-link layer
5: DataLink Layer 5-158
Twisted pair
 5 categories
 Category 1
• Voice only (telephone wire)

Category 2
• Data to 4Mbs (LocalTalk)

Category 3
• Data to 10Mbs (Ethernet)

Category 4
• Data to 20Mbs (16Mbs Token Ring)

Category 5 (100 MHz)
• Data to 100Mbs (Fast Ethernet)

Category 5e (350 MHz)
• Data to 1000Mbs (Gigabit Ethernet)
5: DataLink Layer 5-159
Twisted Pair
 Common connectors for Twisted Pair
RJ11 (3 pairs)
 RJ45 (4 pairs)

• Allows both data and phone connections
• (1,2) and (3,6) for data, (4,5) for voice
• Crossover cables for NIC-NIC, Hub-Hub connection
(Data pairs swapped)
5: DataLink Layer 5-160
UTP
 Unshielded Twisted Pair
Limited amount of protection from
interference
 Commonly used for voice and ethernet

• Voice: multipair 100-ohm UTP
5: DataLink Layer 5-161
STP
 Shielded Twisted Pair
Not as common at UTP
 UTP susceptible to radio and electrical
interference
 Extra shielding material added
 Cables heavier, bulkier, and more costly
 Often used in token ring topologies

• 150 ohm STP two pair (IEEE 802.5 Token Ring)
5: DataLink Layer 5-162
Coaxial cable
 Single copper conductor at center
 Plastic insulation layer
 Highly resistant to interference
 Braided metal shield
 Support longer connectivity distances over UTP
5: DataLink Layer 5-163
Coaxial cable
 Thick (10Base5)
Large diameter 50-ohm cable
 N connectors

 Thin (10Base2) cables
 Small diameter 50-ohm cable
 BNC, RJ-58 connector
 Video cable
 75-ohm
cable
 BNC, RJ-59 connector
 Not compatible with RJ-58
5: DataLink Layer 5-164
Fiber
 Center core made of glass or plastic fiber
 Transmit light versus electronic signals
 Protects from electronic interference,
moisture
 Plastic coating to cushion core
 Kevlar fiber for strength
 Teflon or PVC outer insulating jacket
5: DataLink Layer 5-165
Fiber
 Single-mode fiber
 Smaller diameter (12.5 microns)
 One mode only
 Preserves signal better over longer distances
 Typically used for SONET or SDH
 Lasers used to signal
 More expensive
 Multi-mode fiber
 Larger diameter (62.5 microns)
 Multiple modes
 LEDs used to signal
 WDM and DWDM
 Photodiodes at receivers
5: DataLink Layer 5-166
Fiber connectors
 ESCON
 Duplex SC
 ST
 MT-RJ (multimode)
 Duplex LC
5: DataLink Layer 5-167
Physical-link lingo
 Specifies capacities over physical media
 Electronic
 T1/DS1=1.54 Mbps
 T3/DS3=45Mbps
 Optical (OC=optical carrier)
 OC1=52 Mbps
 OC3/STM1=156 Mbps
 OC12=622 Mbps
 OC48=2488 Mbps
 OC192=10 Gbps
 OC768=40 Gbps
5: DataLink Layer 5-168
Wireless
 Entire spectrum of transmission frequency ranges
 Radio
 Infrared
 Lasers
 Cellular telephone
 Microwave
 Satellite
 Acoustic (see ESE sensors)
 Ultra-wide band
 http://www.ntia.doc.gov/osmhome/allochrt.html
5: DataLink Layer 5-169
5: DataLink Layer 5-170
What runs on them?
Protocol Summary
Protocol
Cable
Speed
Topology
Ethernet
Twisted Pair, Coaxial, Fiber
10 Mbps
Linear Bus, Star, Tree
Fast Ethernet
Twisted Pair, Fiber
100 Mbps
Star
LocalTalk
Twisted Pair
.23 Mbps
Linear Bus or Star
Token Ring
Twisted Pair
4 Mbps - 16 Mbps
Star-Wired Ring
FDDI
Fiber
100 Mbps
Dual ring
ATM
Twisted Pair, Fiber
155-2488 Mbps
Linear Bus, Star, Tree
5: DataLink Layer 5-171
Extra slides
5: DataLink Layer 5-172
DL: ARQ
 Automatic Repeat Request (ARQ)
 Receiver sends acknowledgement (ACK) when it
receives packet
 Sender waits for ACK and timeouts if it does
not arrive within some time period
5: DataLink Layer 5-173
DL: Stop and Wait
Sender
Time
Receiver
Timeout
• Simplest ARQ
protocol
• Send a packet, stop
and wait until
acknowledgement
arrives
5: DataLink Layer 5-174
ACK lost
Timeout
Timeout
Timeout
Timeout
Timeout
Time
Timeout
DL: Recovering from Error
Packet lost
Early timeout
5: DataLink Layer 5-175
DL: Stop and Wait Problems
 How to recognize a duplicate?
 Performance
 Can only send one packet per round trip
5: DataLink Layer 5-176
DL: How to Recognize Resends?
• Use sequence numbers
– both packets and acks
• Sequence # in packet is finite
-- how big should it be?
– For stop and wait?
• One bit – won’t send seq #1
until received ACK for seq
#0
5: DataLink Layer 5-177
DL: How to Keep the Pipe Full?
 Send multiple packets without
waiting for first to be acked

Number of pkts in flight = window
 How large a window is needed

Round trip delay * bandwidth =
capacity of pipe
 Reliable, unordered delivery




Several parallel stop & waits
Send new packet after each ack
Sender keeps list of unack’ed packets;
resends after timeout
Receiver same as stop&wait
5: DataLink Layer 5-178
DL: Sliding Window
 Reliable, ordered delivery
 Receiver has to hold onto a packet until all
prior packets have arrived
 Sender must prevent buffer overflow at
receiver
 Circular buffer at sender and receiver
 Packets
in transit <= buffer size
 Advance when sender and receiver agree
packets at beginning have been received
5: DataLink Layer 5-179
DL: Sender/Receiver State
Sender
Max ACK received
Receiver
Next expected
Next seqnum
…
…
…
…
Sender window
Sent & Acked
Sent Not Acked
OK to Send
Not Usable
Max acceptable
Receiver window
Received & Acked
Acceptable Packet
Not Usable
5: DataLink Layer 5-180
DL: Window Sliding – Common
Case
 On reception of new ACK (i.e. ACK for
something that was not acked earlier
 Increase
sequence of max ACK received
 Send next packet
 On reception of new in-order data packet (next
expected)
 Hand
packet to application
 Send cumulative ACK – acknowledges reception of all
packets up to sequence number
 Increase sequence of max acceptable packet
5: DataLink Layer 5-181
DL: Loss Recovery
 On reception of out-of-order packet
 Send nothing (wait for source to timeout)
 Cumulative ACK (helps source identify loss)
 Timeout (Go Back N recovery)
 Set timer upon transmission of packet
 Retransmit max ACK received sequence + 1
 Restart from max ACK received sequence + 1
 Performance during loss recovery
 No longer have an entire window in transit
 Can have much more clever loss recovery
• Covered in TCP lectures
5: DataLink Layer 5-182
DL: Sequence Numbers
 How large do sequence numbers need to
be?
 Must
be able to detect wrap-around
 Depends on sender/receiver window size
 E.g.
 Max seq = 7, send win=recv win=7
 If pkts 0..6 are sent succesfully and all acks
lost
• Receiver expects 7,0..5, sender retransmits old 0..6
 Max sequence must be >= send window +
recv window
5: DataLink Layer 5-183
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, HDCL)
5: DataLink Layer 5-184
Manchester encoding
 Used in 10BaseT
 Each bit has a transition
 Allows clocks in sending and receiving nodes to
synchronize to each other

no need for a centralized, global clock among nodes!
 Hey, this is physical-layer stuff!
 More later
5: DataLink Layer 5-185
Backbone Bridge
5: DataLink Layer 5-186
Interconnection Without
Backbone
 Not recommended for two reasons:
 - single point of failure at Computer Science
hub
 - all traffic between EE and SE must path over
CS segment
5: DataLink Layer 5-187
CSMA/CD efficiency
 Tprop = max prop between 2 nodes in LAN
 ttrans = time to transmit max-size frame
efficiency 
1
1  5t prop / ttrans
 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
5: DataLink Layer 5-188
More on Switches
 cut-through switching: frame forwarded
from input to output port without first
collecting entire frame
 slight reduction in latency
 combinations of shared/dedicated,
10/100/1000 Mbps interfaces
5: DataLink Layer 5-189
Institutional network
to external
network
mail server
web server
router
switch
IP subnet
hub
hub
hub
5: DataLink Layer 5-190
ATM
 ATM
Replace existing Internet protocols with a more
“robust” architecture
 Network architecture to support

• Multiple service classes and per-flow guarantees
• Virtual circuits to support real-time applications
• Explicit rate signaling and resource allocation
 Covered as a data-link layer…
5: DataLink Layer 5-191
Internet vs. ATM
 Internet



“elastic” datagram service,
no strict timing req.
Computer communication
only
“smart” end systems
(computers)
• can adapt, perform
control, error recovery
• simple inside network,
complexity at “edge”

many link types
• different characteristics
• uniform service difficult
 ATM
 evolved from telephony,
strict timing and
reliability requirements
 Computer and human
communication
• need for guaranteed
service

“dumb” end systems
• telephones
• complexity inside
network
5: DataLink Layer 5-192
Asynchronous Transfer Mode (ATM)
 1980s/1990’s standard for high-speed (155Mbps to 622 Mbps and
higher) Broadband Integrated Service Digital Network architecture
 Take strengths of IP, learn from its shortcomings




Packet switching good
Packet switching without explicit network-level connections and
reservations bad
Packet switching using large headers for small packets bad (voice)
Design new network to address emerging applications while allowing for
efficient support for non-real-time data applications
 Goal: integrated, end-end transport of carry voice, video, data
meeting timing/QoS requirements of voice, video (versus
Internet best-effort model)
 “next generation” telephony: technical roots in telephone world
 packet-switching (fixed length packets, called “cells”) using
virtual circuits
 Covered now since it is used mostly as a data-link layer

5: DataLink Layer 5-193
ATM architecture
 adaptation layer: only at edge of ATM network
data segmentation/reassembly
 roughly analagous to Internet transport layer
 ATM layer: “network” layer
 cell switching, routing
 physical layer

5: DataLink Layer 5-194
ATM: network or link layer?
Vision: end-to-end
transport: “ATM from
desktop to desktop”
 ATM is a network
technology
Reality: used to connect
IP backbone routers
 “IP over ATM”
 ATM as switched
link layer,
connecting IP
routers
IP
network
ATM
network
5: DataLink Layer 5-195
ATM Adaptation Layer (AAL)
 ATM Adaptation Layer (AAL): “adapts” upper
layers (IP or native ATM applications) to ATM
layer below
 AAL present only in end systems, not in switches
 AAL layer segment (header/trailer fields, data)
fragmented across multiple ATM cells
 analogy: TCP segment in many IP packets
5: DataLink Layer 5-196
ATM Adaptation Layer (AAL) [more]
Different versions of AAL layers, depending on ATM
service class:
 AAL1: for CBR (Constant Bit Rate) services, e.g. circuit emulation
 AAL2: for VBR (Variable Bit Rate) services, e.g., MPEG video
 AAL5: for data (eg, IP datagrams)
User data
AAL PDU
ATM cell
5: DataLink Layer 5-197
ATM Layer
Service: transport cells across ATM network
 analogous to IP network layer
 very different services than IP network layer
Network
Architecture
Internet
Service
Model
Guarantees ?
Congestion
Bandwidth Loss Order Timing feedback
best effort none
ATM
CBR
ATM
VBR
ATM
ABR
ATM
UBR
constant
rate
guaranteed
rate
guaranteed
minimum
none
no
no
no
yes
yes
yes
yes
yes
yes
no
yes
no
no (inferred
via loss)
no
congestion
no
congestion
yes
no
yes
no
no
5: DataLink Layer 5-198
ATM Layer: Virtual Circuits
 VC transport: cells carried on VC from source to dest
 call setup, teardown for each call before data can flow
 each packet carries VC identifier (not destination ID)
 every switch on source-dest path maintain “state” for each
passing connection
 link,switch resources (bandwidth, buffers) may be allocated to
VC: to get circuit-like perf.
 Permanent VCs (PVCs)
long lasting connections
 typically: “permanent” route between to IP routers
 Switched VCs (SVC):
 dynamically set up on per-call basis

5: DataLink Layer 5-199
ATM VCs
 Advantages of ATM VC approach:
QoS performance guarantee for connection
mapped to VC (bandwidth, delay, delay jitter)
 Drawbacks of ATM VC approach:
 Inefficient support of datagram traffic
 one PVC between each source/dest pair) does
not scale (N*2 connections needed)
 SVC introduces call setup latency, processing
overhead for short lived connections

5: DataLink Layer 5-200
ATM Layer: ATM cell
 5-byte ATM cell header
 48-byte payload
Why?: small payload -> short cell-creation delay
for digitized voice
 halfway between 32 and 64 (compromise!)

Cell header
Cell format
5: DataLink Layer 5-201
ATM cell header
 VCI: virtual channel ID
will change from link to link thru net
 PT: Payload type (e.g. RM cell versus data cell)
 CLP: Cell Loss Priority bit
 CLP = 1 implies low priority cell, can be
discarded if congestion
 HEC: Header Error Checksum
 cyclic redundancy check

5: DataLink Layer 5-202
ATM Physical Layer (more)
Two pieces (sublayers) of physical layer:
 Transmission Convergence Sublayer (TCS): adapts
ATM layer above to PMD sublayer below
 Physical Medium Dependent: depends on physical
medium being used
TCS Functions:
 Header checksum generation: 8 bits CRC
 Cell delineation
 With “unstructured” PMD sublayer, transmission
of idle cells when no data cells to send
5: DataLink Layer 5-203
ATM Physical Layer
Physical Medium Dependent (PMD) sublayer
 SONET/SDH: transmission frame structure (like a
container carrying bits);
 bit synchronization;
 bandwidth partitions (TDM);
 several speeds: OC3 = 155.52 Mbps; OC12 = 622.08
Mbps; OC48 = 2.45 Gbps, OC192 = 9.6 Gbps
 TI/T3: transmission frame structure (old
telephone hierarchy): 1.5 Mbps/ 45 Mbps
 unstructured: just cells (busy/idle)
5: DataLink Layer 5-204
IP-Over-ATM
Classic IP only
 3 “networks” (e.g.,
LAN segments)
 MAC (802.3) and IP
addresses
IP over ATM
 replace “network”
(e.g., LAN segment)
with ATM network
 ATM addresses, IP
addresses
ATM
network
Ethernet
LANs
Ethernet
LANs
5: DataLink Layer 5-205
IP-Over-ATM
app
transport
IP
Eth
phy
IP
AAL
Eth
ATM
phy phy
ATM
phy
ATM
phy
app
transport
IP
AAL
ATM
phy
5: DataLink Layer 5-206
Datagram Journey in IP-over-ATM Network
 at Source Host:
 IP layer maps between IP, ATM dest address (using ARP)
 passes datagram to AAL5
 AAL5 encapsulates data, segments cells, passes to ATM layer
 ATM network: moves cell along VC to destination
 at Destination Host:
AAL5 reassembles cells into original datagram
 if CRC OK, datagram is passed to IP

5: DataLink Layer 5-207
IP-Over-ATM
Issues:
 IP datagrams into
ATM AAL5 PDUs
 from IP addresses
to ATM addresses
 just like IP
addresses to
802.3 MAC
addresses!
ATM
network
Ethernet
LANs
5: DataLink Layer 5-208
ATM and “IP switching”
 ATM advantages
 Lookup of VCID = O(1), Lookup of IP routes O(log n)
 One-time route lookup and circuit establishment, all
subsequent traffic switched
 ATM disadvantages
 Complex signaling and routing for establishing
communication
 Difficulty in mapping IP traffic dynamically onto ATM
circuits
 Goal
 Maintain IP infrastructure
 Accelerate it with labels to support O(1) lookups a la
ATM
 Solution
 Ipsilon and “IP switching”
 http://pnewman.org/papers/infocom96.pdf
5: DataLink Layer 5-209
IP over ATM versus IP
switching
IP network control
IP routing
IP network control
IP routing
ATM network control
ATM label switching
IP network control
IP routing
IP network control
ATM label switching
IP network control
IP routing
5: DataLink Layer 5-210
ATM and “IP switching”
 In a nutshell





Start with ATM switch
Rip out ATM signaling and routing
Add IP routing software
Add Flow classifier to map unknown flows to underlying ATM
virtual circuit ID
Attach VCID and allow downstream nodes to do the same
 Operation

Upon arrival of first packet in flow
• Record unknown incoming VCID
• Lookup IP flow and map it to an outgoing virtual circuit ID (label)
using IP routing software
• Create incomingVCID to outgoingVCID table entry for subsequent
packets

Subsequent packets
• Switched in hardware using VCID after flow classified at edge
• IP packet forwarding done as label index lookup O(1) versus IP
route lookup O(log n)
5: DataLink Layer
5-211
ATM and “IP switching”
 Later generalized as MPLS (multi-protocol label
switching)




“Layer 2 ½”
Not tied to ATM
Extensible to IPv6
Half-way in between data-link addresses and IP
addresses
• Labeling done within a cloud versus link-local (data-link
addresses) and global (IP addresses)

http://www.rfc-editor.org/rfc/rfc3031.txt
 Used as a tool for traffic engineering
 http://www.rfc-editor.org/rfc/rfc2702.txt
5: DataLink Layer 5-212