Data-link Layer (Part 2)
1
Reading assignment
Chapter 5.5-5.11
Due Wednesday, Oct. 8
Homework #2
Due Monday, Oct. 15
2
Last class
Data-link layer overview
Data-link layer functions
This class
Specific data-link layers and devices
3
Specific data-link layers
Ethernet (802.3)
Token Ring (802.5)
WiFi (802.11)
PPP
ATM
X.25
Frame relay
Specific data-link layer devices
Hubs
Bridges
Switches
4
“dominant” LAN technology:
First practical local area network, built at Xerox PARC in 70’s
Cheap: $20 for 100Mbs!
Simpler, cheaper than token LANs and ATM
Kept up with speed race: 10, 100, 1000 Mbps
Metcalfe’s Ethernet
sketch
5
Carrier sense
Check to see if active transmission
Collision detect
Sender checks for collision; wait and retry
Adaptive randomized wait to avoid collisions
6
Sending adapter encapsulates IP datagram (or other network layer protocol
packet) in Ethernet frame
Preamble – 8 bytes
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver, sender clock rates
Src/Dst Address – 6 bytes
Globally unique, allocated to manufacturers
All adapters listening receive frame, discard if not destined for itself
Type – 2 bytes
Indicates higher layer (network) protocol being used, mostly IP these days
http://www.cavebear.com/CaveBear/Ethernet/type.html
Data – 46 to 1500 bytes
CRC – 4 bytes
Checked at receiver, dropped if doesn’t match
CRC-32 (x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1)
7
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}
}
8
Packet?
No
Sense Send Detect
Carrier Collision
Yes
Discard
Packet
b=CalcBackoff();
attempts < 16 wait(b);
attempts++;
attempts == 16
9
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
10
Exponential Backoff:
Goal: adapt retransmission attempts to
estimated current load
heavy load: random wait will be longer
first collision: choose K from {0,1}; delay is K x
512 bit transmission times
after second collision: choose K from {0,1,2,3}…
after ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
11
What if two people
sent really small
packets
How do you find
collision?
Must have a
minimum packet
size
12
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 32-48 bits after collision, then stop
sending
Ensures that everyone notices collision
13
Propagation delay
1Km, c in cable = 60% * c in vacuum = 1.8 x
10^8 m/s
1000/1.8 x 10^8 ~= 5 x 10^-6 = 5us
5us * 3Mbps = 15bits in flight!
Modern 10Mb Ethernet {
2.5km=maximum network segment length, 10Mbps
~= 12.5us delay
+introduced repeaters (max 5 segments)
worst case – 51.2us round trip time!
14
Slot time = 51.2us = 512bits in flight
After this amount, sender is guaranteed sole access to link
51.2us = slot time for backoff
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
15
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
16
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 its other interfaces: physical layer device only!
17
10/100 Mbps rate; latter called “fast ethernet”
T stands for Twisted Pair cabling
Nodes connected to hubs or switches in a “star
topology”
Max distance from node to Hub is 100 meters
Smart hubs
Disconnect “jabbering adapter
Managed hubs (monitoring, statistics)
18
Use 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 to be efficient
Uses hubs, called here “Buffered Distributors”
Full-Duplex at 1 Gbps for point-to-point links
19
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
20
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
21
• FC: frame control used for monitoring and maintenance
• source, destination address: 48 bit physical address, as in
Ethernet
• data: packet from network layer
• checksum: CRC
• FS: frame status: set by dest., read by sender
– set to indicate destination up, frame copied OK from ring
– DLC-level ACKing
22
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
23
Wireless LANs: untethered (often mobile)
networking
IEEE 802.11 standard:
MAC protocol
unlicensed frequency spectrum: 900Mhz, 2.4Ghz
• Basic Service Set (BSS) (a.k.a.
“cell”) contains:
– wireless hosts
– access point (AP): base
station
• BSS’s combined to form
distribution system (DS)
24
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
25
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
26
Same as previous mode
but with explicit channel
reservation
sender: send short RTS:
request to send
receiver: reply with
short CTS: clear to send
CTS reserves channel for
sender, notifying
(possibly hidden) stations
avoid hidden station
collisions
27
RTS and CTS short:
collisions less likely, of
shorter duration
end result similar to
collision detection
IEEE 802.11 alows:
CSMA
CSMA/CA: reservations
Polling from AP
28
one sender, one receiver, one link: easier than
broadcast link:
no Media Access Control
no need for explicit MAC addressing
e.g., dialup link, ISDN line
popular point-to-point DLC protocols:
PPP (point-to-point protocol)
HDLC: High level data link control (Data link
used to be considered “high layer” in protocol
stack!)
29
http://www.rfc-editor.org/rfc/rfc1548.txt
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
ability to 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
30
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!|
31
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)
info: upper layer data being carried
check: cyclic redundancy check for error
detection
32
“data transparency” requirement: data field
must be allowed to include flag pattern
<01111110>
Q: is received <01111110> data or flag?
Sender: adds (“stuffs”) extra < 01111110> byte
after each < 01111110> data byte
Receiver:
two 01111110 bytes in a row: discard first
byte, continue data reception
single 01111110: flag byte
33
flag byte
pattern
in data
to send
flag byte pattern plus
stuffed byte in
transmitted data
34
Before exchanging network-
layer 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
35
Encrypt data at a layer below network layer
IPsec only works for IP packets
PP2P, L2F, L2TP
Allow encryption at data-link layer
Works for all network layer packets of all types
using PPP
Often tunneled using IP packets
IP(Tunnel) | PP2P/L2F/L2TP | Original Network
Packet
36
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
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
37
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
38
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
39
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:
User data for data (eg, IP datagrams)
AAL PDU
ATM cell
40
AAL5: low overhead AAL used to carry IP
datagrams
4 byte cyclic redundancy check
PAD ensures payload multiple of 48bytes
large AAL5 data unit to be fragmented into 48-byte
ATM cells
41
Service: transport cells across ATM network
analagous to IP network layer
very different services than IP network layer
Guarantees ?
Network Service Congestion
Architecture Model Bandwidth Loss Order Timing feedback
Internet best effort none no no no no (inferred
via loss)
ATM CBR constant yes yes yes no
rate congestion
ATM VBR guaranteed yes yes yes no
rate congestion
ATM ABR guaranteed no yes no yes
minimum
ATM UBR none no yes no no
42
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
43
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
44
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
45
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
46
Vision: end-to-end
transport: “ATM from
desktop to desktop”
ATM is both a network
technology and a data-
link layer technology
Reality: used to connect IP
backbone routers
“IP over ATM”
ATM as switched link
layer, connecting IP
routers
47
Classic IP only
3 “networks” (e.g., LAN segments) IP over ATM
MAC (802.3) and IP addresses
• replace “network” (e.g.,
LAN segment) with ATM
network
• ATM addresses, IP
addresses
ATM
network
Ethernet Ethernet
LANs LANs
48
Issues:
• IP datagrams into ATM
network
ATM AAL5
PDUs
• from IP addresses
to ATM addresses
– just like IP Ethernet
LANs
addresses to 802.3
MAC addresses!
49
at ATM network source edge:
IP layer finds mapping between IP, ATM dest address (using
ARP)
passes datagram to AAL5
AAL5 encapsulates data, segments to cells, passes to ATM
layer
ATM network: moves cell along VC to destination
at ATM network destination edge:
AAL5 reassembles cells into original datagram
if CRC OK, datgram is passed to IP
50
Start with ATM switch
Rip out ATM signaling
Rip out ATM routing
Add IP routing software
Add Flow classifier to map IP flow to underlying ATM virtual circuit
Operation
Upon arrival of first packet in flow
Assign IP flow to a virtual circuit ID (label) using IP routing software
Label locally significant
Subsequent flows
Switched in hardware after flow classified
IP packet forwarding done as label index lookup O(1) versus IP route lookup
O(log n)
http://pnewman.org/papers/infocom96.pdf
Subsequent versions add label or flow ID distribution to downstream nodes
Akin to local routing algorithm
51
Later generalized as MPLS (multi-protocol
label switching)
“Layer 2 ½”
Not tied to ATM
Extensible to IPv6
http://www.rfc-editor.org/rfc/rfc3031.txt
Used as a tool for traffic engineering
http://www.rfc-editor.org/rfc/rfc2702.txt
52
Like ATM:
wide area network technologies
virtual circuit oriented
origins in telephony world
can be used to carry IP datagrams
can thus be viewed as Link Layers by IP
protocol
53
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
54
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”
gigabit routers: limited processing possible
2000: IP wins
55
Designed in late ‘80s, widely deployed in the
‘90s
Frame relay service:
no error control
no flow control
End-to-end congestion control
56
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)
57
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
58
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
59
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
60
Effectively a physical layer device
Multi-port repeater
Repeater operating at bit level
Repeat received bits on one interface to all other interfaces
Hubs can be arranged in a hierarchy (or multi-tier
design), with backbone hub at its top
61
Each connected LAN referred to as LAN segment
Hubs do not isolate collision domains: node may
collide with any node residing at any segment in LAN
Hub Advantages:
simple, inexpensive device
Multi-tier provides graceful degradation: portions of
the LAN continue to operate if one hub malfunctions
extends maximum distance between node pairs
(100m per Hub)
62
single collision domain results in no increase in
max throughput
multi-tier throughput same as single segment
throughput
individual LAN restrictions pose limits on
number of nodes in same collision domain and
on total allowed geographical coverage
cannot connect different Ethernet types (e.g.,
10BaseT and 100baseT)
63
Link Layer devices: operate on Ethernet
frames, examining frame header and
selectively forwarding frame based on its
destination
Bridge isolates collision domains since it
buffers frames
When frame is to be forwarded on segment,
bridge uses CSMA/CD to access segment and
transmit
64
Bridge 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
65
Bridges filter packets
same-LAN -segment frames not forwarded onto
other LAN segments
Forwarding:
how to know which LAN segment on which to
forward frame?
looks like a routing problem (more shortly!)
66
67
Not recommended for two reasons:
- single point of failure at Computer Science hub
- all traffic between EE and SE must path over CS segment
68
Basic idea: build cache of which nodes are
downstream of which ports
Monitor source address on all packets bridge
forwards
Insert reverse path to source into cache
What to do with unknown sources?
Flood network
69
bridges learn which hosts can be reached through which
interfaces: maintain filtering tables
when frame received, bridge “learns” location of
sender: incoming LAN segment
records sender location in filtering table
filtering table entry:
(Node LAN Address, Bridge Interface, Time Stamp)
stale entries in Filtering Table dropped (TTL can be 60
minutes)
70
filtering procedure:
if destination is on LAN on which frame was received
then drop the frame
else { lookup filtering table
if entry found for destination
then forward the frame on interface indicated;
else flood; /* forward on all but the interface on
which the frame arrived*/
}
71
Suppose C sends frame to D and D replies back with
frame to C
• C sends frame, bridge has no info about D, so floods to
both LANs
– bridge notes that C is on port 1
– frame ignored on upper LAN
– frame received by D
72
• D generates reply to C, sends
– bridge sees frame from D
– bridge notes that D is on interface 2
– bridge knows C on interface 1, so selectively forwards
frame out via interface 1
73
for increased reliability, desirable to have redundant,
alternate paths from source to dest
with multiple simultaneous paths, cycles result - bridges
may multiply and forward frame forever
solution: organize bridges in a spanning tree by disabling
subset of interfaces
Disabled
74
Switches
“multi-port bridge”
Each port acts as a bridge
Each port determines MAC addresses connected to
itself
Master list within switch determines forwarding
behavior
LAN 1 LAN 2
75
Higher link bandwidth
Point to point electrically simpler than bus
Much greater aggregate bandwidth
Separate segments can send at once
Data backplane of switches typically large to support
simultaneous transfers amongst ports
Challenge
Learning which packets to copy across links
Avoiding forwarding loops
76
layer 2 (frame) forwarding,
filtering using LAN
addresses
Switching: A-to-B and A’-to-
B’ simultaneously, no
collisions
large number of interfaces
versus bridges (which
typically have only two)
often: individual hosts, star-
connected into switch
Ethernet, but no collisions!
77
cut-through switching: frame forwarded from
input to output port without awaiting for
assembly of entire frame
slight reduction in latency
combinations of shared/dedicated,
10/100/1000 Mbps interfaces
78
Dedicated
Shared
79
both store-and-forward devices
routers: network layer devices (examine network layer headers)
bridges are Link Layer devices
routers maintain routing tables, implement routing algorithms
bridges maintain filtering tables, implement filtering, learning
and spanning tree algorithms
80
Bridges + and -
+ Bridge operation is simpler requiring less processing
bandwidth
- Topologies are restricted with bridges: a spanning tree
must be built to avoid cycles
- Bridges do not offer protection from broadcast storms
(endless broadcasting by a host will be forwarded by a
bridge)
81
Routers + and -
+ arbitrary topologies can be supported, cycling is
limited by TTL counters (and good routing
protocols)
+ provide firewall protection against broadcast storms
- require IP address configuration (not plug and play)
- require higher processing bandwidth
bridges do well in small (few hundred hosts) while
routers used in large networks (thousands of hosts)
82
principles behind data link layer services:
error detection, correction
sharing a broadcast channel: multiple access
link layer addressing, ARP
various link layer technologies
802.3 Ethernet
802.5 Token-ring
802.11 LANs
PPP
ATM
X.25, Frame Relay
hubs, bridges, switches
83