Professional Documents
Culture Documents
layer
bus
controller (e.g., PCI)
sending side: receiving side
link
attaches into host’s physical
physical
encapsulates datagram in looks for errors, rdt, flow
system buses
transmission
1
Link Layer Services Link Layer Services (more)
Framing, link access:
Error Detection:
encapsulate datagram into frame, adding header, trailer
errors caused by signal attenuation, noise.
channel access if shared medium
receiver detects presence of errors:
“MAC” addresses used in frame headers to identify source,
dest • signals sender for retransmission or drops frame
• different
diff tffrom IP address!
dd ! Error
E C
Correction:
ti :
Reliable delivery between adjacent nodes, flow ctrl receiver identifies and corrects bit error(s) without
Control when errors + pace between adjacent sending and
resorting to retransmission
receiving nodes
• we learned how to do this already (chapter 3)!
seldom used on low bit error link (fiber, some twisted pair)
wireless links: high error rates
Q: why both link-level and end-end reliability?
5: DataLink Layer 5-7 5: DataLink Layer 5-8
flag byte
Byte Stuffing pattern Framing techniques: examples (cont)
in data
to send
<01111110> delimits
beginning, end of frame ...
Physical layer coding violation: exploits
“data transparency”: data special encodings at the physical layer, e.g.
field must be allowed to
include <01111110> Manchester encoding g (see next …)
Q: is received <01111110> flag byte pattern plus
data or flag? stuffed byte in
transmitted data
Sender: adds (“stuffs”) Receiver:
extra <01111110> byte after two 01111110 bytes in a
each <01111110> data byte row: discard first byte,
continue data reception
single 01111110: flag
byte
5: DataLink Layer 5-11 5: DataLink Layer 5-12
2
Encoding Link Layer
Problem: Simple binary encoding (aka Non-Return to
Zero, NRZ) introduces problems: 5.1 Introduction and LAN technology
consecutive 0’s or 1’s can lead to a situation called services 5.5 Ethernet
baseline wander (hard to distinguish signal values) Framing 5.6 Interconnection
hard to recover the clock 5.2 Error detection 5.4 Link-Layer
More robust
M b encoding:
di and correction Add
Addressing
i
Manchester: XOR NRZ with clock 5.3Multiple access 5.7 PPP
protocols 5.9 A day in the life of a
web request
(5.8 Link Virtualization:
ATM and MPLS)
0 0
3
Multiple Access Links and Protocols
Link Layer
Two types of “links”:
5.1 Introduction and LAN technology point-to-point
services 5.5 Ethernet PPP for dial-up access
point-to-point link between Ethernet switch and host
Framing 5.6 Interconnection
5.2 Error detection broadcast (shared wire or medium)
5.4 Link-Layer
Ethernet
and correction Add
Addressing
i
upstream HFC
5.3Multiple access 5.7 PPP 802.11 wireless LAN
protocols 5.9 A day in the life of a
web request
(5.8 Link Virtualization:
ATM and MPLS)
humans at a
shared wire (e.g., shared RF shared RF cocktail party
cabled Ethernet) (e.g., 802.11 WiFi) (satellite) (shared air, acoustical)
5: DataLink Layer 5-19 5: DataLink Layer 5-20
4
Channel Partitioning CDMA Random Access Protocols
CDMA: Code Division Multiple Access When node has packet to send
allows each station to transmit over the entire frequency spectrum
transmit at full channel data rate R.
all the time.
no a priori coordination among nodes
simultaneous transmissions are separated using coding theory.
used mostly in wireless broadcast channels (cellular, satellite, etc) – we will two or more transmitting nodes ➜ “collision”,
study it in the wireless context
random access MAC protocol specifies:
has been ”traditionally” used in the military
how to detect collisions
Assumptions: Operation:
all frames same size when node obtains fresh
time divided into equal frame, transmits in next
size slots (time to slot
transmit 1 frame) if no collision: node can
send new frame in next Pross
P Cons
nodes start to transmit
slot single active node can collisions, wasting slots
only at slot beginning
if collision: node continuously transmit idle slots
nodes are synchronized
if 2 or more nodes
retransmits frame in at full rate of channel nodes may be able to
transmit in slot, all each subsequent slot highly decentralized: detect collision in less
nodes detect collision with prob. p until than time to transmit
only slots in nodes
success packet
need to be in sync
clock synchronization
simple
5: DataLink Layer 5-27 5: DataLink Layer 5-28
At best: channel
P[any of N nodes succeeds]
use for useful
= N p (1-p)(N-1) transmissions 37%
of time!
Efficiency = 1/e = .37 LARGE N
5
Pure Aloha (cont.) CSMA: Carrier Sense Multiple Access
6
IEEE 802.4 Standard IEEE Standard 802.5 (Token Ring)
(General Motors Token Bus) (not in must-study material)
(not in must-study material) Motivation: instead of complicated token-bus, have a physical ring
Contention systems limitation: worst-case delay Principle: Each bit arriving at an interface is copied into a 1-bit
buffer (inspected and/or modified); then copied out to the ring
until successful transmission is unlimited => not again.
suitable for real-time traffic copying step introduces a 1-bit delay at each interface.
Solution: token-passing, round robin
token = special control frame; only the holding
station can transmit; then it passes it to another
station, i.e. for token bus, the next in the logical
ring
4 priority classes of traffic, using timers
Logical ring-maintenance: distributed strategy
Robust, somehow complicated though
to transmit a frame, a station is required Centralised: a “monitor” station oversees the ring:
to seize the token and remove it from the generates token when lost
ring before transmitting. cleans the ring when garbled/orphan frames
appear
bits that have ppropagated
p g around the ring
g
are removed from the ring by the sender
If the monitor goes away, a convention protocol
(the receiver in FDDI). ensures that another station is elected as a
After a station has finished transmitting monitor (e.g. the one with highest identity)
the last bit of its frame, it must If the monitor gets ”mad”, though…..
regenerate the token.
set prior(f) := max{prior(f), prior(S)} station with message to send posts reservation during its slot
reservation seen by all stations
forward(f)
( )
reservation
s ti sl
slott ti
time equall tto channel
h l end-end
d d propagation
ti
upon arrival of T delay (why?)
if prior(T)>prior(S) then forward(T) after reservation slots, message transmissions ordered by known
priority
else send own frame f with prior(f):=0
wait until f comes back
prior(T):=prior(f)
forward(T)
7
Summary of MAC protocols Link Layer
What do you do with a shared media? 5.1 Introduction and LAN technology
Channel Partitioning, by time, frequency or code services 5.5 Ethernet
• Time Division, Frequency Division Framing 5.6 Interconnection
Random partitioning (dynamic), 5.2 Error detection 5.4 Link-Layer
• ALOHA,
H S-ALOHA, H CSMA, CSMA/CD / D and correction Add
Addressing
i
• carrier sensing: easy in some technologies (wire), hard 5.3Multiple access 5.7 PPP
in others (wireless) protocols 5.9 A day in the life of a
• CSMA/CD used in Ethernet
web request
• CSMA/CA used in 802.11
Taking Turns (5.8 Link Virtualization:
ATM and MPLS)
• polling, token passing
• Bluetooth, FDDI, IBM Token Ring
5: DataLink Layer 5-43 5: DataLink Layer 5-44
Jam Signal: make sure all other transmitters are Recall: collision detection interval = 2*Propagation
aware of collision; 48 bits; delay along the LAN
Exponential Backoff: This implies a minimum frame size and/or a
Goal: adapt retransmission attempts to estimated maximum wire length
current load
heavy load: random wait will be longer
first collision: choose K from {0,1}
(delay is K x frame-transmission time)
Critical factor:
after second collision: choose K from {0,1,2,3}…
a = 2 * propagation_delay /frame_transmission_delay
after ten or more collisions, choose K from
{0,1,2,3,4,…,1023}
8
Star topology CSMA/CD efficiency
bus topology popular through mid 90s
all nodes in same collision domain (can collide with each
other) Tprop = max prop between 2 nodes in LAN
today: star topology prevails (more bps, shorter ttrans = time to transmit max-size frame
distances)
Hub or active switch in center 1
(more in
n a while)
wh le) efficiencyy =
1 + 5t prop / ttrans
Much better than ALOHA, but still decentralized,
simple, and cheap
switch
Ethernet Frame Structure 802.3 Ethernet Standards: Link & Physical Layers
Sending adapter encapsulates IP datagram (or other many different Ethernet standards
network layer protocol packet) in Ethernet frame common MAC protocol and frame format
different speeds: 2 Mbps, 10 Mbps, 100 Mbps,
1Gbps, 10G bps
different physical layer media: fiber, cable
Preamble: 7 bytes with pattern 10101010 followed by one byte
with pattern 10101011
to synchronize receiver, sender clock rates
Addresses: 6 bytes, frame is received by all adapters on a LAN application
MAC protocol
and dropped if address does not match
and frame format
transport
Type: indicates the higher layer protocol, mostly IP but others network 100BASE-TX 100BASE-T2 100BASE-FX
may be supported (such as Novell IPX and AppleTalk) link 100BASE-T4 100BASE-SX 100BASE-BX
CRC: checked at receiver, if error is detected, the frame is physical
simply dropped
copper (twister fiber physical layer
5: DataLink Layer 5-51
pair) physical layer 5: DataLink Layer 5-52
9
Link Layer Interconnecting with hubs
Hubs are essentially physical-layer repeaters:
bits coming from one link go out all other links
5.1 Introduction and LAN technology at the same rate (no frame buffering)
services 5.5 Ethernet no CSMA/CD at hub: adapters detect collisions (one large collision
domain)
Framing 5.6 Interconnection provides net management functionality (monitoring, statistics)
5.2 Error detection 5.4 Link-Layer Extends distance between nodes
and correction Add
Addressing
i C
Can’t
’t iinterconnect
t t e.g. 10B
10BaseT
T & 100B
100BaseT
T
5.3Multiple access 5.7 PPP
hub
protocols 5.9 A day in the life of a
web request
(5.8 Link Virtualization: hub hub
hub
ATM and MPLS)
10
Switch Learning: example Switch: traffic isolation
Suppose C sends a frame to D and D replies with a frame to C switch installation breaks subnet into LAN
segments
switch filters packets:
same-LAN-segment frames not usually
switch forwarded onto other LAN segments
segments become separate collision domains
network
web server
traffic no yes yes router
solat on
isolation
plug & play yes no yes IP subnet
optimal no yes no
routing
cut yes no yes
through
5: DataLink Layer 5-65 5: DataLink Layer 5-66
11
VLANs: motivation VLANs Port-based VLAN: switch ports grouped
(by switch management software) so
that single physical switch ……
Virtual Local 2 8 10 16
all layer-2 broadcast define multiple virtual … operates as multiple virtual switches
traffic (ARP, DHCP)
LANS over single
crosses entire LAN
Computer (security/privacy, physical LAN
Computer
infrastructure.
1 7 9 15
Science Electrical
Engineering Engineering efficiency issues) 2 8 10 16
12
LAN Addresses LAN Address (more)
32-bit IP address:
network-layer address MAC address allocation administered by IEEE
used to get datagram to destination network (recall IP
manufacturer buys portion of MAC address space (to
network definition)
assure uniqueness)
LAN (or MAC or physical) address: Broadcast address =
FF-FF-FF-FF-FF-FF
to g
get datagram
g from
Analogy:
A l
one interface to another
physically-connected (a) MAC address: like People’s Names or PersonalNum’s
interface (same network) (b) IP address: like postal address
48 bit MAC address MAC flat address => portability
(for most LANs) can move LAN card from one LAN to another
burned in NIC’s ROM IP hierarchical address NOT portable
(sometimes resettable) depends on network to which one attaches
49-BD-D2-C7-56-2A A
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D 222.222.222.221
1A-23-F9-CD-06-9B
111.111.111.111
CC-49-DE-D0-AB-7D
5: DataLink Layer 5-77 5: DataLink Layer 5-78
13
Link Layer Point to Point Data Link Control
one sender, one receiver, one link: easier than
5.1 Introduction and LAN technology
broadcast link:
services 5.5 Ethernet
no Media Access Control
Framing 5.6 Interconnection
no need for explicit MAC addressing
5.2 Error detection 5.4 Link-Layer
and correction e.g.,
e g dialup link
link, ISDN line
Add
Addressing
i
5.3Multiple access popular point-to-point DLC protocols:
5.7 PPP
protocols PPP (point-to-point protocol)
5.9 A day in the life of a
web request HDLC: High level data link control
14
Byte Stuffing PPP Data Control Protocol
Before exchanging network-
layer data, data link peers
flag byte
pattern must
in data configure PPP link (max.
to send
frame length,
authentication)
learn/configure network
layer information
for IP: carry IP Control
Protocol (IPCP) msgs
flag byte pattern plus
stuffed byte in
(protocol field: 8021) to
transmitted data configure/learn IP
address
5: DataLink Layer 5-85 5: DataLink Layer 5-86
15
A day in the life… connecting to the Internet A day in the life… ARP (before DNS, before HTTP)
DHCP DHCP DHCP server formulates DNS DNS before sendingHTTP request,
DHCP UDP DHCP ACK containing DNS UDP need IP address of www.google.com:
DHCP IP client’s IP address, IP DNS IP DNS
address of first-hop
ARP
DHCP Eth ARP query Eth
Phy router for client, name & Phy DNS query created, encapsulated
IP address of DNS server in UDP, encapsulated in IP,
encapsulation at DHCP encasulated in Eth. In order to
server, frame forwarded ARP
send frame to router, need MAC
DHCP DHCP (switch learning)
g through
g ARP reply Eth address of router interface: ARP
DHCP UDP LAN, demultiplexing at Phy
DHCP IP client ARP query broadcast, received
DHCP Eth router DHCP client receives DHCP by router, which replies with
DHCP
Phy (runs DHCP) ACK reply ARP reply giving MAC address
of router interface
client now knows MAC address
of first hop router, so can now
Client now has IP address, knows name & addr of DNS send frame containing DNS
server, IP address of its first-hop router query
A day in the life… using DNS DNS A day in the life… TCP connection carrying HTTP
DNS UDP DNS server
DNS IP HTTP
DNS DNS DNS Eth HTTP
DNS UDP DNS Phy
SYNACK
SYN TCP
DNS IP SYNACK
SYN IP
DNS Eth SYNACK
SYN Eth
Phy Phy
DNS
Comcast network
68.80.0.0/13
to send HTTP request,
client first opens TCP
socket to web server
IP datagram forwarded from
TCP SYN segment (step 1
campus network into comcast
network, routed (tables created SYNACK
SYN TCP in 3-way handshake) inter-
IP datagram containing DNS
by RIP, OSPF and BGP routing SYNACK
SYN IP domain routed to web
query forwarded via LAN protocols) to DNS server SYNACK
SYN Eth server
switch from client to 1st hop Phy web server responds with
router TCP SYNACK (step 2 in 3-
demux’ed to DNS server way handshake)
web server
DNS server replies to 64.233.169.105 TCP connection established!
client with IP address of
www.google.com 5: DataLink Layer 5-93 5: DataLink Layer 5-94
Eth
services
HTTP
HTTP
Phy 5.7 PPP
5.2 Error detection A day in the lifetime of
and correction a web-request
q
HTTP request sent into
TCP socket 5 3Multiple access
5.3Multiple 5.8
5 8 Link
Li k Vi
Virtualization
t li ti
IP datagram containing
protocols
HTTP HTTP
TCP
HTTP request routed to 5.4 Link-Layer
www.google.com
HTTP
HTTP IP Addressing
Eth web server responds with
5.5 Ethernet
HTTP
16
Link Layer The Internet: virtualizing networks
1974: multiple unconnected … differing in:
5.1 Introduction and LAN technology
nets addressing conventions
services 5.5 Ethernet
ARPAnet packet formats
Framing 5.6 Interconnection data-over-cable networks error recovery
5.2 Error detection 5.4 Link-Layer packet satellite network (Aloha) routing
and correction Add
Addressing
i packet
k radio
d network k
5.3Multiple access 5.7 PPP
protocols 5.9 A day in the life of a
web request
(5.8 Link Virtualization:
ATM and MPLS)
ARPAnet satellite net
"A Protocol for Packet Network Intercommunication",
V. Cerf, R. Kahn, IEEE Transactions on Communications,
5: DataLink Layer 5-97 5: DataLink Layer 5-98
May, 1974, pp. 637-648.
17
IP-Over-ATM IP-Over-ATM
IP over ATM
Classic IP only replace “network” app
3 “networks” (e.g., (e.g., LAN segment) app transport
LAN segments) with ATM network transport IP IP
IP AAL AAL
MAC (802.3) and IP ATM addresses, IP Eth Eth ATM
ATM
addresses addresses phy phy phy ATM phy
ATM
phy
p y
ATM
network phy
Ethernet Ethernet
LANs LANs
5: DataLink Layer 5-103 5: DataLink Layer 5-104
18
MPLS forwarding tables Chapter 5: Summary
in out out
principles behind data link layer services:
label label dest interface error detection, correction
10 A 0 in out out sharing a broadcast channel: multiple access
label label dest interface
12 D 0 link layer addressing
8 A 1 10 6 A 1
12 9 D 0 instantiation and implementation of various link
llayer technologies
t h l i
Ethernet
R6
0 0
D
1 1
switched LANS
R4 R3
R5 PPP
0 0
A Link Virtualization: ATM and MPLS
R2 in outR1 out
label label dest interface
in out out
label label dest interface 6 - A 0
8 6 A 0
5: DataLink Layer 5-109 5: DataLink Layer 5-110
19