Chapter 3 Data-Link
Chapter 3 Data-Link
Chapter 2
our goals:
Link Layer understand principles behind link layer
services:
error detection, correction
sharing a broadcast channel: multiple access
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers). Computer link layer addressing
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs. Networking: A Top local area networks: Ethernet, VLANs
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach instantiation, implementation of various link
If you use these slides (e.g., in a class) that you mention their source
6th edition
(after all, we’d like people to use our book!)
If you post any slides on a www site, that you note that they are adapted Jim Kurose, Keith Ross layer technologies
from (or perhaps identical to) our slides, and note our copyright of this
material.
Addison-Wesley
March 2012
Thanks and enjoy! JFK/KWR
1
Link layer: context Link layer services
datagram transferred by transportation analogy: framing, link access:
different link protocols over trip from Princeton to Lausanne encapsulate datagram into frame, adding header, trailer
different links: limo: Princeton to JFK channel access if shared medium
e.g., Ethernet on first link, plane: JFK to Geneva “MAC” addresses used in frame headers to identify
frame relay on train: Geneva to Lausanne source, dest
intermediate links, 802.11 tourist = datagram • different from IP address!
on last link transport segment = reliable delivery between adjacent nodes
each link protocol provides communication link we learned how to do this already (chapter 3)!
different services transportation mode = link seldom used on low bit-error link (fiber, some twisted
e.g., may or may not layer protocol pair)
provide rdt over link travel agent = routing wireless links: high error rates
algorithm • Q: why both link-level and end-end reliability?
2
Adaptors communicating Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
datagram datagram
5.2 error detection, MPLS
controller controller
correction 5.6 data center
5.3 multiple access networking
sending host receiving host
datagram protocols 5.7 a day in the life of a
frame 5.4 LANs web request
addressing, ARP
sending side: receiving side
Ethernet
encapsulates datagram in looks for errors, rdt,
frame flow control, etc switches
adds error checking bits, extracts datagram, passes VLANS
rdt, flow control, etc. to upper layer at
receiving side
Link Layer 5-9 Link Layer 5-10
otherwise
0 0
3
Internet checksum (review) Cyclic redundancy check
more powerful error-detection coding
goal: detect “errors” (e.g., flipped bits) in transmitted packet
(note: used at transport layer only) view data bits, D, as a binary number
choose r+1 bit pattern (generator), G
sender: receiver: goal: choose r CRC bits, R, such that
treat segment contents compute checksum of <D,R> exactly divisible by G (modulo 2)
as sequence of 16-bit received segment receiver knows G, divides <D,R> by G. If non-zero remainder:
integers check if computed
error detected!
checksum: addition (1’s checksum equals checksum can detect all burst errors less than r+1 bits
complement sum) of field value: widely used in practice (Ethernet, 802.11 WiFi, ATM)
segment contents NO - error detected
sender puts checksum YES - no error detected.
value into UDP But maybe errors
checksum field nonetheless?
4
Multiple access links, protocols Multiple access protocols
two types of “links”:
single shared broadcast channel
point-to-point
two or more simultaneous transmissions by nodes:
PPP for dial-up access
interference
point-to-point link between Ethernet switch, host
collision if node receives two or more signals at the same
broadcast (shared wire or medium) time
old-fashioned Ethernet
upstream HFC
802.11 wireless LAN multiple access protocol
distributed algorithm that determines how nodes share
channel, i.e., determine when node can transmit
communication about channel sharing must use channel itself!
no out-of-band channel for coordination
5
Random access protocols Slotted ALOHA
when node has packet to send assumptions: operation:
transmit at full channel data rate R. all frames same size when node obtains fresh
no a priori coordination among nodes time divided into equal size frame, transmits in next slot
two or more transmitting nodes ➜ “collision”, slots (time to transmit 1 if no collision: node can send
random access MAC protocol specifies: frame) new frame in next slot
how to detect collisions nodes start to transmit if collision: node retransmits
how to recover from collisions (e.g., via delayed only slot beginning frame in each subsequent
retransmissions) nodes are synchronized slot with prob. p until
examples of random access MAC protocols: if 2 or more nodes transmit success
slotted ALOHA in slot, all nodes detect
ALOHA collision
CSMA, CSMA/CD, CSMA/CA
!
nodes may be able to prob that given node has at best: channel
highly decentralized: only detect collision in less success in a slot = p(1- used for useful
slots in nodes need to be p)N-1 transmissions 37%
in sync than time to transmit
packet prob that any node has a of time!
simple success = Np(1-p)N-1
clock synchronization
Link Layer 5-23 Link Layer 5-24
6
Pure (unslotted) ALOHA Pure ALOHA efficiency
P(success by given node) = P(node transmits) .
unslotted Aloha: simpler, no synchronization
P(no other node transmits in [t0-1,t0] .
when frame first arrives P(no other node transmits in [t0-1,t0]
transmit immediately
collision probability increases: = p . (1-p)N-1 . (1-p)N-1
frame sent at t0 collides with other frames sent in [t0- = p . (1-p)2(N-1)
1,t0+1]
… choosing optimum p and then letting n
= 1/(2e) = .18
CSMA (carrier sense multiple access) CSMA collisions spatial layout of nodes
7
CSMA/CD (collision detection) CSMA/CD (collision detection)
CSMA/CD: carrier sensing, deferral as in CSMA spatial layout of nodes
collisions detected within short time
colliding transmissions aborted, reducing channel wastage
collision detection:
easy in wired LANs: measure signal strengths, compare
transmitted, received signals
difficult in wireless LANs: received signal strength
overwhelmed by local transmission strength
human analogy: the polite conversationalist
8
“Taking turns” MAC protocols “Taking turns” MAC protocols
channel partitioning MAC protocols: polling:
share channel efficiently and fairly at high load master node “invites”
inefficient at low load: delay in channel access, 1/N slave nodes to transmit data
bandwidth allocated even if only 1 active node! in turn poll
typically used with
random access MAC protocols “dumb” slave devices master
efficient at low load: single node can fully utilize concerns:
data
channel
polling overhead
high load: collision overhead
latency
“taking turns” protocols single point of slaves
look for best of both worlds! failure (master)
9
Cable access network Summary of MAC protocols
cable headend MAP frame for
Interval [t1, t2]
Downstream channel i
channel partitioning, by time, frequency or code
CMTS Time Division, Frequency Division
Upstream channel j
random access (dynamic),
ALOHA, S-ALOHA, CSMA, CSMA/CD
t1 t2 Residences with cable modems
carrier sensing: easy in some technologies (wire), hard
Minislots containing Assigned minislots containing cable modem
in others (wireless)
minislots request frames upstream data frames
CSMA/CD used in Ethernet
DOCSIS: data over cable service interface spec CSMA/CA used in 802.11
FDM over upstream, downstream frequency channels taking turns
TDM upstream: some slots assigned, some have contention polling from central site, token passing
downstream MAP frame: assigns upstream slots bluetooth, FDDI, token ring
request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
Link Layer 5-37 Link Layer 5-38
10
LAN addresses and ARP LAN addresses (more)
each adapter on LAN has unique LAN address
MAC address allocation administered by IEEE
manufacturer buys portion of MAC address space
1A-2F-BB-76-09-AD (to assure uniqueness)
analogy:
MAC address: like Social Security Number
LAN IP address: like postal address
(wired or adapter
wireless) MAC flat address ➜ portability
71-65-F7-2B-08-53
58-23-D7-FA-20-B0 can move LAN card from one LAN to another
IP hierarchical address not portable
0C-C4-11-6F-E3-98
address depends on IP subnet to which node is
attached
11
Addressing: routing to another LAN Addressing: routing to another LAN
walkthrough: send datagram from A to B via R A creates IP datagram with IP source A, destination B
focus on addressing – at IP (datagram) and MAC layer (frame) A creates link-layer frame with R's MAC address as dest, frame
contains A-to-B IP datagram
assume A knows B’s IP address
assume A knows IP address of first hop router, R (how?) MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
assume A knows R’s MAC address (how?) IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
Eth
Phy
A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
12
Addressing: routing to another LAN Addressing: routing to another LAN
R forwards datagram with IP source A, destination B R forwards datagram with IP source A, destination B
R creates link-layer frame with B's MAC address as dest, frame R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A
MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111
IP src: 111.111.111.111 IP dest: 222.222.222.222
IP dest: 222.222.222.222
IP IP
IP Eth Eth
Eth Phy Phy
Phy
A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
correction 5.6 data center simpler, cheaper than token LANs and ATM
5.3 multiple access networking kept up with speed race: 10 Mbps – 10 Gbps
13
Ethernet: physical topology Ethernet frame structure
bus: popular through mid 90s
all nodes in same collision domain (can collide with each
other) sending adapter encapsulates IP datagram (or other
star: prevails today network layer protocol packet) in Ethernet frame
type
active switch in center
dest. source data
preamble address address CRC
each “spoke” runs a (separate) Ethernet protocol (nodes (payload)
switch
star
bus: coaxial cable
Link Layer 5-53 Link Layer 5-54
14
802.3 Ethernet standards: link & physical layers Link layer, LANs: outline
many different Ethernet standards
common MAC protocol and frame format 5.1 introduction, services 5.5 link virtualization:
different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 5.2 error detection, MPLS
10G bps correction 5.6 data center
different physical layer media: fiber, cable 5.3 multiple access networking
protocols 5.7 a day in the life of a
5.4 LANs web request
application
MAC protocol addressing, ARP
and frame format
transport Ethernet
network 100BASE-TX 100BASE-T2 100BASE-FX
link
switches
100BASE-T4 100BASE-SX 100BASE-BX
physical VLANS
15
Switch forwarding table Switch: self-learning Source: A
Dest: A’
A A A’
Q: how does switch know A’ A switch learns which hosts
can be reached through
reachable via interface 4, B’ B which interfaces C’ B
C’
reachable via interface 5? when frame received, 6 1 2
A: each switch has a switch 6 1 2 switch “learns”
table, each entry: location of sender: 5 4 3
5 4 3 incoming LAN segment
(MAC address of host, interface to B’ C
records sender/location
reach host, time stamp) B’ C
pair in switch table
looks like a routing table!
A’
A’
Q: how are entries created, switch with six interfaces MAC addr interface TTL
maintained in switch table? (1,2,3,4,5,6) A 1 60 Switch table
(initially empty)
something like a routing protocol?
destination A location 6 1 2 S1
S3
S2
known: selectively send A A’
5 4 3
A
F
D I
C
on just one link B’ C
B
G H
E
A’ A
A’
Q: sending from A to G - how does S1 know to
MAC addr interface TTL forward frame destined to F via S4 and S3?
A 1 60 switch table A: self learning! (works exactly the same as in
(initially empty)
A’ 4 60 single-switch case!)
Link Layer 5-63 Link Layer 5-64
16
Self-learning multi-switch example Institutional network
Suppose C sends frame to I, I responds to C
mail server
S4 to external
network
S1 web server
S3 router
A S2
F
D I
B C
E G H IP subnet
17
port-based VLAN: switch ports
VLANs grouped (by switch management
software) so that single physical
Chapter 2: Summary
switch …… principles behind data link layer services:
Virtual Local
Area Network
1
2
7
8
9
10
15
16
error detection, correction
switch(es) supporting sharing a broadcast channel: multiple access
VLAN capabilities can … … link layer addressing
be configured to Electrical Engineering Computer Science instantiation and implementation of various link
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)
layer technologies
LANS over single … operates as multiple virtual switches Ethernet
physical LAN
switched LANS, VLANs
infrastructure. 1
2
7
8
9
10
15
16
virtualized networks as a link layer: MPLS
synthesis: a day in the life of a web request
… …
18