Upload
hahuong
View
222
Download
1
Embed Size (px)
Citation preview
1
copy From Computer Networking by KuroseampRoss DataLink Layer 6-1
Introduction to Computer Networking
Guy Leduc
Chapter 6 Link Layer and LANs Computer Networking
A Top Down Approach 7th edition Jim Kurose Keith Ross Addison-Wesley April 2016
copy From Computer Networking by KuroseampRoss DataLink Layer 6-2
Chapter 6 The Data Link Layer Our goals understand principles behind data link layer
services error detection sharing a broadcast channel multiple access link layer addressing local area networks Ethernet
instantiation and implementation of various link layer technologies
2
copy From Computer Networking by KuroseampRoss DataLink Layer 6-3
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-4
Link Layer Introduction Some terminology hosts and routers are nodes
= devices with a network layer (L3) communication channels that
connect adjacent nodes along communication path are links wired links wireless links LANs
layer-2 packet is a frame encapsulates datagram
data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link
global ISP
3
copy From Computer Networking by KuroseampRoss DataLink Layer 6-5
Link layer context datagram transferred by
different link protocols over different links eg Ethernet on first link
MPLS on intermediate links WiFi on last link
each link protocol provides different services eg may or may not
provide reliable data transfer (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
copy From Computer Networking by KuroseampRoss DataLink Layer 6-6
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify sending
receiving node interfaces bull different from IP addresses (which identify source dest
host interfaces) reliable delivery between adjacent 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
bull Q why both link-level and end-end reliability
4
copy From Computer Networking by KuroseampRoss DataLink Layer 6-7
Link Layer Services (more)
flow control pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without resorting
to retransmission half-duplex and full-duplex
with half duplex nodes at both ends of link can transmit but not at same time
copy From Computer Networking by KuroseampRoss DataLink Layer 6-8
Where is the link layer implemented in each and every host link layer implemented in
ldquoadaptorrdquo (aka network interface card NIC) or on a chip Ethernet card 80211 card
Ethernet chipset implements link physical
layer attaches into hostrsquos system
buses combination of hardware
software firmware
controller
physical transmission
cpu memory
host bus (eg PCI)
network adapter card
application transport network
link
link physical
5
copy From Computer Networking by KuroseampRoss DataLink Layer 6-9
Adaptors communicating
sending side encapsulates datagram in
frame adds error checking bits (rdt flow control etc)
receiving side looks for errors (rdt flow control etc) extracts datagram passes
to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-10
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
addressing ARP Ethernet switches
65 Data center networking
68 A day in the life of a web request
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
2
copy From Computer Networking by KuroseampRoss DataLink Layer 6-3
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-4
Link Layer Introduction Some terminology hosts and routers are nodes
= devices with a network layer (L3) communication channels that
connect adjacent nodes along communication path are links wired links wireless links LANs
layer-2 packet is a frame encapsulates datagram
data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link
global ISP
3
copy From Computer Networking by KuroseampRoss DataLink Layer 6-5
Link layer context datagram transferred by
different link protocols over different links eg Ethernet on first link
MPLS on intermediate links WiFi on last link
each link protocol provides different services eg may or may not
provide reliable data transfer (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
copy From Computer Networking by KuroseampRoss DataLink Layer 6-6
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify sending
receiving node interfaces bull different from IP addresses (which identify source dest
host interfaces) reliable delivery between adjacent 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
bull Q why both link-level and end-end reliability
4
copy From Computer Networking by KuroseampRoss DataLink Layer 6-7
Link Layer Services (more)
flow control pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without resorting
to retransmission half-duplex and full-duplex
with half duplex nodes at both ends of link can transmit but not at same time
copy From Computer Networking by KuroseampRoss DataLink Layer 6-8
Where is the link layer implemented in each and every host link layer implemented in
ldquoadaptorrdquo (aka network interface card NIC) or on a chip Ethernet card 80211 card
Ethernet chipset implements link physical
layer attaches into hostrsquos system
buses combination of hardware
software firmware
controller
physical transmission
cpu memory
host bus (eg PCI)
network adapter card
application transport network
link
link physical
5
copy From Computer Networking by KuroseampRoss DataLink Layer 6-9
Adaptors communicating
sending side encapsulates datagram in
frame adds error checking bits (rdt flow control etc)
receiving side looks for errors (rdt flow control etc) extracts datagram passes
to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-10
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
addressing ARP Ethernet switches
65 Data center networking
68 A day in the life of a web request
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
3
copy From Computer Networking by KuroseampRoss DataLink Layer 6-5
Link layer context datagram transferred by
different link protocols over different links eg Ethernet on first link
MPLS on intermediate links WiFi on last link
each link protocol provides different services eg may or may not
provide reliable data transfer (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
copy From Computer Networking by KuroseampRoss DataLink Layer 6-6
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify sending
receiving node interfaces bull different from IP addresses (which identify source dest
host interfaces) reliable delivery between adjacent 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
bull Q why both link-level and end-end reliability
4
copy From Computer Networking by KuroseampRoss DataLink Layer 6-7
Link Layer Services (more)
flow control pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without resorting
to retransmission half-duplex and full-duplex
with half duplex nodes at both ends of link can transmit but not at same time
copy From Computer Networking by KuroseampRoss DataLink Layer 6-8
Where is the link layer implemented in each and every host link layer implemented in
ldquoadaptorrdquo (aka network interface card NIC) or on a chip Ethernet card 80211 card
Ethernet chipset implements link physical
layer attaches into hostrsquos system
buses combination of hardware
software firmware
controller
physical transmission
cpu memory
host bus (eg PCI)
network adapter card
application transport network
link
link physical
5
copy From Computer Networking by KuroseampRoss DataLink Layer 6-9
Adaptors communicating
sending side encapsulates datagram in
frame adds error checking bits (rdt flow control etc)
receiving side looks for errors (rdt flow control etc) extracts datagram passes
to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-10
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
addressing ARP Ethernet switches
65 Data center networking
68 A day in the life of a web request
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
4
copy From Computer Networking by KuroseampRoss DataLink Layer 6-7
Link Layer Services (more)
flow control pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without resorting
to retransmission half-duplex and full-duplex
with half duplex nodes at both ends of link can transmit but not at same time
copy From Computer Networking by KuroseampRoss DataLink Layer 6-8
Where is the link layer implemented in each and every host link layer implemented in
ldquoadaptorrdquo (aka network interface card NIC) or on a chip Ethernet card 80211 card
Ethernet chipset implements link physical
layer attaches into hostrsquos system
buses combination of hardware
software firmware
controller
physical transmission
cpu memory
host bus (eg PCI)
network adapter card
application transport network
link
link physical
5
copy From Computer Networking by KuroseampRoss DataLink Layer 6-9
Adaptors communicating
sending side encapsulates datagram in
frame adds error checking bits (rdt flow control etc)
receiving side looks for errors (rdt flow control etc) extracts datagram passes
to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-10
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
addressing ARP Ethernet switches
65 Data center networking
68 A day in the life of a web request
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
5
copy From Computer Networking by KuroseampRoss DataLink Layer 6-9
Adaptors communicating
sending side encapsulates datagram in
frame adds error checking bits (rdt flow control etc)
receiving side looks for errors (rdt flow control etc) extracts datagram passes
to upper layer at receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-10
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
addressing ARP Ethernet switches
65 Data center networking
68 A day in the life of a web request
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
6
copy From Computer Networking by KuroseampRoss DataLink Layer 6-11
Error Detection EDC= Error Detection (and sometimes Correction) bits (redundancy) D = Data protected by error checking may include header fields
bull Error detection not 100 reliable bull protocol may miss some errors (why) but rarely bull larger EDC field yields better detection (and correction)
otherwise
EDC = f (D) for some function f
Is EDCrsquo = f (Drsquo)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-12
Parity Checking Single Bit Parity Detect single bit errors
Two Dimensional Bit Parity Detect and correct single bit errors
0 0
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
7
copy From Computer Networking by KuroseampRoss DataLink Layer 6-13
Internet checksum (review)
Sender treat segment contents as
sequence of 16-bit integers
checksum addition (1rsquos complement sum) of segment contents
sender puts checksum value into UDPTCP 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 nonethelesshellip
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-14
Cyclic Redundancy Check (CRC) more powerful error-detection coding view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (in base-2 arithmetic) receiver knows G divides ltDRgt by G
if non-zero remainder error detected can detect any single error burst not longer than r bits (see later)
widely used in practice (Ethernet 80211 WiFi ATM)
ltDRgt =
=
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
8
copy From Computer Networking by KuroseampRoss DataLink Layer 6-15
CRC Example Want
D2r XOR R = nG equivalently
D2r = nG XOR R equivalently if we divide D2r by G
(in base-2 arithmetic) want remainder R
or R = D2r mod G
euro
R = remainder D sdot 2r
G⎡
⎣ ⎢
⎤
⎦ ⎥
Quotient
Dividend
In base-2 arithmetic no carries no borrows 1 + 1 = 0 0 ndash 1 = 1 + - XOR all equivalent
10011001
1
101
01011
00010101001
1100001100100110101001 011
101110
D
Divisor
G r = 3
000
Remainder
copy From Computer Networking by KuroseampRoss DataLink Layer 6-16
CRC Example the polynomial view
Transmitted frame T(x) = D(x) xr - R(x)
Is divisible by G(x)
D(x) = x5 + x3 + x2 + x r=3 G(x) = x3 + 1
euro
R(x) = remainder D(x) sdot xr
G(x)⎡
⎣ ⎢
⎤
⎦ ⎥
R(x) = x + 1
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
9
copy From Computer Networking by KuroseampRoss DataLink Layer 6-17
Why does it work We have T(x) = D(x) xr - R(x)
By construction T(x) is divisible by G(x) bull T(x) mod G(x) = 0
This is easy to check at the receiver provided that the sender and the receiver agree on a certain G(x)
Suppose some errors occur during transmission The received frame is T(x) + E(x) The receiver will then calculate the remainder of
(T(x) + E(x)) G(x) This remainder is equal to the remainder of E(x) G(x)
bull (T(x) + E(x)) mod G(x) = E(x) mod G(x) If the error is an E(x) that is not divisible by G(x) it will
be detected The choice of G(x) is thus very important
But impossible to detect all errors Why
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-18
Example of CRC with properties (1) Example of Generator G(x) = x16 + x12 + x5 + 1 Property 1
G(x) detects every error consisting of an odd number of error bits Proof G(x) is divisible by (x + 1) in other words G(x) = (x + 1) H(x)
bull in base-2 arithmetic G(1) = 1+1+1+1 = 0 An odd number of bit errors is modelled by a polynomial E(x) with an odd
number of terms Such E(x) cannot be divisible by (x + 1)
bull in base-2 arithmetic E(1) = 1 for such E(x) Therefore E(x) is not divisible by G(x)
More generally a G(x) composed of an even number of terms detects every error consisting of an odd number of error bits At least as good as a parity bit Could a parity bit be seen as a trivial CRC Any G(x) to suggest
Property 2 G(x) detects every 2-bit error (in any place in the frame)
From Computer Networks by Tanenbaum copy Prentice Hall
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
10
copy From Computer Networking by KuroseampRoss DataLink Layer 6-19
Example of CRC with properties (2) G(x) = x16 + x12 + x5 + 1 Property 3 G(x) detects every single error burst of length le 16 bits
An error burst of length n (ge 2) is 1 error bit followed by n-2 bits (correct or not) followed by 1 error bit
Proof An error burst of length le 16 bits can be modelled by E(x) = H(x) xk
with H(x) of degree le 15 and k (ge 0) being the number of bits after the last error bit
H(x) is not divisible by G(x) because H(x) is of degree le 15 and G(x) of degree 16
Using G(0) ne 0 it is easy to prove by induction that if H(x) xk is not divisible by G(x) which is true for k=0 then H(x) xk+1 is not divisible by G(x) This leads to E(x) not being divisible by G(x)
More generally a G(x) of degree r with G(0) ne 0 detects every single error burst of length le r bits
If errors are random G(x) detects 99997 of the 17-bit error bursts (Any undetectable error burst to suggest) 99998 of the 18-bit error bursts
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-20
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
11
copy From Computer Networking by KuroseampRoss DataLink Layer 6-21
Multiple Access Links and Protocols Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) old-fashioned Ethernet upstream Hybrid Fiber Coax (HFC) 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF (satellite)
humans at a cocktail party
(shared air acoustical)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-22
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
interference collision if node receives two or more signals at the same time
multiple access protocol distributed algorithm that determines how nodes
share channel ie determine when node can transmit communication about channel sharing must use channel
itself no out-of-band channel for coordination
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
12
copy From Computer Networking by KuroseampRoss DataLink Layer 6-23
An Ideal Multiple Access Protocol
Given broadcast channel of rate R bps
Desiderata 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 RM (fairness) 3 fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 simple
copy From Computer Networking by KuroseampRoss DataLink Layer 6-24
MAC Protocols a taxonomy Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use Random Access
channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can take
longer turns
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
13
copy From Computer Networking by KuroseampRoss DataLink Layer 6-25
Channel Partitioning MAC protocols TDMA TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length =
packet transmission time) in each round unused slots go idle example 6-station LAN 134 have packet slots
256 idle
1 3 4 1 3 4
6-slot frame
copy From Computer Networking by KuroseampRoss DataLink Layer 6-26
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 134 have packet frequency
bands 256 idle
freq
uenc
y ba
nds time
FDM cable
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
14
copy From Computer Networking by KuroseampRoss DataLink Layer 6-27
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 ldquocollisionrdquo random access MAC protocol specifies
how to detect collisions how to recover from collisions (eg via delayed
retransmissions) Examples of random access MAC protocols
slotted ALOHA ALOHA CSMA CSMACD CSMACA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-28
Slotted ALOHA
Assumptions all frames have same
size time is divided into
equal size slots (time to transmit 1 frame)
nodes start to transmit only at slot beginning
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame transmits in next slot if no collision node can
send new frame in next slot
if collision node retransmits frame in each subsequent slot with probability p until success
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
15
copy From Computer Networking by KuroseampRoss DataLink Layer 6-29
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
1 1 1 1
2
3
2 2
3 3
node 1
node 2
node 3
C C C S S S E E E
copy From Computer Networking by KuroseampRoss DataLink Layer 6-30
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p Note not exactly slotted ALOHA
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
p = 1N For many nodes take limit of
Np(1-p)N-1 = (1-1N)N-1
as N goes to infinity it gives a max efficiency of 1e = 037
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channel used for useful transmissions 37 of time
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
16
copy From Computer Networking by KuroseampRoss DataLink Layer 6-31
Pure (unslotted) ALOHA unslotted Aloha simpler no synchronization when frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
In frame time units
copy From Computer Networking by KuroseampRoss DataLink Layer 6-32
Pure Aloha efficiency P(success by given node) = P(node transmits) P(no other node transmits in [t0-1t0] P(no other node transmits in [t0t0+1] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
P (success by any node) = Np (1-p)2(N-1)
hellip choosing optimum p and then letting N go to infinity
= 1(2e) = 018
Even worse than slotted Aloha
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
17
copy From Computer Networking by KuroseampRoss DataLink Layer 6-33
Efficiency wrt average traffic load Let G = pN be the average aggregated traffic load
(or demand) per frame time = nr of transmission attempts per frame time N stations sending one frame with probability p in every
frame time Efficiency
Slotted ALOHA Np(1-p)N-1 = G (1-GN)N-1 ALOHA Np(1-p)2(N-1) = G (1-GN)2(N-1)
Efficiency (for a given G) when N gtgt Slotted ALOHA G e-G
ALOHA G e-2G
If G ltlt 1 efficiency asymp G perfect
euro
limNrarrinfin
1minus GN
⎛
⎝ ⎜
⎞
⎠ ⎟ N
= eminusG
copy From Computer Networking by KuroseampRoss DataLink Layer 6-34
Efficiency Optimum out of 100 frame times- 37 are used effectively- 26 are collisions- 37 are just empty
From Computer Networks by Tanenbaum copy Prentice Hall
ALOHA versus Slotted ALOHA
frame
Ideal S = G
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
18
copy From Computer Networking by KuroseampRoss DataLink Layer 6-35
CSMA (Carrier Sense Multiple Access)
Improving pure ALOHA with carrier sensing
CSMA listen before transmit If channel sensed idle transmit entire frame If channel sensed busy defer transmission
LBT Listen Before Talking (and deference)
human analogy donrsquot interrupt others
copy From Computer Networking by KuroseampRoss DataLink Layer 6-36
CSMA collisions collisions can still occur propagation delay means two nodes may not hear each otherrsquos transmission
collision entire packet transmission time wasted
spatial layout of nodes
distance amp propagation delay play role in determining collision probability
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
19
copy From Computer Networking by KuroseampRoss DataLink Layer 6-37
persistent CSMA (if channel is busy listen until it is freed)
non persistent CSMA (if channel is busy program a new attempt later)
p-persistent CSMA While true do
if channel is free then
with probability p immediate transmission or
with probability 1-p stay idle during at least propagation time (τ) else listen until the channel is freed
Trade-off between efficiency and delay bull This introduces a useless delay at low loads bull But the efficiency of the channel is better at high loads
p-persistent CSMA
copy From Computer Networking by KuroseampRoss DataLink Layer 6-38
Efficiency
Efficiency versus load for various random access protocols
From Computer Networks by Tanenbaum copy Prentice Hall
frame
Ideal
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
20
copy From Computer Networking by KuroseampRoss DataLink Layer 6-39
B = Channel Data Rate (so-called Bandwidth) (bps) F = (Maximum) Frame size (bits) L = Length of the channel (m) c = Propagation speed (ms)
τ = Propagation delay = L c (s) T = Transmission delay = F B (s) τ contention period (risk of collision) After τ channel implicitly reserved during T-τ
Let a = τ T = BL cF Need small a Let a = 1 rarr F = 100 BL c = plusmn 5 10-7 BL (with c = plusmn 200000 kms) Let B = 10 Mbps L = 25 km rarr F = 12500 bits (= 15625 bytes) This is roughly the Ethernet frame size
Engineering a CSMA network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-40
CSMACD (Collision Detection) CSMACD 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
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
21
copy From Computer Networking by KuroseampRoss DataLink Layer 6-41
CSMACD collision detection CSMACD CSMA
Lost time le 2 τ(worst case 2 max propagation times when the 2 stations are at the 2 ends) + detectabort time No abort so loss is T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-42
To detect collision the sender must still be transmitting when the collision propagates back to it So the condition is
T gt 2τ which means FB gt 2 Lc which leads to a minimal Fmin = 2BLc = plusmn BL 10-8 bits
Let B = 10 Mbps L = 25 km rarr Fmin = plusmn 250 bits (= plusmn 32 bytes) Ethernet has chosen 64 bytes = 512 bits (extra margin due to other delays)
A B
(a)
A B
(b)
A B
(c)
A B
(d)Collision attime τ
Noise burst getsback to A at 2τ
Packet startsat time 0
Packet almostat B at τ-ε
Minimal frame size with CSMACD
From Computer Networks by Tanenbaum copy Prentice Hall
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
22
copy From Computer Networking by KuroseampRoss DataLink Layer 6-43
Ethernet CSMACD algorithm 1 NIC receives datagram from
network layer creates frame 2 If NIC senses channel idle
starts frame transmission If NIC senses channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
4 If NIC detects another transmission while transmitting (collision) aborts and sends jam signal
5 After aborting NIC enters binary (exponential) backoff after mth collision (m le 10) for this frame NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2 (for m gt 10 take K in 01023)
So longer backoff interval when more collisions for a given frame
With this backoff algorithm Ethernet is sort of p-persistent CSMA with an adaptive p after the 1st collision
copy From Computer Networking by KuroseampRoss DataLink Layer 6-44
S = T (T + α2τ) = 1 (1 + α2τT) = 1 (1 + α2BLcF ) For large N α converges towards e (plusmn27) for a p-persistent CSMA with p = 1N (ideal case)
So for N gtgt S cannot be better than 1 (1 + e2τT) = 1 (1 + 54 τT)
Number of active stations = N
Channel efficiency
S10
09
08
07
06
05
04
03
02
01
0 1 2 4 8 16 32 64 128 256
1024 byte frames
512 byte frames
256 byte frames
128 byte frames
64 byte frames
From Computer Networks by Tanenbaum copy Prentice Hall
Channel efficiency of an adaptive p-persistent CSMACD
Let α = the average number of slots (2 τ) before any successful transmission
Incr
easi
ng f
ram
e si
ze
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
23
copy From Computer Networking by KuroseampRoss DataLink Layer 6-45
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocols share channel efficiently and fairly at high load inefficient at low load delay in channel access
1N 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
ldquotaking turnsrdquo protocols look for best of both worlds
copy From Computer Networking by KuroseampRoss DataLink Layer 6-46
ldquoTaking Turnsrdquo MAC protocols Polling master node
ldquoinvitesrdquo slave nodes to transmit in turn
typically used with ldquodumbrdquo slave devices
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
24
copy From Computer Networking by KuroseampRoss DataLink Layer 6-47
ldquoTaking Turnsrdquo MAC protocols Token passing control token passed from
one node to next sequentially
token message concerns
token overhead latency single point of failure
(token) known upper bound on
access time to channel o ne CSMA
T
data
(nothing to send)
T
copy From Computer Networking by KuroseampRoss DataLink Layer 6-48
cable headend
CMTS
ISP
cable modem termination system
multiple 40Mbps downstream (broadcast) channels single CMTS transmits into channels
multiple 30 Mbps upstream channels multiple access all users contend for certain upstream
channel time slots (others assigned)
Cable access network
cable modem splitter
hellip
hellip
Internet framesTV channels control transmitted downstream at different frequencies
upstream Internet frames TV control transmitted upstream at different frequencies in time slots
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
25
copy From Computer Networking by KuroseampRoss DataLink Layer 6-49
DOCSIS Data Over Cable Service Interface Spec FDM over upstream downstream frequency channels TDM upstream some slots assigned some have contention
downstream MAP frame assigns upstream slots request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
MAP frame for Interval [t1 t2]
Residences with cable modems
Downstream channel i
Upstream channel j
t1 t2
Assigned minislots containing cable modem upstream data frames
Minislots containing minislots request frames
cable headend
CMTS
Cable access network
copy From Computer Networking by KuroseampRoss DataLink Layer 6-50
Summary of MAC protocols
channel partitioning by time frequency (or code) Time Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACD carrier sensing easy in some technologies (wire) hard in
others (wireless) CSMACD used in Ethernet CSMACA used in 80211
taking turns polling from central site token passing Bluetooth FDDI Token Ring
Cable access networks use a combination of them
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
26
copy From Computer Networking by KuroseampRoss DataLink Layer 6-51
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LAN
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-52
MAC Addresses and ARP 32-bit IP address
network-layer address for interface used for layer 3 (network layer) forwarding
MAC (or LAN or physical or Ethernet) address function used ldquolocallyrdquo to get frame from one
interface to another physically-connected interface (same network in IP-addressing sense)
48-bit MAC address (for most LANs) bull burned in NIC ROM also sometimes software settable bull Eg 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation (each ldquonumberrdquo represents 4 bits)
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
27
copy From Computer Networking by KuroseampRoss DataLink Layer 6-53
LAN addresses and ARP Each adapter on LAN has unique LAN address
adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN (wired or wireless)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-54
LAN addresses (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address space
(to assure uniqueness) analogy
MAC address like Social Security Number IP address like postal address
MAC flat address portability can move LAN card from one LAN to another
IP hierarchical address NOT portable address depends on IP subnet to which node is attached
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
28
copy From Computer Networking by KuroseampRoss DataLink Layer 6-55
ARP Address Resolution Protocol
ARP table each IP node (host router) on LAN has table IPMAC address
mappings for some LAN nodes lt IP addr MAC addr TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determine interfacersquos MAC address knowing its IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-66-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
copy From Computer Networking by KuroseampRoss DataLink Layer 6-56
ARP protocol same LAN A wants to send datagram
to B Brsquos MAC address not in Arsquos
ARP table A broadcasts ARP query
packet containing Bs IP address dest MAC address =
FF-FF-FF-FF-FF-FF all nodes on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) Brsquos 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
All other stations had also cached Arsquos IP-to-MAC pair
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
29
copy From Computer Networking by KuroseampRoss DataLink Layer 6-57
walkthrough send datagram from A to B via R focus on addressing ndash at IP (datagram) and MAC layer (frame) assume A knows Brsquos IP address assume A knows IP address of first hop router R (how) assume A knows Rrsquos MAC address (how)
Addressing routing to another LAN
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
This is a really important example ndash make sure you understand
copy From Computer Networking by KuroseampRoss DataLink Layer 6-58
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
IP src 111111111111 IP dest 222222222222
A creates IP datagram with IP source A destination B A creates link-layer frame with Rs MAC address as dest frame
contains A-to-B IP datagram MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
30
copy From Computer Networking by KuroseampRoss DataLink Layer 6-59
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP Eth Phy
frame sent from A to R
IP Eth Phy
frame received at R datagram removed passed up to IP
MAC src 74-29-9C-E8-FF-55 MAC dest E6-E9-00-17-BB-4B
IP src 111111111111 IP dest 222222222222
IP src 111111111111 IP dest 222222222222
copy From Computer Networking by KuroseampRoss DataLink Layer 6-60
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN
IP src 111111111111 IP dest 222222222222
R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
31
copy From Computer Networking by KuroseampRoss DataLink Layer 6-61
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
IP Eth Phy
copy From Computer Networking by KuroseampRoss DataLink Layer 6-62
R
1A-23-F9-CD-06-9B 222222222220
111111111110 E6-E9-00-17-BB-4B CC-49-DE-D0-AB-7D
111111111112
111111111111 74-29-9C-E8-FF-55
A 222222222222 49-BD-D2-C7-56-2A
222222222221 88-B2-2F-54-1A-0F
B
Addressing routing to another LAN R forwards datagram with IP source A destination B R creates link-layer frame with Bs MAC address as dest frame
contains A-to-B IP datagram
IP src 111111111111 IP dest 222222222222
MAC src 1A-23-F9-CD-06-9B MAC dest 49-BD-D2-C7-56-2A
IP Eth Phy
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
32
copy From Computer Networking by KuroseampRoss DataLink Layer 6-63
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
copy From Computer Networking by KuroseampRoss DataLink Layer 6-64
Ethernet ldquodominantrdquo wired LAN technology first widely used LAN technology simple cheap single chip multiple speeds (eg Broadcom BCM5761) kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernet sketch
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
33
copy From Computer Networking by KuroseampRoss DataLink Layer 6-65
Ethernet physical topology bus popular through mid 90s
all nodes in same collision domain (can collide with each other)
star prevails today bus was replaced by central device
(initially hubs now switches)
hub or switch
bus coaxial cable
star
copy From Computer Networking by KuroseampRoss DataLink Layer 6-66
Hubs physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering at hub no CSMACD at hub host NICs detect collisions
hub
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
34
copy From Computer Networking by KuroseampRoss DataLink Layer 6-67
Switches switches prevail today
active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol
(nodes do not collide with each other) more later
switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-68
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
dest address
source address
data (payload) CRC preamble
type
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
35
copy From Computer Networking by KuroseampRoss DataLink Layer 6-69
Ethernet Frame Structure (more) Addresses 6 byte source destination MAC
addresses if adapter receives frame with matching destination
address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise adapter discards frame Type indicates higher layer protocol (mostly IP
but others possible eg Novell IPX AppleTalk) CRC cyclic redundancy check at receiver
error detected frame is dropped
dest address
source address
data (payload) CRC preamble
type
copy From Computer Networking by KuroseampRoss DataLink Layer 6-70
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs
unreliable receiving NIC doesnrsquot send acks nor nacks to sending NIC data in dropped frames recovered only if initial
sender uses higher layer rdt (eg TCP) otherwise dropped data lost
Ethernetrsquos MAC protocol unslotted CSMACD with binary backoff
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
36
copy From Computer Networking by KuroseampRoss DataLink Layer 6-71
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1 Gbps 10 Gbps different physical layer media fiber cable
application transport network
link physical
MAC protocol and frame format
100BASE-TX
100BASE-T4
100BASE-FX 100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layer copper (twisted pair) physical layer
copy From Computer Networking by KuroseampRoss DataLink Layer 6-72
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
37
copy From Computer Networking by KuroseampRoss DataLink Layer 6-73
Ethernet Switch link-layer device smarter than hubs take
active role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
copy From Computer Networking by KuroseampRoss DataLink Layer 6-74
Switch multiple simultaneous transmissions
hosts have dedicated direct connection to switch
switches buffer packets Ethernet protocol used on
each incoming link but no collisions full duplex each link is its own collision
domain switching A-to-Arsquo and
B-to-Brsquo can transmit simultaneously without collisions not possible with dumb hub
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
38
copy From Computer Networking by KuroseampRoss DataLink Layer 6-75
Switch forwarding table
Q how does switch know Arsquo reachable via interface 4 Brsquo reachable via interface 5
switch with six interfaces (123456)
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6 A each switch has a switch table each entry (MAC address of hostrouter
interface to reach hostrouter time stamp)
looks like a forwarding table
Q how are entries created maintained in switch table
something like a routing protocol
copy From Computer Networking by KuroseampRoss DataLink Layer 6-76
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Switch self-learning switch learns which hosts
routers can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A Arsquo
Source A Dest Arsquo
MAC addr interface TTL Switch table
(initially empty) A 1 60
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
39
copy From Computer Networking by KuroseampRoss DataLink Layer 6-77
Switch frame filteringforwarding When frame received at switch
1 record incoming link MAC address of sending hostrouter 2 index switch table using MAC destination address 3 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 by entry else flood forward on all but the interface
on which the frame arrived
copy From Computer Networking by KuroseampRoss DataLink Layer 6-78
A
Arsquo
B
Brsquo C
Crsquo
1 2
3 4 5
6
Self-learning forwarding example A Arsquo
Source A Dest Arsquo
MAC addr interface TTL switch table
(initially empty) A 1 60
A Arsquo A Arsquo A Arsquo A Arsquo A Arsquo
frame destination Arsquo location unknown
flood
Arsquo A
destination A location known
Arsquo 4 60
selectively send on just one link
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
40
copy From Computer Networking by KuroseampRoss DataLink Layer 6-79
Interconnecting switches switches can be connected together
Q sending from A to F - how does S1 know how to forward frame destined for F via S4 and S2
A self learning (works exactly the same as in single-switch case)
A
B
S1
C D
E
F S2
S4
S3
H I
G
copy From Computer Networking by KuroseampRoss DataLink Layer 6-80
Self-learning multi-switch example Suppose C sends frame to I I responds to C
Q show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
F S2
S4
S3
H I
G
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
41
copy From Computer Networking by KuroseampRoss DataLink Layer 6-81
Institutional network
to external network
router
IP subnet
mail server
web server
copy From Computer Networking by KuroseampRoss DataLink Layer 6-82
All principles seen so far are applicable to a subnet with several switches if there is no cycle in the topology No cycle = no redundancy in case of failure
Part of subnet can be disconnected
From Computer Networks by Tanenbaum copy Prentice Hall
More than one switch in a subnet
A
B
S1
C D
E
F S2
S4
S3
H I
G
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
42
DataLink Layer 6-83
Assume frame F has a destination address that is unknown to all switches (not in their forwarding tables)
Problem frame F is flooded by S1 and then by all other switches and will loop forever
Solution build a logical spanning tree topology over the real topology
F
Initial frame
F
F
forwardedby S2 and by S3
Problem with cycles
S1 S3
S2
F
copy From Computer Networking by KuroseampRoss DataLink Layer 6-84
Build a logical tree reaching all LAN segments (here simply called LANrsquos)
1 Determine the root switch (has the smallest switch id) Switch id = (priority MAC addr) Switches regularly flood control
messages (BPDUs) on all their output ports
BPDU = ltSource switch id root as assumed distance to rootgt
All switches will soon discover the root id
A B2
C31
LAN
4
G
I
D E F
6 75
H J8 9
Switch
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (1) Root switch A sends ltAA0gt on LAN1 and LAN2
B sends ltBA1gt on LAN3
Note A laquo LAN segment raquo is sometimes called a laquo collision domain raquo
materialized by a hub but in practice a LAN segment is most often just a cable
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
43
copy From Computer Networking by KuroseampRoss DataLink Layer 6-85
2 Build the tree By continuously receiving these
BPDUs (possibly on several ports) a switch knows its distance to the root and which port leads to the root by that shortest distance (root port r)
Similar to a DV routing protocol with a distance vector limited to a unique component the root switch
In practice distances are inversely proportional to link capacities
bull Remember InvCap
A B2
C31 4
G
I
D E F
6 75
H J8 9
r
r
r
rr
r
r
rr
From Computer Networks by Tanenbaum copy Prentice Hall
Spanning tree (2) Root portRoot switch
copy From Computer Networking by KuroseampRoss DataLink Layer 6-86
3 Decide if non-root ports are (data) forwarding or (data) blocking A port is forwarding (f) on a given LAN iff the BPDUs this switch sends on this LAN are smaller than those other switches (would) send
Smaller = shorter distance or equal distance and smaller switch id
Example on LAN6 E sends ltEA2gt G would send ltGA2gt and J would send ltJA3gt So E is elected to be the only one to forward frames on LAN6 J is too far away from the root and G gt E
A B2
C31 4
G
I
D E F
6 75
H J8 9
rf
r
r
rr
r
r
rr
f f f
f f f
f f
Spanning tree (3) Forwarding port
Blocking port
From Computer Networks by Tanenbaum copy Prentice Hall
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
44
copy From Computer Networking by KuroseampRoss DataLink Layer 6-87
Some switches (eg G and J) are not part of the tree Another case could be that some ports of some switches are blocking
They could become part of the tree if another switch or port would fail (leading to no refresh of BPDUs)
So switches have to listen to BPDUs on blocking ports to detect failures
1 2 3 4
5 6 7
8 9
A B C
D E F
H
LAN
Switch thatis part of the
spanning tree
Switch that isnot part of thespanning tree
I
The resulting spanning tree Routing on a spanning tree is not optimal
Same spanning tree for all source-destination pair
Compare to layer-3 routing
From Computer Networks by Tanenbaum copy Prentice Hall
copy From Computer Networking by KuroseampRoss DataLink Layer 6-88
Switches vs routers
both are store-and-forward routers network-layer
devices (examine network-layer headers)
switches link-layer devices (examine link-layer headers)
both have forwarding tables routers compute tables using
routing algorithms IP addresses
switches learn forwarding table using flooding learning MAC addresses
application transport network
link physical
network link
physical
link physical
switch
datagram
application transport network
link physical
frame
frame
frame datagram
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
45
copy From Computer Networking by KuroseampRoss DataLink Layer 6-89
Summary comparison
hubs routers switches
traffic isolation
no yes yes
plug amp play yes no yes
optimal routing
no yes no
cut through
yes no yes
Some do
copy From Computer Networking by KuroseampRoss DataLink Layer 6-90
Link Layer
61 Introduction and services
62 Error detection 63Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
46
copy From Computer Networking by KuroseampRoss DataLink Layer 6-91
Data center networks 10rsquos to 100rsquos of thousands of hosts often closely
coupled in close proximity e-business (eg Amazon) content-servers (eg YouTube Akamai Apple Microsoft) search engines data mining (eg Google)
challenges o multiple applications
each serving massive numbers of clients
o managingbalancing load avoiding processing networking data bottlenecks Inside a 40-ft Microsoft container
Chicago data center
copy From Computer Networking by KuroseampRoss DataLink Layer 6-92
Serverracks
TORswitches(TopOfRack)
Tier-1switches
Tier-2switches
Loadbalancer
Loadbalancer
B
1 2 3 4 5 6 7 8
A C
Borderrouter
Accessrouter
Internet
load balancer application-layer routing receives external client requests directs workload within data center returns results to external client
(hiding data center internals from client)
Data center networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
47
copy From Computer Networking by KuroseampRoss DataLink Layer 6-93
Serverracks
TORswitches
Tier-1switches
Tier-2switches
1 2 3 4 5 6 7 8
rich interconnection among switches racks o increased throughput between racks (multiple
routing paths possible) o increased reliability via redundancy
Data center networks
copy From Computer Networking by KuroseampRoss DataLink Layer 6-94
Link Layer
61 Introduction and services
62 Error detection 63 Multiple access
protocols 64 LANs
Addressing ARP Ethernet Switches
65 Data center networking
66 A day in the life of a web request
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
48
copy From Computer Networking by KuroseampRoss DataLink Layer 6-95
Synthesis a day in the life of a web request
journey down protocol stack complete application transport network link
putting-it-all-together synthesis goal identify review understand protocols (at
all layers) involved in seemingly simple scenario requesting www page
scenario student attaches laptop to campus network requestsreceives wwwgooglecom
copy From Computer Networking by KuroseampRoss DataLink Layer 6-96
A day in the life scenario
Comcast network 68800013
Googlersquos network 64233160019 64233169105
web server
DNS server
school network 68802024
web page
browser
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
49
copy From Computer Networking by KuroseampRoss DataLink Layer 6-97
router (runs DHCP)
A day in the lifehellip connecting to the Internet
connecting laptop needs to get its own IP address addr of first-hop router addr of DNS server use DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP DHCP
DHCP request encapsulated in UDP encapsulated in IP encapsulated in 8023 Ethernet
Ethernet frame broadcast (dest FFFFFFFFFFFF) on LAN received at router running DHCP server (+ switch learning)
Ethernet demuxed to IP demuxed UDP demuxed to DHCP
copy From Computer Networking by KuroseampRoss DataLink Layer 6-98
router (runs DHCP)
DHCP server formulates DHCP ACK containing clientrsquos IP address IP address of first-hop router for client name amp IP address of DNS server
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP UDP
IP Eth Phy
DHCP
DHCP
DHCP
DHCP
DHCP
encapsulation at DHCP server frame forwarded (switch learning) through LAN demultiplexing at client
Client now has IP address knows name amp addr of DNS server IP address of its first-hop router
DHCP client receives DHCP ACK reply
A day in the lifehellip connecting to the Internet
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
50
copy From Computer Networking by KuroseampRoss DataLink Layer 6-99
router (runs DHCP)
A day in the lifehellip ARP (before DNS before HTTP)
before sending HTTP request need IP address of wwwgooglecom DNS
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS query created encapsulated in UDP encapsulated in IP encapsulated in Eth To send frame to router need MAC address of router interface ARP
ARP query broadcast received by router which replies with ARP reply giving MAC address of router interface
client now knows MAC address of first hop router so can now send frame containing DNS query
ARP query
Eth Phy
ARP
ARP
ARP reply
copy From Computer Networking by KuroseampRoss DataLink Layer 6-100
router (runs DHCP)
DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
DNS
IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router
IP datagram forwarded from campus network into comcast network routed (tables created by RIP OSPF IS-IS andor BGP routing protocols) to DNS server
demuxrsquoed to DNS server DNS server replies to client with
IP address of wwwgooglecom (perhaps after querying other DNS servers)
Comcast network 68800013
DNS server DNS UDP
IP Eth Phy
DNS
DNS
DNS
DNS
A day in the lifehellip using DNS
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
51
copy From Computer Networking by KuroseampRoss DataLink Layer 6-101
router (runs DHCP)
A day in the lifehellipTCP connection carrying HTTP
HTTP TCP IP Eth Phy
HTTP
to send HTTP request client first opens TCP socket to web server
TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server
TCP connection established 64233169105 web server
SYN
SYN
SYN
SYN
TCP IP
Eth Phy
SYN
SYN
SYN
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
SYNACK
web server responds with TCP SYNACK (step 2 in 3-way handshake)
copy From Computer Networking by KuroseampRoss DataLink Layer 6-102
router (runs DHCP)
A day in the lifehellip HTTP requestreply HTTP TCP IP Eth Phy
HTTP
HTTP request sent into TCP socket
IP datagram containing HTTP request routed to wwwgooglecom
IP datagram containing HTTP reply routed back to client
64233169105 web server
HTTP TCP IP Eth Phy
web server responds with HTTP reply (containing web page)
HTTP
HTTP
HTTP HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
HTTP
web page finally () displayed
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks
52
copy From Computer Networking by KuroseampRoss DataLink Layer 6-103
Chapter 6 Summary principles behind data link layer services
error detection sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of various link layer technologies Ethernet switched LANs
bull learning building spanning tree evolution of the term ldquolinkrdquo
1 physical wire connecting two communicating nodes 2 physical channel
bull point-to-point or shared wire bull ldquowirerdquo could also be radio spectrum
3 complex switch infrastructure all these ldquolinksrdquo still viewed by IP as a layer 2 ldquochannelrdquo
copy From Computer Networking by KuroseampRoss DataLink Layer 6-104
Chapter 6 letrsquos take a breath journey down protocol stack complete (except PHY)
solid understanding of networking principles practice
hellip could stop here hellip but lots of interesting topics wireless networks and mobility content distribution and multimedia applications engineering networks to provide better quality to apps advanced routing and traffic engineering securing networks managing networks